Hi
Tried almost all the options to load the pickle file in the Zip to the third input of this module as below.. but still unable to find the path, Pls suggest if any correction required here. this is the reference link
https://blogs.technet.microsoft.com/uktechnet/2018/04/25/deploying-externally-generated-pythonr-models-as-web-services-using-azure-machine-learning-studio/
# The script MUST contain a function named azureml_main
# which is the entry point for this module.
# imports up here can be used to
#import pandas as pd
# The entry point function can contain up to two input arguments:
# Param: a pandas.DataFrame
# Param: a pandas.DataFrame
import pandas as pd
import sys
import pickle
from sklearn.externals import joblib
def azureml_main(dataframe1 = None, dataframe2 = None):
#sys.path.append('.\\Script Bundle\\descript')
print(sys.path)
#KnnClassifier = cPickle.load(open(r'.descript.pkl', 'rb'))
#sys.path.insert(0,".\Script Bundle\descript")
sys.path.append(r".\\Script Bundle\\descript")
trained_model = joblib.load('.\\Script Bundle\\descript\\descript.pkl')
#model = pickle.load(open("C:\\temp", 'rb'))
# If a zip file is connected to the third input port is connected,
# it is unzipped under ".\Script Bundle". This directory is added
# to sys.path. Therefore, if your zip file contains a Python file
# mymodule.py you can import it using:
# import mymodule
# Return value must be of a sequence of pandas.DataFrame
return dataframe1,
解决方案Hello,
I tried the same tutorial mentioned and I was able to load and run the experiment. The default execute python script in the tutorial worked fine for me. What is the python version you used for which you ran the training script? I used python 3.7.2 version
locally and selected version 3.5 from Azure ML studio canvas. Ideally they should be same but it worked for me with this version.
Try to use pickle.load() with the correct path, Here is the script i used:
Here is the canvas after the run showing a tick against the script.
Could you please check the output or error log of your Execute Python Script by right clicking on it?
I suspect the issue with your sys.path and I think the log will tell us what the issue is.
-----------------------------------------------------------------------------------------------------------
If you found this post helpful, please give it a "Helpful" vote.
Please remember to mark the replies as answers if they help.