【发布时间】:2020-04-24 11:15:48
【问题描述】:
我正在尝试构建一个使用 Onnx 机器学习模型文件的 ASP.NET Core api。我是这样加载的:
OnnxScoringEstimator pipeline = _mlContext.Transforms.ApplyOnnxModel(_config.GetSection("ModelPath").Value);
这意味着它从 appsettings.json 文件中获取路径,如下所示:
appsettings.Development.json
"ModelPath": "C:\\Users\\name\\dev\\solution\\project\\model.onnx"
还有我的 appsettings.Production.json
"ModelPath": "./model.onnx"
在我的机器上调试项目时它确实可以工作,但当我在 docker 容器中构建它时就不行。然后它给出以下错误:
Connection id "0HLV880PG88DT", Request id "0HLV880PG88DT:00000002": An unhandled exception was thrown by the application.
System.DllNotFoundException: Unable to load shared library 'onnxruntime' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libonnxruntime: cannot open shared object file: No such file or directory
因为它说No such file or directory 我会说这与我的模型路径错误有关,但我不确定。
我希望有人可以提供帮助。谢谢
【问题讨论】:
标签: docker asp.net-core