Files
FastDeploy/tests/entrypoints/cli/benchmark/test_throughput.py
qwes5s5 6fd3e72da1 [FastDeploy Cli] Bench Command eval and throughput (#4239)
* bench command

* bench command

* bench command

* bench command

* bench command

---------

Co-authored-by: K11OntheBoat <your_email@example.com>
2025-10-10 16:17:44 +08:00

58 lines
1.7 KiB
Python

"""
Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import argparse
import unittest
from fastdeploy.entrypoints.cli.benchmark.throughput import (
BenchmarkThroughputSubcommand,
)
class TestBenchmarkThroughputSubcommand(unittest.TestCase):
"""
测试 BenchmarkThroughputSubcommand 类。
"""
def test_add_cli_args(self):
parser = argparse.ArgumentParser()
BenchmarkThroughputSubcommand.add_cli_args(parser)
args = parser.parse_args(
[
"--backend",
"fastdeploy",
"--dataset-name",
"random",
"--input-len",
"100",
"--output-len",
"50",
"--num-prompts",
"10",
]
)
self.assertEqual(args.backend, "fastdeploy")
self.assertEqual(args.dataset_name, "random")
self.assertEqual(args.input_len, 100)
self.assertEqual(args.output_len, 50)
self.assertEqual(args.num_prompts, 10)
# 如果你在命令行运行这个文件,下面的代码会执行测试
if __name__ == "__main__":
unittest.main()