question

RobMizany-4580 avatar image
0 Votes"
RobMizany-4580 asked ·

How to use a model trained by Azure AutoML

Hi,
I've trained a classification model using Azure AutoML. In the "Output" folder of the best model page I can see these files:
![![74035-image.png][1]][1]

1- How should I use this model to predict new observations. I want to do this on Azure Machine Learning Studio, so no need to deploy it as a web service or take it to a local computer as a pickle file.


2- I saw a few examples where people downloading their model as a PKL file and loading and running it to get predictions. I tried it by using the following code:

 import pickle
 Pkl_Filename = "testPickle.pkl"
 with open(Pkl_Filename, 'rb') as file:  
     Pickled_LR_Model = pickle.load(file)
 Pickled_LR_Model

and got the below error:

ModuleNotFoundError Traceback (most recent call last)
<ipython-input-14-1e47995f2929> in <module>
2 Pkl_Filename = "testPickle.pkl"
3 with open(Pkl_Filename, 'rb') as file:
----> 4 Pickled_LR_Model = pickle.load(file)
5
6 Pickled_LR_Model

ModuleNotFoundError: No module named 'azureml.automl.runtime._ml_engine.featurizer_suggestion'



Also used the joblib library to load the model and got the same error. Please help me with detailed step-by-step instructions (including scripts) if it is possible. I'm new to Azure Machine Learning Studio.


azure-machine-learningazure-machine-learning-studio-classicazure-machine-learning-inference
image.png (15.7 KiB)
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Try installing the full automl package: pip install azureml-automl-runtime to see if it helps resolve the issue.

0 Votes 0 ·
RobMizany-4580 avatar image
0 Votes"
RobMizany-4580 answered ·

I fixed this problem by creating a new compute instance and using it to load the pickle file. Sounds strange but it seems this error happens due to a mismatch between the azureml sdk on the jupyter instance and on the compute instance.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GiftA-MSFT avatar image
0 Votes"
GiftA-MSFT answered ·

Hi, it is possible to unpickle a model.pkl file, but you need to do so in a conda environment that is compatible with the runtime env where the pickle was created. Try installing the full automl package: pip install azureml-automl-runtime to see if it helps resolve the issue.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks, @GiftA-MSFT. I fixed this problem by creating a new compute instance and using it to load the pickle file. Sounds strange but it seems this error happens due to a mismatch between the azureml sdk on the jupyter instance and on the compute instance.

0 Votes 0 ·