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
39.3k stars 5.72k forks source link

Help me about the CUDA! #202

Closed David030111 closed 1 week ago

David030111 commented 2 months ago

Someting wrong but why? I'm sure the CUDA installed well.

PS D:\pythonProject\Deep-Live-Cam> python run.py --execution-provider cuda WARNING:tensorflow:From D:\Program Files\Python311\Lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

usage: run.py [-h] [-s SOURCE_PATH] [-t TARGET_PATH] [-o OUTPUT_PATH] [--frame-processor {face_swapper,face_enhancer} [{face_swapper,face_enhancer} ...]] [--keep-fps] [--keep-audio] [--keep-frames] [--many-faces] [--video-encoder {libx264,libx265,libvpx-vp9}] [--video-quality [0-51]] [--max-memory MAX_MEMORY] [--execution-provider {dml,cpu} [{dml,cpu} ...]] [--execution-threads EXECUTION_THREADS] [-v] run.py: error: argument --execution-provider: invalid choice: 'cuda' (choose from 'dml', 'cpu')

David030111 commented 2 months ago

Now,it's like this:

PS D:\pythonProject\Deep-Live-Cam> python run.py --execution-provider cuda WARNING:tensorflow:From D:\Program Files\Python311\Lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

Frame processor face_enhancer not found Frame processor face_enhancer not found 2024-08-12 15:18:27.3122924 [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::Pr oviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "D:\Program Files\Python311\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 co rrect 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-12 15:18:27.3924292 [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::Pr oviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "D:\Program Files\Python311\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_cuda.dll"

Exception in Tkinter callback Traceback (most recent call last): File "D:\Program Files\Python311\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "D:\Program Files\Python311\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 t he 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 "D:\Program Files\Python311\Lib\tkinter__init.py", line 1948, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "D:\Program Files\Python311\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked self._command() File "D:\pythonProject\Deep-Live-Cam\modules\ui.py", line 104, in live_button = ctk.CTkButton(root, text='Live', cursor='hand2', command=lambda: webcam_preview()) ^^^^^^^^^^^^^^^^ File "D:\pythonProject\Deep-Live-Cam\modules\ui.py", line 281, in webcam_preview source_image = get_one_face(cv2.imread(modules.globals.source_path)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\pythonProject\Deep-Live-Cam\modules\face_analyser.py", line 20, in get_one_face face = get_face_analyser().get(frame) ^^^^^^^^^^^^^^^^^^^ File "D:\pythonProject\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 "D:\Program Files\Python311\Lib\site-packages\insightface\app\face_analysis.py", line 31, in init model = model_zoo.get_model(onnx_file, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\Python311\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 "D:\Program Files\Python311\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 40, in get_model session = PickableInferenceSession(self.onnx_file, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\Python311\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 25, in init super().init(model_path, **kwargs) File "D:\Program Files\Python311\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 430, in init__ raise fallback_error from e File "D:\Program Files\Python311\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 425, in init self._create_inference_session(self._fallback_providers, None) File "D:\Program Files\Python311\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 t he 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.

syf2012 commented 2 months ago

My project is same problem,now it can work,this env is as shown below: CUDA Version: 12.1 cudnn-windows-x86_64-9.3.0.75_cuda12-archive.zip onnxruntime-gpu-1.18.1

shawtux commented 2 months ago

use the right versions from the page. The same thing happened to me, and it worked perfectly following the instructions.

CUDA Execution Provider (Nvidia)*

Install [CUDA Toolkit 11.8](https://developer.nvidia.com/cuda-11-8-0-download-archive)

Install dependencies:

pip uninstall onnxruntime onnxruntime-gpu pip install onnxruntime-gpu==1.16.3

Usage in case the provider is available:

python run.py --execution-provider cuda

r04dw4rri0r commented 2 months ago

Im having issues as well. The problem is 1.16.3 is no longer in pypi, the lowest version available is 1.17.0.

ERROR: Could not find a version that satisfies the requirement onnxruntime-gpu==1.16.3 (from versions: 1.17.0, 1.17.1, 1.18.0, 1.18.1) ERROR: No matching distribution found for onnxruntime-gpu==1.16.3

syf2012 commented 2 months ago

https://developer.nvidia.com/cudnn-downloads -------- 原始邮件 --------发件人: Lizer @.>日期: 2024年8月16日周五 17:10收件人: hacksider/Deep-Live-Cam @.>抄送: syf2012 @.>, Comment @.>主 题: Re: [hacksider/Deep-Live-Cam] Help me about the CUDA! (Issue #202)

我的项目有同样的问题,现在它可以工作了,此环境如下所示: CUDA 版本:12.1 cudnn-windows-x86_64-9.3.0.75_cuda12-archive.zip onnxruntime-gpu-1.18.1

最新的不是8.9.7吗你9.3.0哪里下载的

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

keindeezy commented 2 months ago

I had same problem. Solution is to uninstall both onnxruntime and onnxruntime-gpu, then reinstall them in order.

pip uninstall onnxruntime pip uninstall onnxruntime-gpu pip install onnxruntime==1.18.0 pip install onnxruntime-gpu==1.18.0

This solved it for me.

EyedressT commented 5 days ago

I had same problem. Solution is to uninstall both onnxruntime and onnxruntime-gpu, then reinstall them in order.

pip uninstall onnxruntime pip uninstall onnxruntime-gpu pip install onnxruntime==1.18.0 pip install onnxruntime-gpu==1.18.0

This solved it for me.

What version of CUDA and CUDNN do you use? Because i had 1.12.1 and 1.18 and many versions of onnxruntime-gpu, but it just don't allow to use GPU and the same problem with PATH or something like in topic