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

Commit 36799e9

Browse files
authored
Changed inconsistent sparsezoo recipe api in load_recipe_yaml_str (#167)
1 parent ebde035 commit 36799e9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/sparseml/utils/helpers.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,17 +780,19 @@ def load_recipe_yaml_str(file_path: Union[str, OptimizationRecipe]) -> str:
780780
:param file_path: file path to recipe YAML file or markdown recipe card or
781781
stub to a SparseZoo model whose recipe will be downloaded and loaded.
782782
SparseZoo stubs should be preceded by 'zoo:', and can contain an optional
783-
'?recipe_type=<type>' parameter. Can also be a SparseZoo OptimizationRecipe
784-
object. i.e. '/path/to/local/recipe.yaml', 'zoo:model/stub/path',
785-
'zoo:model/stub/path?recipe_type=transfer'
783+
'?recipe_type=<type>' parameter or include a `/<type>` subpath. Can also
784+
be a SparseZoo OptimizationRecipe object. i.e. '/path/to/local/recipe.yaml',
785+
'zoo:model/stub/path', 'zoo:model/stub/path?recipe_type=transfer_learn',
786+
'zoo:model/stub/path/transfer_learn'
786787
:return: the recipe YAML configuration loaded as a string
787788
"""
788789
if isinstance(file_path, OptimizationRecipe):
789790
# download and unwrap OptimizationRecipe object
790791
file_path = file_path.downloaded_path()
791792
elif file_path.startswith("zoo:"):
792793
# download from zoo stub
793-
file_path = Zoo.download_recipe_from_stub(file_path)
794+
recipe = Zoo.download_recipe_from_stub(file_path)
795+
file_path = recipe.downloaded_path()
794796

795797
extension = file_path.lower().split(".")[-1]
796798
if extension not in ["md", "yaml"]:

0 commit comments

Comments
 (0)