System.Private.CoreLib:在Azure函数中本地加载保存的TensorFlow模型时,python3退出,代码为139

2024-09-30 01:36:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我用tf.estimator.BoostedTrees回归器训练了一个TensorFlow模型,并用export_saved_模型在本地保存

使用保存的模型,我可以成功地重新加载模型,并使用Python在本地进行进一步预测。但是,在我尝试重新加载模型并进行预测之后,Azure函数在加载模型时总是抛出一个错误:

[2021-05-19T05:29:55.158Z]执行了“函数.tasteprofilepredition”(失败,Id=6a935bb4-0765-4dd5-a95f-7842174e05b7,持续时间=12544ms) [2021-05-19T05:29:55.158Z]System.Private.CoreLib:执行函数时发生异常:Functions.tasteprofilepredition。System.Private.CoreLib:python3已退出,代码为139

代码片段是

subdirs = [x for x in pathlib.Path('./Resource/Model/saved_model').iterdir()
               if x.is_dir() and 'temp' not in str(
latest = str(sorted(subdirs)[-1])
model = tf.saved_model.load(latest).signatures['predict']

有人知道为什么会这样吗?我在网上找到的信息说这是一个分段错误,但我不知道如何在Azure函数中解决它。非常感谢


Tags: 函数代码in模型modeltf错误private

热门问题