首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法加载DLL 'onnxruntime‘或它的一个依赖项ML.NET

无法加载DLL 'onnxruntime‘或它的一个依赖项ML.NET
EN

Stack Overflow用户
提问于 2020-12-16 16:06:24
回答 1查看 1.1K关注 0票数 1

我从Python中得到了这个onnx,但是我在context.Transforms.ApplyOnnxModel()中收到了错误-- "Unable to load DLL 'onnxruntime‘or or a依赖项:找不到指定的模块。(0x8007007E)哪里有问题?我应该修改什么?“

错误

代码语言:javascript
运行
复制
'context.Transforms.ApplyOnnxModel(modelPath)' threw an exception of type 'System.TypeInitializationException'
    Data: {System.Collections.ListDictionaryInternal}
    HResult: -2146233036
    HelpLink: null
    InnerException: {"Unable to load DLL 'onnxruntime' or one of its dependencies: The specified module could not be found. (0x8007007E)"}
    Message: "The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception."
    Source: "Microsoft.ML.OnnxRuntime"
    StackTrace: "   at Microsoft.ML.OnnxRuntime.SessionOptions..ctor()\r\n   at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath)\r\n   at Microsoft.ML.Transforms.Onnx.OnnxModel..ctor(String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu, Boolean ownModelFile, IDictionary`2 shapeDictionary)\r\n   at Microsoft.ML.Transforms.Onnx.OnnxTransformer..ctor(IHostEnvironment env, Options options, Byte[] modelBytes)\r\n   at Microsoft.ML.Transforms.Onnx.OnnxTransformer..ctor(IHostEnvironment env, String[] outputColumnNames, String[] inputColumnNames, String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu, IDictionary`2 shapeDictionary)\r\n   at Microsoft.ML.Transforms.Onnx.OnnxScoringEstimator..ctor(IHostEnvironment env, String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu, IDictionary`2 shapeDictionary)\r\n   at Microsoft.ML.OnnxCatalog.ApplyOnnxModel(TransformsCatalog catalog, String modelFile, Nullable`1 gpuDeviceId, Boolean fallbackToCpu)"
    TargetSite: {Void .ctor()}
    TypeName: "Microsoft.ML.OnnxRuntime.NativeMethods"
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-16 19:59:27

我以前用了错误的教程这个作品正确的https://docs.microsoft.com/en-us/azure/machine-learning/how-to-use-automl-onnx-model-dotnet

增加了参数input和output

代码语言:javascript
运行
复制
var onnxPredictionPipeline =
    mlContext
        .Transforms
        .ApplyOnnxModel(
            outputColumnNames: outputColumns,
            inputColumnNames: inputColumns,
            ONNX_MODEL_PATH);

和正确的包

代码语言:javascript
运行
复制
dotnet add package Microsoft.ML
dotnet add package Microsoft.ML.OnnxRuntime
dotnet add package Microsoft.ML.OnnxTransformer
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65319393

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档