1

I have stored one ml model in my ADLS and I want to register the model to Azure ML using databricks. Tried to use the following codes to register my ml model but keep encountering an error that the path cannot be found. I have mount the storage to my databricks.

import urllib.request
from azureml.core.model import Model

# Register a model 
model = Model.register(model_path = 'dbfs:/mnt/machinelearning/classifier.joblib',
                      model_name = "pretrained-classifier",
                      description = "Pretrained Classifier",
                       workspace=ws)


Thanks in advance!

whaleshark
  • 11
  • 2
  • If my answer was helpful , You can Accept it as an Answer, so that others who encounter the same issue can find this solution and fix their problem. – Abhishek K Jan 18 '22 at 09:53

1 Answers1

0

To access files from ADLS you should have Contributor role. To assign contributor role follow below steps– This example assigns the Storage Blob Data Contributor to the ADLS Gen2 storage account.

  1. In the Azure portal, go to the Storage accounts service.
  2. Select the ADLS Gen2 account to use with this application registration.
  3. Click Access Control (IAM).
  4. Click + Add and select Add role assignment from the dropdown menu.
  5. Set the Select field to the Azure AD application name and set Role to Storage Blob Data Contributor.
  6. Click Save.

Now to check access to ADLS, use below command

List Mount:

dbutils.fs.ls("/mnt/<mount-name>")

Refer - https://learn.microsoft.com/en-us/azure/databricks/data/data-sources/azure/adls-gen2/azure-datalake-gen2-sp-access#---mount-adls-gen2-storage

Also refer - https://learn.microsoft.com/en-us/azure/databricks/_static/notebooks/adls-gen2-service-principal.html

Abhishek K
  • 3,047
  • 1
  • 6
  • 19