mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-08-12 14:41:21 +08:00
[Bench] Split serve.py:main into async/async versions (#22405)
Signed-off-by: Linkun <github@lkchen.net>
This commit is contained in:
parent
2a4c825523
commit
4d4297e8fe
@ -948,7 +948,10 @@ def add_cli_args(parser: argparse.ArgumentParser):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def main(args: argparse.Namespace):
|
def main(args: argparse.Namespace) -> dict[str, Any]:
|
||||||
|
return asyncio.run(main_async(args))
|
||||||
|
|
||||||
|
async def main_async(args: argparse.Namespace) -> dict[str, Any]:
|
||||||
print(args)
|
print(args)
|
||||||
random.seed(args.seed)
|
random.seed(args.seed)
|
||||||
np.random.seed(args.seed)
|
np.random.seed(args.seed)
|
||||||
@ -1025,8 +1028,7 @@ def main(args: argparse.Namespace):
|
|||||||
gc.collect()
|
gc.collect()
|
||||||
gc.freeze()
|
gc.freeze()
|
||||||
|
|
||||||
benchmark_result = asyncio.run(
|
benchmark_result = await benchmark(
|
||||||
benchmark(
|
|
||||||
endpoint_type=args.endpoint_type,
|
endpoint_type=args.endpoint_type,
|
||||||
api_url=api_url,
|
api_url=api_url,
|
||||||
base_url=base_url,
|
base_url=base_url,
|
||||||
@ -1052,10 +1054,9 @@ def main(args: argparse.Namespace):
|
|||||||
ramp_up_start_rps=args.ramp_up_start_rps,
|
ramp_up_start_rps=args.ramp_up_start_rps,
|
||||||
ramp_up_end_rps=args.ramp_up_end_rps,
|
ramp_up_end_rps=args.ramp_up_end_rps,
|
||||||
ready_check_timeout_sec=args.ready_check_timeout_sec,
|
ready_check_timeout_sec=args.ready_check_timeout_sec,
|
||||||
))
|
)
|
||||||
|
|
||||||
# Save config and results to json
|
# Save config and results to json
|
||||||
if args.save_result or args.append_result:
|
|
||||||
result_json: dict[str, Any] = {}
|
result_json: dict[str, Any] = {}
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
@ -1108,6 +1109,7 @@ def main(args: argparse.Namespace):
|
|||||||
del benchmark_result[field]
|
del benchmark_result[field]
|
||||||
|
|
||||||
# Save to file
|
# Save to file
|
||||||
|
if args.save_result or args.append_result:
|
||||||
base_model_id = model_id.split("/")[-1]
|
base_model_id = model_id.split("/")[-1]
|
||||||
max_concurrency_str = (f"-concurrency{args.max_concurrency}"
|
max_concurrency_str = (f"-concurrency{args.max_concurrency}"
|
||||||
if args.max_concurrency is not None else "")
|
if args.max_concurrency is not None else "")
|
||||||
@ -1129,3 +1131,5 @@ def main(args: argparse.Namespace):
|
|||||||
outfile.write("\n")
|
outfile.write("\n")
|
||||||
json.dump(result_json, outfile)
|
json.dump(result_json, outfile)
|
||||||
save_to_pytorch_benchmark_format(args, result_json, file_name)
|
save_to_pytorch_benchmark_format(args, result_json, file_name)
|
||||||
|
|
||||||
|
return result_json
|
||||||
Loading…
x
Reference in New Issue
Block a user