I have saved a classifier model with pickle using the following code-
import pickle
with open('model.pickle', 'wb') as fid:
pickle.dump(clf, fid)
This is the score.py file where I am loading the pickle model and the same file is called during deployment. Also note that, all these files (code, pickle file and related files) are in the same directory.
# Initialize the deployment environment
def init():
global obj
with open('./model.pickle', 'rb') as f:
obj = pickle.load(f)
This is getting stored in some directory var/azureml-app
After running this deployment code, this is the error I am getting-
open('/mnt/batch/tasks/shared/LS_root/mounts/clusters/model.pickle', 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/batch/tasks/model.pickle'