Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/guidellm/utils/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def to_dict_pydantic(self, item: Any) -> Any:
"*PYD*": True,
"typ": item.__class__.__name__,
"mod": item.__class__.__module__,
"dat": item.model_dump(mode="python"),
"dat": item.model_dump(mode="python", exclude_computed_fields=True),
}

def from_dict_pydantic(self, item: dict[str, Any]) -> Any:
Expand Down Expand Up @@ -572,7 +572,9 @@ def to_sequence_pydantic(self, obj: BaseModel) -> str | bytes:
"""
class_name: str = obj.__class__.__name__
class_module: str = obj.__class__.__module__
json_data = obj.__pydantic_serializer__.to_json(obj)
json_data = obj.__pydantic_serializer__.to_json(
obj, exclude_computed_fields=True
)

return class_name.encode() + b"|" + class_module.encode() + b"|" + json_data

Expand Down
1 change: 0 additions & 1 deletion tests/unit/utils/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def test_encode_decode_pydantic(self, valid_instances, obj: Any):
else:
assert decoded == obj

@pytest.mark.xfail(reason="old and broken", run=False)
@pytest.mark.smoke
@pytest.mark.parametrize(
"obj",
Expand Down