Failed to load SAM model
Hi.
I try to use SAM model for my task.
But, It's failed with below error message.
I use AnyLabeling v0.2.24 AnyLabeling-GPU.exe binary file.
And I installed CUDA 11.6, cudnn 8.5.0.96 used below file.
How can I solve this problem.
Only binary file doesn't work with the GPU. The other method that .python ./anylabeling./app.py work with the GPU.
I tried below method to run binary file with the GPU.
I rebuild the binary file with turn on the console
2023-06-2008:17:02.3268788[W:onnxruntime:Default,onnxruntime_pybind_state.cc:1671onnxruntime::python::CreateInferencePybindStateModule]Initproviderbridgefailed.
2023-06-2008:17:03.5893876[E:onnxruntime:Default,provider_bridge_ort.cc:1304onnxruntime::TryGetProviderInfo_CUDA]D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1055onnxruntime::ProviderSharedLibrary::Ensure[ONNXRuntimeError]:1:FAIL:LoadLibraryfailedwitherror126""whentryingtoload"C:\Users\SEUNGT~1\AppData\Local\Temp\_MEI20522\onnxruntime\capi\onnxruntime_providers_shared.dll"
Error in loading model: D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:537 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/reference/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.
And then I get above error message when I load the model.
So, I copied whole onnxruntime dll to C:\Users\<User Name>\AppData\Local\Temp\_MEI20522\onnxruntime\capi\ and reload the model then it works with the GPU.
However, this is not a complete solution. because the directory is temporary created when the program is run and delete when program is stopped.
For those who, like me, do not wish to downgrade their CUDA, the following settings are up-to-date and work well:
- Windows 11
- anylabeling: 0.4.10 (from
pip install anylabeling-gpu) - CUDA: 12.4
- cuDNN: 9.5
- TensorRT: 10.5
- ONNX Runtime GPU: 1.19.2
Ref: https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html#requirements