Using Registered Model to make predictions without having to deploy it in Azure ML.

Sena Aslan 25 Reputation points
2024-02-25T12:38:24.3266667+00:00

I have trained a model in azure ml designer pipeline using "boosted decision tree regression" and "tune model hyperparameters" components. I have registered this model using "register model" button in "tune model hyperparameters" component. Now i need to get this model to make predictions in azure ml notebook. I am getting the registered model with below code, however when i try to make predictions with the model it throws : AttributeError: 'Model' object has no attribute 'predict'. So, how can i solve this without having to deploy the model ?

#get registered model
model = ml_client.models.get(name="my_model_name", version="1")
model
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,961 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. dupammi 8,535 Reputation points Microsoft Vendor
    2024-02-26T07:31:28.6766667+00:00

    Hi @Sena Aslan

    Thank you for using the Microsoft Q&A forum.

    To use a registered model for making predictions in Azure ML Notebook, you need to download the model artifact and load it into your notebook. You can download the model artifact from the registered model using the Model.get_model_path() method and load the model from the .pkl file using the joblib.load() function.

    Once the model is loaded, you can prepare input data and then, you can make predictions using the predict method of the loaded model.

    You can find more information about - How to work with models in Azure Machine Learning, here.

    I hope you understand. Thank you.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful.


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.