Load a Registered Model in Azure ML Studio in an Interactive Notebook

  Kiến thức lập trình

I’m using Azure Machine Learning Studio and I have an sklearn mlflow model stored in my default datastore (blob storage) which I have then registered as a model asset. How can I load this model inside an interactive notebook to perform some quick model inferencing and testing before deploying this as a batch endpoint.

I have seen a post linked here that suggests downloading the model artefacts locally but I shouldn’t need to do this. I should be able to load the model directly from the datastore or the registered asset without the need to duplicate the model in multiple places. I have tried the following without success.

Reading from Registered Model Asset

import mlflow
from azure.ai.ml import MLClient
from azure.ai.ml.entities import Model

ml_client = MLClient(DefaultAzureCredential(), "<subscription_id>", "<resource_group>", "<workspace_id>")

model = ml_client.models.get("<model_name>", version="1")
loaded_model = mlflow.sklearn.load_model(model.id)

>>> OSError: No such file or directory: ...

Reading from Datastore

import mlflow

model_path = "<datastore_uri_to_model_folder>"
loaded_model = mlflow.sklearn.load_model(model_path)

>>> DeserializationError: Cannot deserialize content-type: text/html

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT