Trouble downloading and loading files in python script module

Guilherme Takata 1 Reputation point
2021-10-08T20:53:21.097+00:00

I'm currently trying to create an endpoint in Azure ML studio designer, I'm trying to download a ML model pickle file from a blob container and use it in the pipeline to make predictions in new data. But when I try to download the file and load into the script I always get an error. Here follows the code snippet I'm trying to run and the error returned.

Code Snippet

origin = dataframe1['Key'].unique()[0].lower()
run = Run.get_context(allow_offline = True)
ws = run.experiment.workspace
datastore = Datastore(ws, 'models_datastore')
datastore.download('Downloads//', prefix = 'Model_{origin}//vectorizer.pkl')
model = pickle.load(open('Downloads//vectorizer.pkl', 'rb'))

Error returned

Got exception when invoking script at line 23 in function azureml_main: 'FileNotFoundError: [Errno 2] No such file or directory: 'Downloads//vectorizer.pkl''.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,334 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ramr-msft 17,826 Reputation points
    2021-10-11T10:03:11.52+00:00

    @Guilherme Takata Thanks for the question. Here are the instructions to Use the studio to deploy models trained in the designer - Azure Machine Learning | Microsoft Learn and document that explains how we can get access to score.py and conda_env.yaml files under Output + logs tab for Train module.

    0 comments No comments

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.