@@ -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
@@ -200,6 +201,8 @@ def _get_entry_model_path(self, use_container: bool, should_generate: bool, dry_
200201
201202 if self .model_type == 'oci' :
202203 if use_container or should_generate :
204+ if getattr (self , "artifact" , False ):
205+ return os .path .join (MNT_DIR , self .artifact_name ())
203206 return os .path .join (MNT_DIR , 'model.file' )
204207 else :
205208 return f"oci://{ self .model } "
@@ -345,9 +348,10 @@ def exec_model_in_container(self, cmd_args, args):
345348 def setup_mounts (self , args ):
346349 if args .dryrun :
347350 return
351+
348352 if self .model_type == 'oci' :
349353 if self .engine .use_podman :
350- mount_cmd = f"--mount=type=image,src= { self .model } ,destination= { MNT_DIR } ,subpath=/models,rw=false"
354+ mount_cmd = self .mount_cmd ()
351355 elif self .engine .use_docker :
352356 output_filename = self ._get_entry_model_path (args .container , True , args .dryrun )
353357 volume = populate_volume_from_image (self , os .path .basename (output_filename ))
@@ -651,40 +655,48 @@ def inspect(
651655 as_json : bool = False ,
652656 dryrun : bool = False ,
653657 ) -> None :
658+ print (self .get_inspect (show_all , show_all_metadata , get_field , dryrun , as_json ))
659+
660+ def get_inspect (
661+ self ,
662+ show_all : bool = False ,
663+ show_all_metadata : bool = False ,
664+ get_field : str = "" ,
665+ dryrun : bool = False ,
666+ as_json : bool = False ,
667+ ) -> Any :
654668 model_name = self .filename
655669 model_registry = self .type .lower ()
656670 model_path = self ._get_inspect_model_path (dryrun )
657-
658671 if GGUFInfoParser .is_model_gguf (model_path ):
659672 if not show_all_metadata and get_field == "" :
660673 gguf_info : GGUFModelInfo = GGUFInfoParser .parse (model_name , model_registry , model_path )
661- print (gguf_info .serialize (json = as_json , all = show_all ))
662- return
674+ return gguf_info .serialize (json = as_json , all = show_all )
663675
664676 metadata = GGUFInfoParser .parse_metadata (model_path )
665677 if show_all_metadata :
666- print (metadata .serialize (json = as_json ))
667- return
678+ return metadata .serialize (json = as_json )
668679 elif get_field != "" : # If a specific field is requested, print only that field
669680 field_value = metadata .get (get_field )
670681 if field_value is None :
671682 raise KeyError (f"Field '{ get_field } ' not found in GGUF model metadata" )
672- print (field_value )
673- return
683+ return field_value
674684
675685 if SafetensorInfoParser .is_model_safetensor (model_name ):
676686 safetensor_info : SafetensorModelInfo = SafetensorInfoParser .parse (model_name , model_registry , model_path )
677- print (safetensor_info .serialize (json = as_json , all = show_all ))
678- return
687+ return safetensor_info .serialize (json = as_json , all = show_all )
679688
680- print ( ModelInfoBase (model_name , model_registry , model_path ).serialize (json = as_json ) )
689+ return ModelInfoBase (model_name , model_registry , model_path ).serialize (json = as_json )
681690
682- def print_pull_message (self , model_name ):
691+ def print_pull_message (self , model_name ) -> None :
683692 model_name = trim_model_name (model_name )
684693 # Write messages to stderr
685694 perror (f"Downloading { model_name } ..." )
686695 perror (f"Trying to pull { model_name } ..." )
687696
697+ def is_artifact (self ) -> bool :
698+ return False
699+
688700
689701def compute_ports (exclude : list [str ] | None = None ) -> list [int ]:
690702 exclude = exclude and set (map (int , exclude )) or set ()
0 commit comments