From f8de642d90fa87e1dbf9e740e74d5f55c7a28870 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Sat, 26 Jul 2025 17:13:46 -0700 Subject: [PATCH] Handle non-serializable objects in vllm bench Signed-off-by: Huy Do --- 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 f0bb99326ab4..5f95fdcc7582 100644 --- a/vllm/benchmarks/utils.py +++ b/vllm/benchmarks/utils.py @@ -67,4 +67,9 @@ def iterencode(self, o: Any, *args, **kwargs) -> Any: 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>", + )