Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Gcloud CLI and version aliases

I'm occasionally constrained to only using the CLI methods for some CI/CD work that is not able to easily use python scripts. 

It seems like there isn't a way to change the default version of a model without deleting the current default version (which would cause it to default to the latest version, but make reverting harder) using only gcloud commands.

Similarly, the page for model version alias usage specifies that if an alias tag is already on another model, it will be deleted when you place it on a new model, but i get an invalid alias error when trying to provide default as a version's alias upon initial upload. 

I had some potential workarounds using traffic split, but these are private endpoints I'm working with. 

Am I missing something or is there just a pretty big gap in functionality between gcloud commands and the other forms of interacting with gcp? 

Solved Solved
2 2 751
1 ACCEPTED SOLUTION

For anybody here in the future, the answer seems to be that the functionality is missing, but you can use a curl command to hit the aiplatform api and modify the aliases that way. 

https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.models/mergeVersionAlia...

It doesn't actually fix my usecase for private endpoints though.  When you update the tags to have your most recent as the default, the pointer to which model is deployed doesn't change. It just checks for what is the default at the time you deploy it. That'd be fine if private endpoint urls didn't include a model ID, but right now it seems as though Google hasn't provided a way to keep prediction urls constant between model versions on the same endpoint. 

View solution in original post

2 REPLIES 2

For anybody here in the future, the answer seems to be that the functionality is missing, but you can use a curl command to hit the aiplatform api and modify the aliases that way. 

https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.models/mergeVersionAlia...

It doesn't actually fix my usecase for private endpoints though.  When you update the tags to have your most recent as the default, the pointer to which model is deployed doesn't change. It just checks for what is the default at the time you deploy it. That'd be fine if private endpoint urls didn't include a model ID, but right now it seems as though Google hasn't provided a way to keep prediction urls constant between model versions on the same endpoint. 

The CLI method to set the "default" alias works for me with `gcloud ai models upload ... --version-aliases default`.