Use the following steps to export a model artifact from an Object Storage bucket to a Data Science service bucket.
Note
You can only perform an export using the APIs from Java SDK, CLI, and ADS Python SDK. It's not possible to perform an export from the Console.
-
Add the required policies:
allow service datascience to manage object-family in compartment <compartment>
where ALL {target.bucket.name='<bucket_name>
'}
allow service objectstorage-<region>
to manage object-family in compartment <compartment>
where ALL {target.bucket.name='<bucket_name>
'}
-
Upload the model artifact into a Data Science service storage bucket.
-
Call the export endpoint. Include the necessary parameters, such as
artifactSourceType
, sourceBucket
,
sourceObjectName
, namespace
, and
sourceRegion
.
For example:
#sample code
import ads
from ads.model import DataScienceModel
ads.set_auth("resource_principal")
MODEL_DISPLAY_NAME = "my_large_model"
ARTIFACT_FILE_NAME = "my_large_model.zip"
OCI_BUCKET = "oci://bucket@namespace/prefix/my_large_model.zip"
model = (DataScienceModel()
.with_display_name(MODEL_DISPLAY_NAME)
.with_artifact(ARTIFACT_FILE_NAME)
.create(
bucket_uri=OCI_BUCKET,
overwrite_existing_artifact=True, # Overwrite target bucket artifact if exists.
remove_existing_artifact=True # Wether artifacts uploaded to object storage bucket need to be removed or not.
)
)
Important
When bucket_uri
is specified region
must be specified too to avoid errors when downloading files that are larger than 2 GB.
A work request is created for the export action. You can check the status of the work request to upload the model artifact to the Data Science service bucket, from the Work Requests tab.