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

Commit 238b6ef

Browse files
authored
Falling back to model.pth if model.ckpt.pth is missing (#1195) (#1196)
1 parent 5660cea commit 238b6ef

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/sparseml/pytorch/utils/helpers.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,17 +1146,15 @@ def download_framework_model_by_recipe_type(
11461146
recipe_name = recipe_name or (
11471147
zoo_model.stub_params.get("recipe_type") or zoo_model.stub_params.get("recipe")
11481148
)
1149+
1150+
framework_model = None
11491151
if recipe_name and "transfer" in recipe_name.lower():
11501152
# fetching the model for transfer learning
11511153
model_name = f"model.ckpt.{model_suffix}"
11521154
framework_model = zoo_model.training.default.get_file(model_name)
1153-
if not framework_model:
1154-
raise ValueError(
1155-
f"Could not find saved checkpoint {model_name} in SparseZoo Model "
1156-
f"{zoo_model.source}"
1157-
)
1158-
else:
1159-
# fetching the model for inference
1155+
1156+
if framework_model is None:
1157+
# fetching the model for inference or fall back if model.ckpt.pth doesn't exist
11601158
model_name = f"model.{model_suffix}"
11611159
framework_model = zoo_model.training.default.get_file(model_name)
11621160

0 commit comments

Comments
 (0)