<?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 Register Model mounted in S3 in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/register-model-mounted-in-s3/m-p/73638#M3357</link>
    <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I'm having an issue registering a model saved in a mounted S3 bucket using mlflow.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me give a little bit more context:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1. First I mounted my S3 with all the corresponding IAM permissions:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;s3_bucket_name = f"s3a://{s3_bucket}"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dbutils.fs.mount(source=s3_&lt;/SPAN&gt;&lt;SPAN&gt;bucket_name, mount_point=f"/mnt/{s3_bucket}&lt;/SPAN&gt;&lt;SPAN&gt;")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;2. Then I created an experiment pointing to that artifact path&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;artifact_location=f"dbfs:/mnt/&lt;/SPAN&gt;&lt;SPAN&gt;{s3_bucket}/experiments/{&lt;/SPAN&gt;&lt;SPAN&gt;model_name}"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mlflow.create_experiment(&lt;/SPAN&gt;&lt;SPAN&gt;experiment_name,artifact_&lt;/SPAN&gt;&lt;SPAN&gt;location=artifact_location)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;3. I started my run and logged my model without registering them. I am logging my model using mlflow and FeatureStoreClient(). (I find the exact same problem with any of the methods of logging the model).&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;mlflow.start_run(run_name=run_&lt;/SPAN&gt;&lt;SPAN&gt;name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mlflow.pyfunc.log_model("&lt;/SPAN&gt;&lt;SPAN&gt;model_mlflow", python_model=model)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fs = FeatureStoreClient()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fs.log_model(model=model,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;artifact_path="model_feature_&lt;/SPAN&gt;&lt;SPAN&gt;store",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;flavor=flavor,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;training_set=training_set)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mlflow.end_run()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;To this point, everything is working fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can find the models in DBFS in: &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;dbfs:/mnt/my-s3-bucket/my-&lt;/SPAN&gt;&lt;SPAN&gt;experiment/run_id/artifacts/&lt;/SPAN&gt;&lt;SPAN&gt;model_feature_store.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;dbfs:/mnt/my-s3-bucket/my-&lt;/SPAN&gt;&lt;SPAN&gt;experiment/run_id/artifacts/&lt;/SPAN&gt;&lt;SPAN&gt;model_mlflow &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;I can find the models in my S3 bucket too. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can access my mlflow model with load_model without any problem from my notebook &lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;model_mlflow = mlflow.pyfunc.load_model(&lt;/SPAN&gt;&lt;SPAN&gt;model_uri=f"runs:/{active_run_&lt;/SPAN&gt;&lt;SPAN&gt;id}/model_mlflow")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;model_mlflow &lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;I can do fs.score_batch() with the Feature Store Client model as well without problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fs.score_batch(model_uri=f"&lt;/SPAN&gt;&lt;SPAN&gt;runs:/{active_run_id}/model_&lt;/SPAN&gt;&lt;SPAN&gt;feature_store", df = df)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;The problem comes at the final step when trying to register my model:&lt;BR /&gt;If I try to either:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Input the parameter of&amp;nbsp;registered_model_name&amp;nbsp;in any of the log_model()&amp;nbsp;functions, &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Or, Try to register any model with:&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;PRE&gt;&lt;SPAN&gt;mlflow.register_model(model_&lt;/SPAN&gt;&lt;SPAN&gt;uri=f"runs:/{active_run_id}/&lt;/SPAN&gt;&lt;SPAN&gt;model_mlflow",name=model_name) &lt;/SPAN&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;Or, Try to register my model from the UI with the Register Model button&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I get the exact same error:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;MlflowException: Model version creation failed for model name: model version: 4 with status: FAILED_REGISTRATION and message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed registration. The given source path `dbfs:/mnt/&amp;lt;my-s3-bucket&amp;gt;/&amp;lt;my-&lt;/SPAN&gt;&lt;SPAN&gt;experiment-name&amp;gt;/&amp;lt;run_id&amp;gt;/&lt;/SPAN&gt;&lt;SPAN&gt;artifacts/model_mlflow` does not exist.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;If I follow the exact same steps but save the experiment in a DBFS path outside the mounted S3 bucket I have no problem at all with the registration step. It only happens when I save the experiment in the S3-mounted bucket inside the S3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Why can't I register a model in Databricks when it is saved in dbfs:/mnt/S3-bucket?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 23:09:35 GMT</pubDate>
    <dc:creator>SOlivero</dc:creator>
    <dc:date>2024-06-12T23:09:35Z</dc:date>
    <item>
      <title>Register Model mounted in S3</title>
      <link>https://community.databricks.com/t5/machine-learning/register-model-mounted-in-s3/m-p/73638#M3357</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I'm having an issue registering a model saved in a mounted S3 bucket using mlflow.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me give a little bit more context:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1. First I mounted my S3 with all the corresponding IAM permissions:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;s3_bucket_name = f"s3a://{s3_bucket}"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dbutils.fs.mount(source=s3_&lt;/SPAN&gt;&lt;SPAN&gt;bucket_name, mount_point=f"/mnt/{s3_bucket}&lt;/SPAN&gt;&lt;SPAN&gt;")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;2. Then I created an experiment pointing to that artifact path&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;artifact_location=f"dbfs:/mnt/&lt;/SPAN&gt;&lt;SPAN&gt;{s3_bucket}/experiments/{&lt;/SPAN&gt;&lt;SPAN&gt;model_name}"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mlflow.create_experiment(&lt;/SPAN&gt;&lt;SPAN&gt;experiment_name,artifact_&lt;/SPAN&gt;&lt;SPAN&gt;location=artifact_location)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;3. I started my run and logged my model without registering them. I am logging my model using mlflow and FeatureStoreClient(). (I find the exact same problem with any of the methods of logging the model).&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;mlflow.start_run(run_name=run_&lt;/SPAN&gt;&lt;SPAN&gt;name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mlflow.pyfunc.log_model("&lt;/SPAN&gt;&lt;SPAN&gt;model_mlflow", python_model=model)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fs = FeatureStoreClient()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fs.log_model(model=model,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;artifact_path="model_feature_&lt;/SPAN&gt;&lt;SPAN&gt;store",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;flavor=flavor,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;training_set=training_set)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mlflow.end_run()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;To this point, everything is working fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can find the models in DBFS in: &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;dbfs:/mnt/my-s3-bucket/my-&lt;/SPAN&gt;&lt;SPAN&gt;experiment/run_id/artifacts/&lt;/SPAN&gt;&lt;SPAN&gt;model_feature_store.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;dbfs:/mnt/my-s3-bucket/my-&lt;/SPAN&gt;&lt;SPAN&gt;experiment/run_id/artifacts/&lt;/SPAN&gt;&lt;SPAN&gt;model_mlflow &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;I can find the models in my S3 bucket too. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can access my mlflow model with load_model without any problem from my notebook &lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;model_mlflow = mlflow.pyfunc.load_model(&lt;/SPAN&gt;&lt;SPAN&gt;model_uri=f"runs:/{active_run_&lt;/SPAN&gt;&lt;SPAN&gt;id}/model_mlflow")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;model_mlflow &lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;I can do fs.score_batch() with the Feature Store Client model as well without problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fs.score_batch(model_uri=f"&lt;/SPAN&gt;&lt;SPAN&gt;runs:/{active_run_id}/model_&lt;/SPAN&gt;&lt;SPAN&gt;feature_store", df = df)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;The problem comes at the final step when trying to register my model:&lt;BR /&gt;If I try to either:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Input the parameter of&amp;nbsp;registered_model_name&amp;nbsp;in any of the log_model()&amp;nbsp;functions, &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Or, Try to register any model with:&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;PRE&gt;&lt;SPAN&gt;mlflow.register_model(model_&lt;/SPAN&gt;&lt;SPAN&gt;uri=f"runs:/{active_run_id}/&lt;/SPAN&gt;&lt;SPAN&gt;model_mlflow",name=model_name) &lt;/SPAN&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;Or, Try to register my model from the UI with the Register Model button&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I get the exact same error:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;MlflowException: Model version creation failed for model name: model version: 4 with status: FAILED_REGISTRATION and message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed registration. The given source path `dbfs:/mnt/&amp;lt;my-s3-bucket&amp;gt;/&amp;lt;my-&lt;/SPAN&gt;&lt;SPAN&gt;experiment-name&amp;gt;/&amp;lt;run_id&amp;gt;/&lt;/SPAN&gt;&lt;SPAN&gt;artifacts/model_mlflow` does not exist.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;If I follow the exact same steps but save the experiment in a DBFS path outside the mounted S3 bucket I have no problem at all with the registration step. It only happens when I save the experiment in the S3-mounted bucket inside the S3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Why can't I register a model in Databricks when it is saved in dbfs:/mnt/S3-bucket?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 23:09:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/register-model-mounted-in-s3/m-p/73638#M3357</guid>
      <dc:creator>SOlivero</dc:creator>
      <dc:date>2024-06-12T23:09:35Z</dc:date>
    </item>
  </channel>
</rss>

