3030ADS_VERSION = __version__
3131
3232
33- class ArtifactNestedFolderError (Exception ): # pragma: no cover
33+ class ArtifactNestedFolderError (Exception ): # pragma: no cover
3434 def __init__ (self , folder : str ):
3535 self .folder = folder
3636 super ().__init__ ("The required artifact files placed in a nested folder." )
3737
3838
39- class ArtifactRequiredFilesError (Exception ): # pragma: no cover
39+ class ArtifactRequiredFilesError (Exception ): # pragma: no cover
4040 def __init__ (self , required_files : Tuple [str ]):
4141 super ().__init__ (
4242 "Not all required files presented in artifact folder. "
4343 f"Required files for conda runtime: { required_files } . If you are using container runtime, set `ignore_conda_error=True`."
4444 )
4545
4646
47- class AritfactFolderStructureError (Exception ): # pragma: no cover
47+ class AritfactFolderStructureError (Exception ): # pragma: no cover
4848 def __init__ (self , required_files : Tuple [str ]):
4949 super ().__init__ (
5050 "The artifact folder has a wrong structure. "
@@ -171,6 +171,7 @@ def __init__(
171171 self .ignore_conda_error = ignore_conda_error
172172 self .model = None
173173 self .auth = auth or authutil .default_signer ()
174+
174175 if reload and not ignore_conda_error :
175176 self .reload ()
176177 # Extracts the model_file_name from the score.py.
@@ -416,6 +417,7 @@ def from_uri(
416417 force_overwrite : Optional [bool ] = False ,
417418 auth : Optional [Dict ] = None ,
418419 ignore_conda_error : Optional [bool ] = False ,
420+ reload : Optional [bool ] = False ,
419421 ):
420422 """Constructs a ModelArtifact object from the existing model artifacts.
421423
@@ -426,16 +428,20 @@ def from_uri(
426428 OCI object storage URI.
427429 artifact_dir: str
428430 The local artifact folder to store the files needed for deployment.
429- model_file_name: (str, optional). Defaults to `None`
430- The file name of the serialized model.
431- force_overwrite: (bool, optional). Defaults to False.
432- Whether to overwrite existing files or not.
433431 auth: (Dict, optional). Defaults to None.
434432 The default authetication is set using `ads.set_auth` API.
435433 If you need to override the default, use the `ads.common.auth.api_keys`
436434 or `ads.common.auth.resource_principal` to create appropriate
437435 authentication signer and kwargs required to instantiate
438436 IdentityClient object.
437+ force_overwrite: (bool, optional). Defaults to False.
438+ Whether to overwrite existing files or not.
439+ ignore_conda_error: (bool, optional). Defaults to False.
440+ Parameter to ignore error when collecting conda information.
441+ model_file_name: (str, optional). Defaults to `None`
442+ The file name of the serialized model.
443+ reload: (bool, optional). Defaults to False.
444+ Whether to reload the Model into the environment.
439445
440446 Returns
441447 -------
@@ -492,6 +498,8 @@ def from_uri(
492498 utils .copy_from_uri (
493499 uri = temp_dir , to_path = to_path , force_overwrite = True
494500 )
501+ except ArtifactRequiredFilesError as ex :
502+ logger .warning (ex )
495503
496504 if ObjectStorageDetails .is_oci_path (artifact_dir ):
497505 for root , dirs , files in os .walk (to_path ):
@@ -507,10 +515,10 @@ def from_uri(
507515
508516 return cls (
509517 artifact_dir = artifact_dir ,
510- model_file_name = model_file_name ,
511- reload = True ,
512518 ignore_conda_error = ignore_conda_error ,
513519 local_copy_dir = to_path ,
520+ model_file_name = model_file_name ,
521+ reload = reload ,
514522 )
515523
516524 def __getattr__ (self , item ):
0 commit comments