I used Azure AutoML service to test various models and after choosing the best one I registered it in my workspace.
Process done for registering:
- I downloaded the model(a zipped folder containing 3 files) into my laptop
- Unzipped the folder in my laptop
- Uploaded the unzipped folder(containing the score, environment yml and pkl file ) in the Azure "Models" pane and registered a model under the name "lgbm"
What I want to achieve:
I want to use the registered model to make some predictions on a "validation" Dataset I have in Azure(already registered) and check out the accuracy metrics once again.
Steps done:
- Registered the validation dataset in Azure properly
- Started the Azure VM and Opened a new notebook
- Got the validation data into the script
Where I got stuck :
Unable to get the registered model into my script and make predictions:
Code:
import azureml.core
from azureml.core import Workspace
Load the workspace from the saved config file
ws = Workspace.from_config()
print('Ready to use Azure ML {} to work with {}'.format(azureml.core.VERSION, ws.name))
from azureml.core import Dataset
import glob
tab_data_set = Dataset.Tabular.from_delimited_files(path=(default_ds, 'UI/07-11-2021_055454_UTC/test_pred.csv'))
tab_data_set = tab_data_set.to_pandas_dataframe()
model_path = Model.get_model_path('lgbm')
model = joblib.load(model_path)
Error
ModelNotFoundException: ModelNotFoundException:
Message: Model lgbm not found in cache at azureml-models or in current working directory /mnt/batch/tasks/shared/LS_root/mounts/clusters/azuremlvm201/code/Users/vishal_c_v. For more info, set logging level to DEBUG.
InnerException None
ErrorResponse
{
"error": {
"message": "Model lgbm not found in cache at azureml-models or in current working directory /mnt/batch/tasks/shared/LS_root/mounts/clusters/azuremlvm201/code/Users/vishal_c_v. For more info, set logging level to DEBUG."
}
}