cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Latest model in unity catalog model

Snowhow
New Contributor

I'm trying to train multiple models in one unity catalog. However, there is no way to automatically choose the latest version of these models when running the project? Do I always need to choose based on the alias or version number that I already know?

Thanks!

Sam

1 REPLY 1

BigRoux
Databricks Employee
Databricks Employee
When using Databricks Unity Catalog for managing multiple models and their versions, there is no built-in automatic mechanism that dynamically selects the "latest" version of a model when running a project.
 
To automatically choose the latest version of multiple models when working with Unity Catalog, Databricks recommends using aliases, such as the "Champion" alias, which can reference a specific model version. Once an alias is set, inference workloads can use it to dynamically point to the latest model version without manually specifying the version number each time. Hereโ€™s an example:
  1. Set an Alias for a Model Version: python from mlflow import MlflowClient client = MlflowClient() # Set alias for a model version client.set_registered_model_alias(name="prod.ml_team.iris_model", alias="Champion", version=2) This reassigns the alias "Champion" to the specified model version.
  2. Load a Model Version Using Alias: python import mlflow.pyfunc model_uri = "models:/prod.ml_team.iris_model@Champion" model = mlflow.pyfunc.load_model(model_uri) predictions = model.predict(test_data) As long as the alias "Champion" is updated whenever a new model version is promoted, workloads referencing the alias will automatically use the latest version.
The use of model aliases eliminates the need to reference specific version numbers explicitly, streamlining workflows and ensuring that inference processes always utilize the desired version automatically. Note, however, that Unity Catalog's usage of aliases supports up to 10 aliases per registered model.
 
If you prefer not to use aliases, you can manually track versions through more specific mechanisms, such as filtering model versions via the search_model_versions API, which allows finding model versions based on metadata like tags or attributes such as "latest_approved".
 
Hope this helps, Lou.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now