vietanhdev / anylabeling

Effortless AI-assisted data labeling with AI support from YOLO, Segment Anything, MobileSAM!!
https://anylabeling.nrl.ai
GNU General Public License v3.0
2.04k stars 222 forks source link

Failed to load SAM model #99

Open seungtaek94 opened 1 year ago

seungtaek94 commented 1 year ago

Hi.

I try to use SAM model for my task.

But, It's failed with below error message. image

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. image

How can I solve this problem.

seungtaek94 commented 1 year ago

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.