Copy models from one region to another in Vertex AI Model Registry

Training your AutoML and custom models in Vertex AI to the level you want requires time and some experimentation. If you have a well-performing model you'd like to use in another location, training a new model is not the best option. Model training is non-deterministic in nature therefore it's unlikely you'd end up with an identical model from identical data. Additionally, training a model in each region is not a foolproof way to maintain cross-region model behavior consistency. This is where the copy model feature comes in. With the Vertex AI Model Registry copy model functionality, you can easily copy a model from the Vertex AI Model Registry into a separate region in the same project.

When performing a model copy, if you don't specify the model version you want to copy over, the default model version is copied. To learn more about model default or the model alias, see How to use model aliases.

Limitations

When you copy a model, not all model information is copied over. The copied model won't retain the following:

  • Version aliases.
  • The custom model ID- you can specify a new ID once the model is copied.
  • Any existing model evaluation.
  • Encryption specs - you are required to specify a new one upon copy for your target region.
  • Deployments and batch predictions.

Copy AutoML and custom models between locations from the console

Console

You can copy models as a new model within the target region, or as a new version of an existing model in that region.

Use the following instructions to copy models between locations.

  1. In the Google Cloud console, go to the Models page. Go to Models
  2. From the Model Registry, select the More actions menu .
  3. Click Copy to another region
  4. From the Copy Model panel, select the version of the model you want to copy and select the region you want to copy to. If you copy over a model for the first time, it's assigned the default alias in the new region

Copy AutoML and custom models between locations programmatically

HTTP

Use the following code sample to copy a model using the copy method of the model resource. Before using any of the request data, make the following replacements:

  • LOCATION: The region where you are using Vertex AI.
  • SOURCE_LOCATION: The Vertex AI region from which you will copy the model.
  • PROJECT_ID: Your project ID or project number.
  • MODEL_ID: ID of the model to copy.
  • VERSION_ID: (Optional) ID of the model version to copy (if not provided the default version is copied)

HTTP method and URL:

POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/models:copy

Request JSON body:

"sourceModel": projects/PROJECT_ID/locations/SOURCE_LOCATION/models/MODEL_ID[@VERSION_ID]

curl:


curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/models:copy"

Response

{
  "name": "projects/PROJECT_ID/locations/LOCATION/models/MODEL_COPY_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.CopyModelOperationMetadata",
    "genericMetadata": {
      "createTime": "2022-07-01T00:10:55.621355Z",
      "updateTime": "2022-07-01T00:10:55.621355Z"
    }
  }
}