Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 69a7bd2

Browse files
authored
fix YAML load bug in load_framework_list (#401)
1 parent 28c9e09 commit 69a7bd2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sparseml/optim/helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def rewrite_recipe_yaml_string_with_classes(recipe_contianer: Any) -> str:
5151
updated_yaml_str = yaml.dump(recipe_contianer)
5252

5353
# convert object dicts back to object declarations and return
54-
pattern = re.compile(r"OBJECT\.(?P<class_name>(?!.*\.)[a-zA-Z_][a-zA-Z^._0-9]+):")
54+
pattern = re.compile(
55+
r"OBJECT\.(?P<class_name>(?!.*\.)[a-zA-Z_][a-zA-Z^._0-9]+):( null)?"
56+
)
5557
return pattern.sub(r"!\g<class_name>", updated_yaml_str)
5658

5759

@@ -147,7 +149,6 @@ def _evaluate_recipe_variables(
147149
def _maybe_evaluate_yaml_object(
148150
obj: Any, variables: Dict[str, Union[int, float]]
149151
) -> Any:
150-
151152
if isinstance(obj, str):
152153
return _maybe_evaluate_recipe_equation(obj, variables)
153154
elif isinstance(obj, list):

0 commit comments

Comments
 (0)