Handle non-serializable objects in vllm bench (#21665)

This commit is contained in:
Huy Do
2025-07-26 20:35:22 -07:00
committed by GitHub
parent eed2f463b2
commit 971948b846

View File

@ -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>",
)