<?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: Can view Model Registry using a Service Principal, but cannot load the model for inference. in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/can-view-model-registry-using-a-service-principal-but-cannot/m-p/72074#M3343</link>
    <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/63081"&gt;@Kumaran&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;The short version of this is below. Note that I have the following env vars loaded at runtime:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;DATABRICKS_HOST&lt;/LI&gt;&lt;LI&gt;DATABRICKS_CLIENT_ID&lt;/LI&gt;&lt;LI&gt;DATABRICKS_CLIENT_SECRET&lt;/LI&gt;&lt;LI&gt;MLFLOW_TRACKING_URI&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;import os&lt;BR /&gt;import &lt;/SPAN&gt;mlflow&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;if &lt;/SPAN&gt;__name__ &lt;SPAN&gt;== &lt;/SPAN&gt;&lt;SPAN&gt;"__main__"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;# attempt to use mlflow to search model registry and load model&lt;BR /&gt;&lt;/SPAN&gt;    mlflow_client &lt;SPAN&gt;= &lt;/SPAN&gt;mlflow&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;MlflowClient&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;registry_uri&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;os&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getenv&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MLFLOW_TRACKING_URI'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    )&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    model_name &lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;'test-model'&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;for &lt;/SPAN&gt;model &lt;SPAN&gt;in &lt;/SPAN&gt;mlflow_client&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;search_model_versions&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;filter_string&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;f"name='&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;model_name&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;'"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;BR /&gt;&lt;/SPAN&gt;        pymodel &lt;SPAN&gt;= &lt;/SPAN&gt;mlflow&lt;SPAN&gt;.&lt;/SPAN&gt;pyfunc&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;load_model&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;model_uri&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;f"models:/&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;model&lt;SPAN&gt;.&lt;/SPAN&gt;name&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;model&lt;SPAN&gt;.&lt;/SPAN&gt;version&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If DATABRICKS_CLIENT_ID and DATABRICKS_CLIENT_SECRET were replaced by a personal access token at&amp;nbsp; DATABRICKS_TOKEN, then this works as expected. But not when using the Service principal's client id and secret, which is what I hope to use, so that auth is M2M.&lt;/P&gt;&lt;P&gt;Can you help here?&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 07 Jun 2024 15:58:30 GMT</pubDate>
    <dc:creator>JC3</dc:creator>
    <dc:date>2024-06-07T15:58:30Z</dc:date>
    <item>
      <title>Can view Model Registry using a Service Principal, but cannot load the model for inference.</title>
      <link>https://community.databricks.com/t5/machine-learning/can-view-model-registry-using-a-service-principal-but-cannot/m-p/71625#M3332</link>
      <description>&lt;P data-unlink="true"&gt;I have a Service Principal (for M2M auth)&amp;nbsp;with read access to a Databricks Model Registry. I can successfully search the registry (via the `WorkspaceClient`) and find the model that I want to load using (Python) APIs, but I cannot load the model for inference.&lt;/P&gt;&lt;P&gt;Loading for inference seems to require MLFlow, but each time I try to use `mlflow.MlflowClient` to load a model, it errors out with `InvalidConfigurationError: You haven't configured the CLI yet!`.&lt;/P&gt;&lt;P&gt;I need to be able to use M2M auth, and configuring the CLI is not possible in my workflow.&lt;/P&gt;&lt;P&gt;How can I use the M2M auth approach to load models with MLFlow, or is there a different model-loading workflow that needs to be followed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 14:39:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/can-view-model-registry-using-a-service-principal-but-cannot/m-p/71625#M3332</guid>
      <dc:creator>JC3</dc:creator>
      <dc:date>2024-06-04T14:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can view Model Registry using a Service Principal, but cannot load the model for inference.</title>
      <link>https://community.databricks.com/t5/machine-learning/can-view-model-registry-using-a-service-principal-but-cannot/m-p/71938#M3338</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106189"&gt;@JC3&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for posting your question in the Databricks community.&lt;/P&gt;
&lt;P&gt;Is it possible to share with us the minimum reproducible code?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 18:27:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/can-view-model-registry-using-a-service-principal-but-cannot/m-p/71938#M3338</guid>
      <dc:creator>Kumaran</dc:creator>
      <dc:date>2024-06-06T18:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can view Model Registry using a Service Principal, but cannot load the model for inference.</title>
      <link>https://community.databricks.com/t5/machine-learning/can-view-model-registry-using-a-service-principal-but-cannot/m-p/72074#M3343</link>
      <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/63081"&gt;@Kumaran&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;The short version of this is below. Note that I have the following env vars loaded at runtime:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;DATABRICKS_HOST&lt;/LI&gt;&lt;LI&gt;DATABRICKS_CLIENT_ID&lt;/LI&gt;&lt;LI&gt;DATABRICKS_CLIENT_SECRET&lt;/LI&gt;&lt;LI&gt;MLFLOW_TRACKING_URI&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;import os&lt;BR /&gt;import &lt;/SPAN&gt;mlflow&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;if &lt;/SPAN&gt;__name__ &lt;SPAN&gt;== &lt;/SPAN&gt;&lt;SPAN&gt;"__main__"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;# attempt to use mlflow to search model registry and load model&lt;BR /&gt;&lt;/SPAN&gt;    mlflow_client &lt;SPAN&gt;= &lt;/SPAN&gt;mlflow&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;MlflowClient&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;BR /&gt;&lt;/SPAN&gt;        &lt;SPAN&gt;registry_uri&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;os&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getenv&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'MLFLOW_TRACKING_URI'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    )&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    model_name &lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;'test-model'&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;for &lt;/SPAN&gt;model &lt;SPAN&gt;in &lt;/SPAN&gt;mlflow_client&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;search_model_versions&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;filter_string&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;f"name='&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;model_name&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;'"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;BR /&gt;&lt;/SPAN&gt;        pymodel &lt;SPAN&gt;= &lt;/SPAN&gt;mlflow&lt;SPAN&gt;.&lt;/SPAN&gt;pyfunc&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;load_model&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;model_uri&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;f"models:/&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;model&lt;SPAN&gt;.&lt;/SPAN&gt;name&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;model&lt;SPAN&gt;.&lt;/SPAN&gt;version&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If DATABRICKS_CLIENT_ID and DATABRICKS_CLIENT_SECRET were replaced by a personal access token at&amp;nbsp; DATABRICKS_TOKEN, then this works as expected. But not when using the Service principal's client id and secret, which is what I hope to use, so that auth is M2M.&lt;/P&gt;&lt;P&gt;Can you help here?&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:58:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/can-view-model-registry-using-a-service-principal-but-cannot/m-p/72074#M3343</guid>
      <dc:creator>JC3</dc:creator>
      <dc:date>2024-06-07T15:58:30Z</dc:date>
    </item>
  </channel>
</rss>

