From 6ace2f72b03fe41475d7d64e2bfd40b79c447f5b Mon Sep 17 00:00:00 2001 From: Huy Do Date: Tue, 26 Aug 2025 04:16:09 -0700 Subject: [PATCH] Fix writing benchmark results with tuple keys (#23633) Signed-off-by: Huy Do --- vllm/benchmarks/lib/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vllm/benchmarks/lib/utils.py b/vllm/benchmarks/lib/utils.py index 5f95fdcc75829..0c27687dcf16d 100644 --- a/vllm/benchmarks/lib/utils.py +++ b/vllm/benchmarks/lib/utils.py @@ -54,7 +54,12 @@ class InfEncoder(json.JSONEncoder): def clear_inf(self, o: Any): if isinstance(o, dict): - return {k: self.clear_inf(v) for k, v in o.items()} + return { + str(k) + if not isinstance(k, (str, int, float, bool, type(None))) + else k: self.clear_inf(v) + for k, v in o.items() + } elif isinstance(o, list): return [self.clear_inf(v) for v in o] elif isinstance(o, float) and math.isinf(o):