Skip to content

Commit 4117087

Browse files
committed
ignore model parent specified as url
1 parent 47d23c9 commit 4117087

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

bioimageio/spec/model/v0_4.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,15 @@ def validate_tensor_references_in_outputs(self) -> Self:
870870
parent: Optional[LinkedModel] = None
871871
"""The model from which this model is derived, e.g. by fine-tuning the weights."""
872872

873+
@field_validator("parent", mode="before")
874+
@classmethod
875+
def ignore_url_parent(cls, parent: Any):
876+
if isinstance(parent, dict):
877+
return None
878+
879+
else:
880+
return parent
881+
873882
run_mode: Optional[RunMode] = None
874883
"""Custom run mode for this model: for more complex prediction procedures like test time
875884
data augmentation that currently cannot be expressed in the specification.

bioimageio/spec/model/v0_5_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def _convert_model_from_v0_4_to_0_5_0(data: RdfContent, context: InternalValidat
3232
_convert_weights(data)
3333
_ = data.pop("download_url", None)
3434

35-
if (p := data.get("parent")) and isinstance(p, dict) and "uri" in p:
36-
p["rdf_source"] = p.pop("uri")
35+
if isinstance(data.get("parent"), dict):
36+
_ = data.pop("parent")
3737

3838
data["format_version"] = "0.5.0"
3939

0 commit comments

Comments
 (0)