[Misc] Separate total and output tokens in benchmark_throughput.py (#8914)

This commit is contained in:
Michael Goin 2024-10-23 12:47:20 -04:00 committed by GitHub
parent e5ac6a4199
commit fd0e2cfdb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -272,8 +272,10 @@ def main(args: argparse.Namespace):
raise ValueError(f"Unknown backend: {args.backend}")
total_num_tokens = sum(prompt_len + output_len
for _, prompt_len, output_len in requests)
total_output_tokens = sum(output_len for _, _, output_len in requests)
print(f"Throughput: {len(requests) / elapsed_time:.2f} requests/s, "
f"{total_num_tokens / elapsed_time:.2f} tokens/s")
f"{total_num_tokens / elapsed_time:.2f} total tokens/s, "
f"{total_output_tokens / elapsed_time:.2f} output tokens/s")
# Output JSON results if specified
if args.output_json: