python找不到scripts文件夹_执行Python脚本模块:加载Pickle文件:错误:找不到目录或文件...

1586010002-jmsa.png

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:

1411783

Here is the canvas after the run showing a tick against the script.

1411784

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值