Skip to content

Commit a2b8360

Browse files
authored
Handle non-serializable objects in vllm bench (vllm-project#21665)
1 parent f93ef37 commit a2b8360

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ def iterencode(self, o: Any, *args, **kwargs) -> Any:
6767

6868
def write_to_json(filename: str, records: list) -> None:
6969
with open(filename, "w") as f:
70-
json.dump(records, f, cls=InfEncoder)
70+
json.dump(
71+
records,
72+
f,
73+
cls=InfEncoder,
74+
default=lambda o: f"<{type(o).__name__} is not JSON serializable>",
75+
)

0 commit comments

Comments
 (0)