From 971948b846994819c50cb5c5f04a54822635e303 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Sat, 26 Jul 2025 20:35:22 -0700 Subject: [PATCH] Handle non-serializable objects in vllm bench (#21665) --- vllm/benchmarks/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vllm/benchmarks/utils.py b/vllm/benchmarks/utils.py index f0bb99326ab40..5f95fdcc75829 100644 --- a/vllm/benchmarks/utils.py +++ b/vllm/benchmarks/utils.py @@ -67,4 +67,9 @@ class InfEncoder(json.JSONEncoder): def write_to_json(filename: str, records: list) -> None: with open(filename, "w") as f: - json.dump(records, f, cls=InfEncoder) + json.dump( + records, + f, + cls=InfEncoder, + default=lambda o: f"<{type(o).__name__} is not JSON serializable>", + )