OnnxStack icon indicating copy to clipboard operation
OnnxStack copied to clipboard

LoadLibrary failed with error 126

Open JacobCZ opened this issue 1 year ago • 1 comments

Trying the minimal stable diffusion example from the readme, when I run the code (with executionProvider: ExecutionProvider.Cuda in the ctor to use CUDA) I get the following error:

Unhandled exception. Microsoft.ML.OnnxRuntime.OnnxRuntimeException: [ErrorCode:RuntimeException] D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1209 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "...\bin\Debug\net8.0\onnxruntime_providers_cuda.dll"

   at Microsoft.ML.OnnxRuntime.SessionOptions.AppendExecutionProvider_CUDA(Int32 deviceId)
   at OnnxStack.Core.Extensions.GetSessionOptions(OnnxModelConfig configuration)
   at OnnxStack.Core.Model.OnnxModelSession..ctor(OnnxModelConfig configuration)
   at OnnxStack.StableDiffusion.Models.UNetConditionModel..ctor(UNetConditionModelConfig configuration)
   at OnnxStack.StableDiffusion.Pipelines.StableDiffusionPipeline.CreatePipeline(StableDiffusionModelSet modelSet, ILogger logger)
   at OnnxStack.StableDiffusion.Pipelines.StableDiffusionPipeline.CreatePipeline(String modelFolder, ModelType modelType, Int32 deviceId, ExecutionProvider executionProvider, MemoryModeType memoryMode, ILogger logger)
   at UnstableDiffusion.UnstableDiff..ctor(String model) in ...\StableDiff.cs:line 20
   at Program.<Main>$(String[] args) in ...\Program.cs:line 3
   at Program.<Main>(String[] args)

I'm not sure what to do about this. I tried manually installing the CUDA SDK and cuDNN to no avail. bin\Debug\net8.0\onnxruntime_providers_cuda.dll exists and seems to be a valid DLL

Environment:

  • Windows 10
  • .NET 8.0.200
  • OnnxStack.StableDiffusion 0.31.0
  • CUDA 12.2
  • cuDNN 8.9.2.26

JacobCZ avatar May 09 '24 14:05 JacobCZ