@@ -145,6 +145,7 @@ def __init__(self, model: str, model_store_path: str):
145145 self ._model_type : str
146146 self ._model_name , self ._model_tag , self ._model_organization = self .extract_model_identifiers ()
147147 self ._model_type = type (self ).__name__ .lower ()
148+ self .artifact = False
148149
149150 self ._model_store_path : str = model_store_path
150151 self ._model_store : Optional [ModelStore ] = None
@@ -201,6 +202,8 @@ def _get_entry_model_path(self, use_container: bool, should_generate: bool, dry_
201202
202203 if self .model_type == 'oci' :
203204 if use_container or should_generate :
205+ if getattr (self , "artifact" , False ):
206+ return os .path .join (MNT_DIR , self .artifact_name ())
204207 return os .path .join (MNT_DIR , 'model.file' )
205208 else :
206209 return f"oci://{ self .model } "
@@ -346,9 +349,10 @@ def exec_model_in_container(self, cmd_args, args):
346349 def setup_mounts (self , args ):
347350 if args .dryrun :
348351 return
352+
349353 if self .model_type == 'oci' :
350354 if self .engine .use_podman :
351- mount_cmd = f"--mount=type=image,src= { self .model } ,destination= { MNT_DIR } ,subpath=/models,rw=false"
355+ mount_cmd = self .mount_cmd ()
352356 elif self .engine .use_docker :
353357 output_filename = self ._get_entry_model_path (args .container , True , args .dryrun )
354358 volume = populate_volume_from_image (self , args , os .path .basename (output_filename ))
@@ -652,40 +656,48 @@ def inspect(
652656 as_json : bool = False ,
653657 dryrun : bool = False ,
654658 ) -> None :
659+ print (self .get_inspect (show_all , show_all_metadata , get_field , dryrun , as_json ))
660+
661+ def get_inspect (
662+ self ,
663+ show_all : bool = False ,
664+ show_all_metadata : bool = False ,
665+ get_field : str = "" ,
666+ dryrun : bool = False ,
667+ as_json : bool = False ,
668+ ) -> Any :
655669 model_name = self .filename
656670 model_registry = self .type .lower ()
657671 model_path = self ._get_inspect_model_path (dryrun )
658-
659672 if GGUFInfoParser .is_model_gguf (model_path ):
660673 if not show_all_metadata and get_field == "" :
661674 gguf_info : GGUFModelInfo = GGUFInfoParser .parse (model_name , model_registry , model_path )
662- print (gguf_info .serialize (json = as_json , all = show_all ))
663- return
675+ return gguf_info .serialize (json = as_json , all = show_all )
664676
665677 metadata = GGUFInfoParser .parse_metadata (model_path )
666678 if show_all_metadata :
667- print (metadata .serialize (json = as_json ))
668- return
679+ return metadata .serialize (json = as_json )
669680 elif get_field != "" : # If a specific field is requested, print only that field
670681 field_value = metadata .get (get_field )
671682 if field_value is None :
672683 raise KeyError (f"Field '{ get_field } ' not found in GGUF model metadata" )
673- print (field_value )
674- return
684+ return field_value
675685
676686 if SafetensorInfoParser .is_model_safetensor (model_name ):
677687 safetensor_info : SafetensorModelInfo = SafetensorInfoParser .parse (model_name , model_registry , model_path )
678- print (safetensor_info .serialize (json = as_json , all = show_all ))
679- return
688+ return safetensor_info .serialize (json = as_json , all = show_all )
680689
681- print ( ModelInfoBase (model_name , model_registry , model_path ).serialize (json = as_json ) )
690+ return ModelInfoBase (model_name , model_registry , model_path ).serialize (json = as_json )
682691
683- def print_pull_message (self , model_name ):
692+ def print_pull_message (self , model_name ) -> None :
684693 model_name = trim_model_name (model_name )
685694 # Write messages to stderr
686695 perror (f"Downloading { model_name } ..." )
687696 perror (f"Trying to pull { model_name } ..." )
688697
698+ def is_artifact (self ) -> bool :
699+ return False
700+
689701
690702def compute_ports (exclude : list [str ] | None = None ) -> list [int ]:
691703 excluded = exclude and set (map (int , exclude )) or set ()
0 commit comments