Skip to content

Commit d1be1f1

Browse files
committed
Fix logic for preparing model with no default example
Signed-off-by: Mattt Zmuda <mattt@replicate.com>
1 parent f890859 commit d1be1f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

replicate/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ def prepare_model(self, attrs: Union[Model, Dict]) -> Model:
143143
attrs.id = f"{attrs.owner}/{attrs.name}"
144144
elif isinstance(attrs, dict):
145145
attrs["id"] = f"{attrs['owner']}/{attrs['name']}"
146-
attrs.get("default_example", {}).pop("version", None)
146+
if "default_example" in attrs and "version" in attrs["default_example"]:
147+
attrs["default_example"].pop("version", None)
147148

148149
model = super().prepare_model(attrs)
149150

0 commit comments

Comments
 (0)