hacksider / Deep-Live-Cam

real time face swap and one-click video deepfake with only a single image
GNU Affero General Public License v3.0
34.94k stars 4.93k forks source link

Error GPU CUDA #481

Open tomzaditya opened 2 weeks ago

tomzaditya commented 2 weeks ago

I install CUDA 11.8 pip uninstall onnxruntime onnxruntime-gpu pip install onnxruntime-gpu==1.16.3

My VGA RTX 3070

2024-08-28 00:49:44.9275887 [E:onnxruntime:Default, provider_bridge_ort.cc:1480 onnxruntime::TryGetProviderInfo_CUDA] D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1193 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

EP Error D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:743 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/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported. when using ['CUDAExecutionProvider'] Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying. 2024-08-28 00:49:45.0025867 [E:onnxruntime:Default, provider_bridge_ort.cc:1480 onnxruntime::TryGetProviderInfo_CUDA] D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1193 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 463, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) RuntimeError: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:743 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/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\tkinter__init.py", line 1921, in call return self.func(*args) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked self._command() File "C:\Users\TOMI ADITIYA\Downloads\Deep-Live-Cam-cuda_deep-live-cam\Deep-Live-Cam-cuda_deep-live-cam\modules\ui.py", line 104, in live_button = ctk.CTkButton(root, text='Live', cursor='hand2', command=lambda: webcam_preview()) File "C:\Users\TOMI ADITIYA\Downloads\Deep-Live-Cam-cuda_deep-live-cam\Deep-Live-Cam-cuda_deep-live-cam\modules\ui.py", line 281, in webcam_preview source_image = get_one_face(cv2.imread(modules.globals.source_path)) File "C:\Users\TOMI ADITIYA\Downloads\Deep-Live-Cam-cuda_deep-live-cam\Deep-Live-Cam-cuda_deep-live-cam\modules\face_analyser.py", line 20, in get_one_face face = get_face_analyser().get(frame) File "C:\Users\TOMI ADITIYA\Downloads\Deep-Live-Cam-cuda_deep-live-cam\Deep-Live-Cam-cuda_deep-live-cam\modules\face_analyser.py", line 14, in get_face_analyser FACE_ANALYSER = insightface.app.FaceAnalysis(name='buffalo_l', providers=modules.globals.execution_providers) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\insightface\app\face_analysis.py", line 31, in init model = model_zoo.get_model(onnx_file, kwargs) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\insightface\model_zoo\model_zoo.py", line 96, in get_model model = router.get_model(providers=providers, provider_options=provider_options) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\insightface\model_zoo\model_zoo.py", line 40, in get_model session = PickableInferenceSession(self.onnx_file, kwargs) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\insightface\model_zoo\model_zoo.py", line 25, in init super().init(model_path, **kwargs) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 430, in init__ raise fallback_error from e File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 425, in init self._create_inference_session(self._fallback_providers, None) File "C:\Users\TOMI ADITIYA\AppData\Local\Programs\Python\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 463, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) RuntimeError: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:743 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/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.

arasilador commented 2 weeks ago

I'm not sure why the D: drive is being called. Are you in a virtual environment?

Can you check what you get when you enter in the command line?: echo %CUDA_PATH%

The output should look something like this: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8

keindeezy commented 2 weeks ago

I am having same problem. python run.py works without Nvidia but at 1 fps and it lags. Any idea to fix this?

keindeezy commented 2 weeks ago

This is what I get

PS C:\Users\keind\OneDrive\Documents\Deep-Live-Cam-main\Deep-Live-Cam-main> python run.py --execution-provider cuda 2024-08-28 04:41:57.5774203 [E:onnxruntime:Default, provider_bridge_ort.cc:1744 onnxruntime::TryGetProviderInfo_CUDA] C:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1426 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

EP Error EP Error C:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:866 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported. when using ['CUDAExecutionProvider'] Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.


2024-08-28 04:41:57.6626736 [E:onnxruntime:Default, provider_bridge_ort.cc:1744 onnxruntime::TryGetProviderInfo_CUDA] C:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1426 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 483, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) RuntimeError: C:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:866 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\tkinter__init.py", line 1968, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked self._command() File "C:\Users\keind\OneDrive\Documents\Deep-Live-Cam-main\Deep-Live-Cam-main\modules\ui.py", line 109, in live_button = ctk.CTkButton(root, text='Live', cursor='hand2', command=lambda: webcam_preview()) ^^^^^^^^^^^^^^^^ File "C:\Users\keind\OneDrive\Documents\Deep-Live-Cam-main\Deep-Live-Cam-main\modules\ui.py", line 340, in webcam_preview source_image = get_one_face(cv2.imread(modules.globals.source_path)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\keind\OneDrive\Documents\Deep-Live-Cam-main\Deep-Live-Cam-main\modules\face_analyser.py", line 20, in get_one_face face = get_face_analyser().get(frame) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\keind\OneDrive\Documents\Deep-Live-Cam-main\Deep-Live-Cam-main\modules\face_analyser.py", line 14, in get_face_analyser FACE_ANALYSER = insightface.app.FaceAnalysis(name='buffalo_l', providers=modules.globals.execution_providers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\insightface\app\face_analysis.py", line 31, in init model = model_zoo.get_model(onnx_file, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 96, in get_model model = router.get_model(providers=providers, provider_options=provider_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 40, in get_model session = PickableInferenceSession(self.onnx_file, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 25, in init super().init(model_path, **kwargs) File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 432, in init__ raise fallback_error from e File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 427, in init self._create_inference_session(self._fallback_providers, None) File "C:\Users\keind\AppData\Local\Programs\Python\Python312\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 483, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) RuntimeError: C:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:866 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasnt able to be loaded. Please install the correct version of CUDA andcuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.

NXTler commented 1 week ago

Your CUDA PATHs are properly not correctly set up.

keindeezy commented 1 week ago

Anybody having this problem on windows. I followed a process to install CUDA properly and my RTX 4050 works well. I don't really know whether the first step solved it or the second so you can try just first step and run it and see.

  1. I believed I installed CUDA only on the windows machine so I installed it in py pip install cuda-python

  2. I learnt some uses of CUDA needs cuDNN on windows. I Proper installed it using the Tarball Installation here: https://docs.nvidia.com/deeplearning/cudnn/latest/installation/windows.html

And problem solved.