Skip to content

Commit b290970

Browse files
committed
test added for model_dump
1 parent 714bc69 commit b290970

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/llmcompressor/recipe/recipe.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -528,24 +528,24 @@ def model_dump(self, *args, **kwargs) -> Dict[str, Any]:
528528
"""
529529
Override the model_dump method to provide a dictionary representation that
530530
is compatible with model_validate.
531-
531+
532532
Unlike the standard model_dump, this transforms the stages list to a format
533533
expected by the validation logic, ensuring round-trip compatibility with
534534
model_validate.
535-
535+
536536
:return: A dictionary representation of the recipe compatible with model_validate
537537
"""
538538
# The simplest approach is to use the same structure as the yaml() method
539539
# which is known to work with model_validate
540540
yaml_dict = self._get_yaml_dict()
541-
541+
542542
# Add any missing top-level fields from the original data
543543
# but exclude the 'stages' field which is already properly formatted in yaml_dict
544544
original_data = super().model_dump(*args, **kwargs)
545545
for key, value in original_data.items():
546-
if key not in yaml_dict and key != 'stages' and value is not None:
546+
if key not in yaml_dict and key != "stages" and value is not None:
547547
yaml_dict[key] = value
548-
548+
549549
return yaml_dict
550550

551551
def yaml(self, file_path: Optional[str] = None) -> str:

0 commit comments

Comments
 (0)