在 Azure Web 服务中而非 ML 实验中执行 python 脚本时出现错误 0085
Error 0085 while executing python script in Azure Web service but not in ML Experiment
-
machine-learning
-
azure
-
azure-machine-learning-studio
-
azure-web-app-service
-
azure-machine-learning-service
我的工作流程 运行 在实验上是完美的,但是在部署到 Web 服务后,我在 post 时收到此错误。
Python代码:
# -*- coding: utf-8 -*-
#import sys
import pickle
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn import tree
def azureml_main(dataframe1 = None, dataframe2 = None):
print('input dataframe1 ',dataframe1)
decision_tree_pkl_predictive_maint = r'.\Script Bundle\decision_tree_pkl_predictive_maint.pkl'
#sys.path.insert(0,".\Script Bundle")
#model = pickle.load(open(".\Script Bundle\decision_tree_pkl_predictive_maint.pkl", 'rb'))
modle_file = open(decision_tree_pkl_predictive_maint,"rb")
model = pickle.load(modle_file)
#return the mode of prediciton
result = model.predict(dataframe1)
print(result)
result_df = pd.DataFrame({'prediction_class':result})
return result_df,
错误:
执行 Python 脚本 RRS:错误 0085:脚本评估期间发生以下错误,请查看输出日志以获取更多信息:------------ 错误消息开始于 Python 解释器 ---------- 执行函数时捕获异常:Traceback(最近调用最后一次):文件“\server\InvokePy.py”,第 120 行,在 executeScript outframe = mod.azureml_main(*inframes) 文件“\temp-1036260731852293620.py”,第 46 行,在 azureml_main modle_file = open(decision_tree_pkl_predictive_maint,"rb") FileNotFoundError: [ Errno 2] No such file or directory: '.\Script Bundle\decision_tree_pkl_predictive_maint.pkl' -------- 来自 Python 解释器的错误消息结束 -------- --
请指教
问题与您的文件路径有关。确保您包含了正确的路径。
machine-learning
azure
azure-machine-learning-studio
azure-web-app-service
azure-machine-learning-service
我的工作流程 运行 在实验上是完美的,但是在部署到 Web 服务后,我在 post 时收到此错误。
Python代码:
# -*- coding: utf-8 -*-
#import sys
import pickle
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn import tree
def azureml_main(dataframe1 = None, dataframe2 = None):
print('input dataframe1 ',dataframe1)
decision_tree_pkl_predictive_maint = r'.\Script Bundle\decision_tree_pkl_predictive_maint.pkl'
#sys.path.insert(0,".\Script Bundle")
#model = pickle.load(open(".\Script Bundle\decision_tree_pkl_predictive_maint.pkl", 'rb'))
modle_file = open(decision_tree_pkl_predictive_maint,"rb")
model = pickle.load(modle_file)
#return the mode of prediciton
result = model.predict(dataframe1)
print(result)
result_df = pd.DataFrame({'prediction_class':result})
return result_df,
错误:
执行 Python 脚本 RRS:错误 0085:脚本评估期间发生以下错误,请查看输出日志以获取更多信息:------------ 错误消息开始于 Python 解释器 ---------- 执行函数时捕获异常:Traceback(最近调用最后一次):文件“\server\InvokePy.py”,第 120 行,在 executeScript outframe = mod.azureml_main(*inframes) 文件“\temp-1036260731852293620.py”,第 46 行,在 azureml_main modle_file = open(decision_tree_pkl_predictive_maint,"rb") FileNotFoundError: [ Errno 2] No such file or directory: '.\Script Bundle\decision_tree_pkl_predictive_maint.pkl' -------- 来自 Python 解释器的错误消息结束 -------- --
请指教
问题与您的文件路径有关。确保您包含了正确的路径。