@@ -167,7 +167,7 @@ def _get_data_range(data_range, dtype):
167167 else :
168168 raise RuntimeError (f"Cannot derived data range for dtype { dtype } " )
169169 data_range = (min_ , max_ )
170- assert isinstance (data_range , (tuple , list ))
170+ assert isinstance (data_range , (tuple , list )), type ( data_range )
171171 assert len (data_range ) == 2
172172 return data_range
173173
@@ -249,6 +249,15 @@ def _build_cite(cite: Dict[str, str]):
249249 return citation_list
250250
251251
252+ def _get_dependencies (dependencies , root ):
253+ if ":" in dependencies :
254+ manager , path = dependencies .split (":" )
255+ else :
256+ manager = "conda"
257+ path = dependencies
258+ return model_spec .raw_nodes .Dependencies (manager = manager , file = _process_uri (path , root ))
259+
260+
252261def build_model (
253262 weight_uri : str ,
254263 test_inputs : List [Union [str , Path ]],
@@ -383,7 +392,7 @@ def build_model(
383392 preprocessing = n_inputs * [None ] if preprocessing is None else preprocessing
384393
385394 inputs = [
386- _get_input_tensor (test_in , name , step , min_shape , axes , data_range , preproc )
395+ _get_input_tensor (test_in , name , step , min_shape , data_range , axes , preproc )
387396 for test_in , name , step , min_shape , axes , data_range , preproc in zip (
388397 test_inputs , input_name , input_step , input_min_shape , input_axes , input_data_range , preprocessing
389398 )
@@ -422,8 +431,8 @@ def build_model(
422431
423432 authors = _build_authors (authors )
424433 cite = _build_cite (cite )
425- documentation = _process_uri (documentation , root )
426- covers = [_process_uri (uri , root ) for uri in covers ]
434+ documentation = _process_uri (documentation , root , download = True )
435+ covers = [_process_uri (uri , root , download = True ) for uri in covers ]
427436
428437 # parse the weights
429438 weights , language , framework , source , source_hash , tmp_source = _get_weights (
@@ -448,9 +457,7 @@ def build_model(
448457 }
449458 kwargs = {k : v for k , v in optional_kwargs .items () if v is not None }
450459 if dependencies is not None :
451- kwargs ["dependencies" ] = model_spec .raw_nodes .Dependencies (
452- manager = "conda" , file = _process_uri (dependencies , root )
453- )
460+ kwargs ["dependencies" ] = _get_dependencies (dependencies , root )
454461 if parent is not None :
455462 assert len (parent ) == 2
456463 kwargs ["parent" ] = {"uri" : parent [0 ], "sha256" : parent [1 ]}
0 commit comments