Skip to content

Commit 05ec257

Browse files
authored
Merge branch 'develop' into compile
2 parents 66cd4c5 + 7f94f06 commit 05ec257

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

benchmarks/benchmark_serving.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,15 @@ async def limited_request_func(request_func_input, pbar):
463463
if pbar is not None:
464464
pbar.close()
465465

466+
benchmark_outputs = outputs
466467
drop_ratio = args.drop_ratio
467468
if 0.0 < drop_ratio < 1:
468469
# 按drop_ratio头尾各舍弃一半请求,不计入benchmark统计
469470
n = len(outputs)
470471
drop_count = int(n * drop_ratio)
471472
half = drop_count // 2
472473
if half > 0:
473-
outputs = outputs[half : n - half]
474+
benchmark_outputs = outputs[half : n - half]
474475

475476
# 根据收到最后一个chunk的时间戳计算总时长
476477
if len(outputs) >= 2:
@@ -479,15 +480,15 @@ async def limited_request_func(request_func_input, pbar):
479480
benchmark_duration = 0.0
480481

481482
print(f"丢弃前数量: {n}")
482-
print(f"丢弃后数量: {len(outputs)}")
483+
print(f"丢弃后数量: {len(benchmark_outputs)}")
483484
print(f"benchmark_duration: {benchmark_duration} 秒")
484485
else:
485486
benchmark_duration = time.perf_counter() - benchmark_start_time
486487
print(f"benchmark_duration: {benchmark_duration} 秒")
487488

488489
metrics, actual_output_lens = calculate_metrics(
489490
# input_requests=input_requests,
490-
outputs=outputs,
491+
outputs=benchmark_outputs,
491492
dur_s=benchmark_duration,
492493
# tokenizer=tokenizer,
493494
selected_percentiles=selected_percentiles,
@@ -516,7 +517,7 @@ async def limited_request_func(request_func_input, pbar):
516517
"total_token_throughput": metrics.total_token_throughput,
517518
"input_lens": [output.prompt_len for output in outputs],
518519
"infer_input_lens": [output.prompt_tokens for output in outputs],
519-
"output_lens": actual_output_lens,
520+
"output_lens": [output.output_tokens for output in outputs],
520521
"ttfts": [output.ttft for output in outputs],
521522
"itls": [output.itl for output in outputs],
522523
"input_texts": [input.prompt for input in input_requests],

0 commit comments

Comments
 (0)