<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Latest model in unity catalog model in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/latest-model-in-unity-catalog-model/m-p/119194#M4077</link>
    <description>&lt;DIV class="paragraph"&gt;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.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;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:&lt;/DIV&gt;
&lt;OL start="1"&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;&lt;STRONG&gt;Set an Alias for a Model Version&lt;/STRONG&gt;: &lt;CODE&gt;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)
&lt;/CODE&gt; This reassigns the alias "Champion" to the specified model version.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;&lt;STRONG&gt;Load a Model Version Using Alias&lt;/STRONG&gt;: &lt;CODE&gt;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)
&lt;/CODE&gt; 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.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;DIV class="paragraph"&gt;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.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;If you prefer not to use aliases, you can manually track versions through more specific mechanisms, such as filtering model versions via the &lt;CODE&gt;search_model_versions&lt;/CODE&gt; API, which allows finding model versions based on metadata like tags or attributes such as "latest_approved".&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Hope this helps, Lou.&lt;/DIV&gt;</description>
    <pubDate>Wed, 14 May 2025 14:51:09 GMT</pubDate>
    <dc:creator>Louis_Frolio</dc:creator>
    <dc:date>2025-05-14T14:51:09Z</dc:date>
    <item>
      <title>Latest model in unity catalog model</title>
      <link>https://community.databricks.com/t5/machine-learning/latest-model-in-unity-catalog-model/m-p/119190#M4076</link>
      <description>&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 14:17:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/latest-model-in-unity-catalog-model/m-p/119190#M4076</guid>
      <dc:creator>Snowhow</dc:creator>
      <dc:date>2025-05-14T14:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Latest model in unity catalog model</title>
      <link>https://community.databricks.com/t5/machine-learning/latest-model-in-unity-catalog-model/m-p/119194#M4077</link>
      <description>&lt;DIV class="paragraph"&gt;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.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;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:&lt;/DIV&gt;
&lt;OL start="1"&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;&lt;STRONG&gt;Set an Alias for a Model Version&lt;/STRONG&gt;: &lt;CODE&gt;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)
&lt;/CODE&gt; This reassigns the alias "Champion" to the specified model version.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;&lt;STRONG&gt;Load a Model Version Using Alias&lt;/STRONG&gt;: &lt;CODE&gt;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)
&lt;/CODE&gt; 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.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;DIV class="paragraph"&gt;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.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;If you prefer not to use aliases, you can manually track versions through more specific mechanisms, such as filtering model versions via the &lt;CODE&gt;search_model_versions&lt;/CODE&gt; API, which allows finding model versions based on metadata like tags or attributes such as "latest_approved".&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Hope this helps, Lou.&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 May 2025 14:51:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/latest-model-in-unity-catalog-model/m-p/119194#M4077</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2025-05-14T14:51:09Z</dc:date>
    </item>
  </channel>
</rss>

