Managing BigQuery ML models in the Vertex AI Model Registry
Vertex AI is a Google Cloud service which enables you to build, deploy, and scale ML models. With Vertex AI, you can use pre-trained and custom tooling all within a unified platform. When you register your BigQuery ML models with the Vertex AI Model Registry you can manage them alongside your other ML models to easily version, evaluate, and deploy for prediction.
With this integration, you can choose which BigQuery ML models to register to the Vertex AI Model Registry. From BigQuery ML you can register:
- BigQuery ML built-in models
- BigQuery ML TensorFlow models
- TensorFlow for imported TensorFlow models
- BigQuery ML XGBoost based models
Once registered, you can deploy your BigQuery ML model to a Vertex AI endpoint for online prediction. To learn more about Vertex AI prediction, see Vertex AI Prediction documentation.
To learn how to manage your BigQuery ML models from Vertex AI Model Registry, see Introduction to Vertex AI Model Registry.
To add BigQuery ML models to the Vertex AI Model Registry, you'll need to enable Vertex AI API in your project. Use this gCloud command:
gcloud --project PROJECT_ID services enable aiplatform.googleapis.com
If you are using a service account, use this command to grant Vertex AI Model Registry permission to your service account:
gcloud projects add-iam-policy-binding PROJECT_ID --member=serviceAccount:YOUR_SERVICE_ACCOUNT --role=roles/aiplatform.admin --condition=None
or if you are not owner of your project, use this command to grant Vertex AI Model Registry permission to your account:
gcloud projects add-iam-policy-binding PROJECT_ID --member=user:YOUR_GCLOUD_ACCOUNT --role=roles/aiplatform.admin --condition=None
Add a new BigQuery ML model to the Vertex AI Model Registry
To register a BigQuery ML model to Vertex AI Model Registry, you must use model_registry="vertex_ai". Once registered, you can deploy from Vertex AI Model Registry directly without manual exporting or importing. For example, you can run the following command to integrate a BigQuery ML model with Vertex AI Model Registry:
CREATE OR REPLACE MODEL [PROJECT_ID].[DATASET_ID].[BQML_MODEL_ID] OPTIONS(model_registry="vertex_ai", [vertex_ai_model_id=<vertex_ai_model_id>, vertex_ai_model_version_aliases=[<version_aliases>])
Once you've added the BigQuery ML model to the Vertex AI Model Registry you can see it displayed alongside the other models. From the Source column, you can see where your models are sourced from. A quick way to find your BigQuery ML models is to filter by source.
Add an existing BigQuery ML model to the Vertex AI Model Registry
BigQuery ML models are not automatically added to the Vertex AI Model Registry. To add existing BigQuery ML models to the Vertex AI Model Registry use the following command:
BQ UPDATE --model -vertex_ai_model_id=<vertex modelid> bqmlmodel
Deleting BigQuery ML models from Vertex AI Model Registry
To delete a BigQuery ML model from the Vertex AI Model Registry you only need to delete it from BigQuery ML. Once you delete it from BigQuery ML, it is synced and removed from Vertex AI Model Registry.
DROP MODEL [PROJECT_ID].[DATASET_ID].[BQML_MODEL_ID]
What happens when I register a multi-region BigQuery ML model to Vertex AI Model Registry?
At this time, if you decide to add a multi-region BigQuery ML model to Vertex AI Model Registry it turns the model into a regional model. A BigQuery ML multi-region US model is synced to Vertex AI (us-central1) and a BigQuery ML multi-region EU model is synced to Vertex AI (europe-west4). Vertex AI Model Registry will support multi-region models in the future. For information about supported locations, see the Locations page.
Can I use XAI capabilities in Vertex AI Model Registry with BigQuery ML models?
No, at this time Vertex AI Model Registry does not support XAI with BigQuery ML models.
To practice integrating your BigQuery ML models with Vertex AI, use this notebook - Deploy a BigQuery ML Model on Vertex AI and Make Predictions.
This notebook describes how to train a model with BigQuery ML and upload it on Vertex AI, then make batch predictions. This tutorial uses the following Google Cloud ML services and resources:
- Vertex AI Model Registry
- Vertex AI Model resources
- Vertex AI Endpoint resources
- Vertex AI Prediction
- BigQuery ML