Update a BigQuery ML model
Register an existing BigQuery ML model to the Model Registry
By default, BigQuery ML models, when trained without the model_registry
parameter, are not automatically added to the Vertex AI Model Registry.
Using ALTER MODEL, you can update the model to include in the Model Registry
and update important metadata like the model ID, the description, and labels. To
learn more, see The ALTER MODEL
statement.
To learn more about generally updating your BigQuery ML models, see Update model metadata.
To register an existing model:
bq
You can update a model using the bq command-line tool by running the 'bq update' and adding a 'vertex_ai_model_id' to the model. Keep in mind, the vertex_model_id can either be a new ID or an existing Model Registry model ID. Each BigQuery ML model can only be registered to one model_id in the Model Registry.
bq update --model --vertex_ai_model_id "[VERTEX_AI_MODEL_ID]" [PROJECT_ID]:[DATASET].[MODEL]
SQL
ALTER MODEL [IF EXISTS]SET OPTIONS (vertex_ai_model_id="[VERTEX_AI_MODEL_ID]");
API
- Go to Method: models.patch
- Fill out the Request parameters and Request body.
- Click the EXECUTE button.
{
"trainingRuns": [
{
"vertexAiModelId": "vertex_model_id"
}
}
```
If you set it to a new ID when adding the model, the BigQuery ML model displays as model version 1 in the Model Registry. To add as a new version of an existing model in the Model Registry, add the existing model's ID - it automatically registers as the latest version.
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.
Change the model ID of an existing BigQuery ML model
Once a BigQuery ML model is registered to the Model Registry, you can't change the vertex_ai_model_id
value.
To register the model with a new vertex_ai_model_id
, use one of the following options:
Drop the model and recreate it, if the re-training cost is acceptable.
Copy the model and use the
ALTER MODEL
statement to register the model with a newvertex_ai_model_id
value.
What's next
- Add BigQuery ML to the Model Registry
- View BigQuery ML evaluations from Model Registry
- Remove a BigQuery ML model from Model Registry