Importing a Large Model Artifact
Use the following steps to import a model artifact from the Data Science service bucket to your storage bucket.
Note
You can only perform an import using the APIs from Java SDK, CLI, and ADS Python SDK. It's not possible to perform an import from the Console.
You can only perform an import using the APIs from Java SDK, CLI, and ADS Python SDK. It's not possible to perform an import from the Console.
Call the import endpoint and provide the details of your storage bucket.
For example:
#sample code
import ads
from ads.model import DataScienceModel
ads.set_auth("resource_principal")
dsc_model = DataScienceModel.from_id("oci://...") # The model OCID.
dsc_model.download_artifact(
target_dir = dsc_model.id,
force_overwrite=True, # Overwrite target directory if exists.
bucket_uri = "oci://bucket@namespace/prefix/", # The OCI Object Storage URI where model artifacts will be copied to.
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. )
A work request is created for the import action. You can check the status of the work request to upload the model artifact to your storage bucket, from the Work Requests tab.
Sample Import Artifact Request
A sample artifact request to import a model artifact from the service bucket to a storage bucket:
curl --location --request POST 'http://localhost:24000/20190101/models/ocid1.datasciencemodel.oc1.iad.aaaaaaaaqwtoxslqnji4um4on7ktdpbmjp2fugqaxt2wvxrigjr2dpmxegma/actions/importArtifact' \
--header 'Content-Type: application/json' \
--data-raw '{
"artifactImportDetails" :
{
"artifactSourceType": "ORACLE_OBJECT_STORAGE",
"destinationBucket": "ds-scratch",
"destinationObjectName": "ADS.py",
"namespace": "ociodscdev",
"destinationRegion": "us-ashburn-1"
}
}'