在将模型部署到aks pipelinemodel.load.org.apache.hadoop.mapred.invalidinputexception时

j7dteeu8  于 2021-05-31  发布在  Hadoop
关注(0)|答案(0)|浏览(388)

我正在尝试将模型部署到aks。我正在使用aml-sdk在aml工作区中注册模型。我正在使用pipelinemodel模块保存模型。我正在尝试使用pipelinemodel.load加载模型。我的输入脚本如下所示:
`导入os导入json作为pd导入Pandas
从azureml.core.model从pyspark.ml导入model从mmlspark导入pipelinemodel导入computemodelstatistics
def init():import mmlspark#这是加载mmlspark库导入日志所必需的


# extract and load model

global model, model_path
model_path = Model.get_model_path("{model_name}")
print(model_path)
print(os.stat(model_path))
print(os.path.exists(model_path))

# model_path = os.path.join(os.getenv("AZUREML_MODEL_DIR"), "{model_name}")

logging.basicConfig(level=logging.DEBUG)

# print(model_path)

# with ZipFile(model_path, 'r') as f:

# f.extractall('model')

model = PipelineModel.load(model_path)

# model = PipelineModel.read().load(model_path)

def run(input_json):try:output_df=model.transform(pd.read_json(input_json))evaluator=computemodelstatistics().setcoredlabelscol(“prediction”).setlabelcol(“label”).setevaluationmetric(“auc”)result=evaluator.transform(predictions)auc=result.select(“auc”).collect()[0][0]result=auc,异常情况除外:result=str(e)

return json.dumps({{"result": result}})

`
它给出的误差如下:
org.apache.hadoop.mapred.invalidinputexception:输入路径不存在:文件:/var/azureml-app/azureml-models/lightgbm.model/2/lightgbm.model/metadata\n\tat org.apache.hadoop.mapred.fileinputformat.singlethreadedliststatus(fileinputformat)。java:287)\n\t org.apache.hadoop.mapred.fileinputformat.liststatus(fileinputformat。java:229)\否\torg.apache.hadoop.mapred.fileinputformat.getsplits(fileinputformat。java:315).
os.path.exists返回true从model.get\u model\u path获取的路径。
我是不是漏了什么?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题