The Copy Model API copies a model from one AML AI instance to another. This is typically done to copy a model from a consumer instance to a host instance after the model has been trained and evaluated. See also Party registration sharing for multiple instances.
Copy an AML AI model to a different AML AI instance
When a model is copied from one instance to another, the copied model is identical to the source model with the following exceptions:
- The source model field indicates the model was copied. The
satisfiesPziandsatisfiesPzsfields in the model copy will be different from the source model to indicate the new model's GPS path. ThecreateTimeandupdateTimefields in the model copy also vary from the source model. - The
engineVersionfield is updated to the local reference to the same engine version within the destination instance.
Prerequisites
- The user has the
financialservices.v1models.copyFromandfinancialservices.v1models.copyTopermissions on the source and destination instances respectively. This can be achieved for the instance by granting the roleroles/financialservices.adminto the user on both source and destination project. - The source model exists.
- The destination instance exists.
- No model exists in the destination instance with the same name that will be used for the destination model.
Copy request
Create a copy request to pass to the CopyModel request.
Before using any of the request data, make the following replacements:
- DESTINATION_MODEL_ID: a user-defined identifier for the model in the destination instance.
- SOURCE_PROJECT: the project that contains the instance where the model is copied from.
- SOURCE_LOCATION: the location of the source model.
- SOURCE_INSTANCE_ID: a user-defined identifier for the source instance that contains the source model.
- SOURCE_MODEL_ID: a user-defined identifier for the source model.
# Example request.json for copying a model:
cat > request.json << 'EOF'
{
# The resource ID of the destination model which will exist under `parent` after the copy is complete.
"model_id": "DESTINATION_MODEL_ID",
"source_model": "projects/SOURCE_PROJECT/locations/SOURCE_LOCATION/instances/SOURCE_INSTANCE_ID/models/SOURCE_MODEL_ID"
}
EOF
Call the Financial Services API CopyModel request:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://financialservices.googleapis.com/v1/projects/DESTINATION_PROJECT/locations/DESTINATION_LOCATION/instances/DESTINATION_INSTANCE_ID/models:copy"