File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/bioimageio/spec/model Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 6666 FileSource ,
6767 WithSuffix ,
6868 YamlValue ,
69+ extract_file_name ,
6970 get_reader ,
7071 wo_special_file_name ,
7172)
@@ -2376,6 +2377,19 @@ class OnnxWeightsDescr(WeightsEntryDescrBase):
23762377 """Source of the external ONNX data file holding the weights.
23772378 (If present **source** holds the ONNX architecture without weights)."""
23782379
2380+ @model_validator (mode = "after" )
2381+ def _validate_external_data_unique_file_name (self ) -> Self :
2382+ if self .external_data is not None and (
2383+ extract_file_name (self .source )
2384+ == extract_file_name (self .external_data .source )
2385+ ):
2386+ raise ValueError (
2387+ f"ONNX `external_data` file name '{ extract_file_name (self .external_data .source )} '"
2388+ + " must be different from ONNX `source` file name."
2389+ )
2390+
2391+ return self
2392+
23792393
23802394class PytorchStateDictWeightsDescr (WeightsEntryDescrBase ):
23812395 type = "pytorch_state_dict"
You can’t perform that action at this time.
0 commit comments