From 3a3918121f22c7a936df7cc248fa1a1b9507a0bc Mon Sep 17 00:00:00 2001 From: Lzhang-hub <57925599+Lzhang-hub@users.noreply.github.com> Date: Thu, 6 Mar 2025 21:34:02 +0800 Subject: [PATCH] fix bench serving bug (#4135) --- python/sglang/bench_serving.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/bench_serving.py b/python/sglang/bench_serving.py index 1e003f76a..db22f42c4 100644 --- a/python/sglang/bench_serving.py +++ b/python/sglang/bench_serving.py @@ -220,7 +220,7 @@ async def async_request_openai_completions( most_recent_timestamp = timestamp generated_text += data["choices"][0]["text"] - output_len = data.get("usage", {}).get( + output_len = (data.get("usage") or {}).get( "completion_tokens", output_len )