Registered AzureML Model from a NotebookVM can not be found

MathBarbarian 21 Reputation points
2021-01-25T21:50:53.007+00:00

First here is code for my version:

>>>from azureml.__version__ import __version__ as _azml_version_
>>>from azureml.core import __version__ as _azmlcore_version_
>>>from azureml.train.automl import __version__ as _azmltrain_version_

>>>print('azure', _azml_version_)
>>>print(' core', _azmlcore_version_)
>>>print('train', _azmltrain_version_)
azure 1.0.1b6.post1
core 1.18.0
train 1.18.0

The following cell fails when trying to execute the Model.get_model_path( method and ultimately raises a ModelNotFoundException .
Which is very weird because I can view the model info in the "Microsoft Azure Machine Learning" portal.

>>> model_name = 'total_ridge_20210106'
>>> model_path = f'ridge_src/{model_name}.pkl'
>>>
>>> model = joblib.load(model_path)
>>>
>>> azmodel = Model.register(model_path=model_path,
>>> model_name=model_name,
>>> tags={'area': "qtc", 'type': "regression"},
>>> description=f"monolithic ridge model",
>>> workspace=ws)
>>>
>>> retrieved_path = Model.get_model_path(model_name)

ModelNotFoundException: ModelNotFoundException:
Message: Model not found in cache or in root at ./total_ridge_20210106. For more info,set logging level to DEBUG.
InnerException None
ErrorResponse

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,128 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,368 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Ramr-msft 17,821 Reputation points
    2021-01-26T16:06:31.79+00:00

    @MathBarbarian Thanks for the question. Your workspace is not loading the model. Make sure you register the model in workspace and then you can retrieve the model while deploying as

    def init():
    global model
    # retrieve the path to the model file using the model name
    model_path = Model.get_model_path('ARAGON_CRF_NER')
    model = joblib.load(model_path)


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.