Copy a model in Vertex AI Model Registry

Training your AutoML, large models, and custom models in Vertex AI to the level you want requires time and experimentation. If you have a well-performing model that you'd like to use in another project or location, training a new model isn't 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 or project isn't a foolproof way to maintain cross-region model behavior consistency. With Vertex AI Model Registry copy model, you can copy a model from the Vertex AI Model Registry into a separate location in the same project or to a different 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're required to specify the encryption key when copying the model for your target region.
  • Deployments and batch predictions.
  • Gemini 1.5 models cannot be copied across projects.
  • For cross-project copy, you can copy custom models which have a third party container image.

Copy models between projects

Prerequisites

To copy a model across projects, the source model owner needs to first grant the model export permission to the destination project:

  1. Select your project from the Google Cloud console.
  2. Navigate to the IAM & Admin page.
  3. On the IAM permissions page, click Grant access and a pop up window appears to let you add a new principal to the source project.
  4. Get the per-product, per-project service account (P4SA) service-{project_number}@gcp-sa-aiplatform.iam.gserviceaccount.com of the destination project.
  5. Add the P4SA of the destination project as a new principal to the source project and assign the Vertex AI Service Agent role to it.
  6. After clicking Save, the destination project P4SA will have permissions to export models from the source project.

REST

Before using any of the request data, make the following replacements:

  • DESTINATION_LOCATION: The region where you want to copy the model to. For example, us-central1
  • DESTINATION_PROJECT_ID: The project ID or project number where you want to copy the model to.
  • SOURCE_PROJECT_ID: Your project ID or project number.
  • SOURCE_LOCATION: The Vertex AI region from which you are copying a model.
  • SOURCE_MODEL_ID: The source of the model ID 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://DESTINATION_LOCATION-aiplatform.googleapis.com/v1/projects/DESTINATION_PROJECT_ID/locations/DESTINATION_LOCATION/models:copy

Request JSON body:

   {
    "sourceModel": projects/SOURCE_PROJECT_ID/locations/SOURCE_LOCATION/models/SOURCE_MODEL_ID
    }

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

  {
    "name": "projects/PROJECT_ID/locations/LOCATION/models/MODEL_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"
      }
    }
  }

Console


Use the following instructions to copy a models to a different project.

  1. In the Google Cloud console, go to the Vertex AI Model Registry page. Go to Vertex AI Model Registry
  2. From the Model Registry, select the More actions menu for the model you want to copy.
  3. Click Copy model.
  4. Choose either To another project or To another region.

Copy model to a different project

  1. Choose To another project.
  2. Choose the model version you want to copy.
  3. Choose the destination project you want to copy to.
  4. Choose the destination region, for example, us-central1.
  5. Advanced options: Optional to choose the encryption method, using a Google-managed encryption key or a Cloud KMS key.

Copy models between locations

REST

Before using any of the request data, make the following replacements:

  • DESTINATION_LOCATION: The region where you are using Vertex AI. For example, us-central1
  • 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://DESTINATION_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]
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

  {
    "name": "projects/PROJECT_ID/locations/LOCATION/models/MODEL_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"
      }
    }
  }

Console


With a cross-region copy, you can copy a model over 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.

  1. In the Google Cloud console, go to the Vertex AI Model Registry page. Go to Model Registry
  2. From the Model Registry, select the More actions menu for the model you want to copy.
  3. Click Copy model
  4. Choose either To another project or To another region.

Copy model to a different region

  1. Choose To another region.
  2. Choose the model version you want to copy.
  3. Select either Copy as new model or Copy as new version.
  4. Choose the destination region.
  5. Add the destination model name or model ID. If you copy over a model for the first time, it's assigned the default alias in the new region.