Comments (16)
For this to work smoothly, trust me, you will need cuda 11.4 and cuDnn8.2.4.15.. install them separately..and add to env path. That's the requirement for onnxruntime-gpu. Refacer solely depends on the system cuda and cudnn. It's unlike auto1111 and roop.
During installation, both automatic1111 & roop download torch with cuda and cudnn. They don't depend on the cuda and cudnn you have on your pc. If you believe that they work because of cuda 12.1 you installed on the PC, you are wrong. Even if you uninstall them, roop and automatic1111 would continue to work, because they have all dependencies installed via pip. So plz install the versions I mentioned. It doesn't matter what you already have on your system. Different cuda and cudnn versions can co exist in one pc. Make sure all are in path.
from refacer.
ok i'll try but i got a WSL/ubuntu on my win11, and i successfuly run refacer.
it is using Cuda 12.1 also but the one of Ubuntu packages.
(.venv-refacer) xxx@NITRO:~/dev/refacer$ python app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
inswapper-shape: [1, 3, 128, 128]
Running on local URL: http://127.0.0.1:7860/
So, it is weird, it works fine with CUDA 12.1 on ubuntu but not on native win11.
from refacer.
It all depends on the onnxruntime-gpu. On windows, it's not as up-to-date as the one available for linux. Roop downloads cuda 11.8 with cudnns. So I guess anything greater than 11.8 may not work. The most desirable version is cuda 11.4 & cuDnn8.2.4.15.
from refacer.
thanks, i'm dowloading cuda 11.8 to test.
About cuDnn, i don't have currently any version of it, i was not aware it is required.
from refacer.
same issue with CUDA 11.8
(venv-refacer) C:\Users\xxx\IA\faceswap\refacer>echo %CUDA_PATH%
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
CUDA 11.4 is only available for Windows 10 and i'm running Windows 11
from refacer.
My card is GTX 1650 ti.. 11.4 is available for my card... so Install cuda 11.4 if available & cuDnn8.2.4.15 and add them to the path like below. Take a look at the first 3 lines.. you need them..
from refacer.
Ok i followed your recommandation but still same issue with CUDA 11.4 and CuDnn8.2.4
(venv-refacer) C:\Users\xxx\IA\faceswap\refacer>echo %CUDA_PATH%
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4
(venv-refacer) C:\Users\xxx\IA\faceswap\refacer>python app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
EP Error D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 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', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
Traceback (most recent call last):
File "C:\Users\nico\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in __init__
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 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\xxx\IA\faceswap\refacer\app.py", line 17, in <module>
refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance)
File "C:\Users\xxx\IA\faceswap\refacer\refacer.py", line 35, in __init__
self.__init_apps()
File "C:\Users\xxx\IA\faceswap\refacer\refacer.py", line 84, in __init_apps
sess_face = rt.InferenceSession(model_path, self.sess_options, providers=self.providers)
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 394, in __init__
raise fallback_error from e
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 389, in __init__
self._create_inference_session(self._fallback_providers, None)
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 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.
What am I missing ?
from refacer.
You are missing.. 11.4/bin and cudnn in the path. Make sure you have all the 3 items I marked in the picutre below. preferably in System environment path.
from refacer.
Same result:
For CuDnn i simply followed the install instructions, i copied CuDnn/bin to cuda11.4/bin, CuDnn/includes to Cuda11.4/includes and CuDnn/libs to Cuda11.4/lib
from refacer.
Ok i did a mistake, i m redoing it properly:
Still same issue
from refacer.
That's strange. I faced similar issues but installing the proper cuda and cudnn resolved the problem for me. Have u installed cudnn 8.2.4.15? No other version would work.
from refacer.
I used the following archive: cudnn-11.4-windows-x64-v8.2.4.15.zip
so yes 8.2.4.15
I copied the folders into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDNN\v8.x
from refacer.
ok CUDNN is in the path but still issue:
(venv-refacer) C:\Users\xxx\IA\faceswap\refacer>python app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
EP Error D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 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', 'CPUExecutionProvider']
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
Traceback (most recent call last):
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in __init__
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\Users\xxx\IA\faceswap\venv-refacer\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 435, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: D:\a\_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:636 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.
PATH:
(venv-refacer) C:\Users\xxx\IA\faceswap\refacer>echo %PATH%
C:\Users\xxx\IA\faceswap\venv-refacer\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDNN\v8.2.4.15\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\Nsight Compute 2021.2.0\;C:\Users\xxx\AppData\Local\Microsoft\WindowsApps;C:\Users\xxx\AppData\Local\Programs\Git\cmd;C:\Users\xxx\AppData\Local\Microsoft\WinGet\Links;
from refacer.
This is the exact setup I have and it works flawlessly.
from refacer.
ok at the end i managed to make it working with the help of a guy (Doofenshmirtz, thanks to him) on discord.
he told me that I should install torch and import it before onnxruntime
So, i installed torch and modified refacer.py to add "import torch" before "import onnxruntime"
It means my CUDA installation are not used (like for roop).
(.venv) C:\Users\xxx\IA\faceswap\refacer>python app.py
Trying FFMPEG h264_nvenc encoder
FFMPEG h264_nvenc encoder works
Video codec for FFMPEG: h264_nvenc
CUDA mode with providers ['CUDAExecutionProvider', 'CPUExecutionProvider']
inswapper-shape: [1, 3, 128, 128]
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
from refacer.
Okay good for you.. mine works right out of the box.. without having to install torch..
from refacer.
Related Issues (20)
- refacer and roop parralel installation causes problems. HOT 12
- refacer web-interface uses same port as automatic1111 aka stable diffusion. HOT 1
- How can I increase the number of faces? HOT 1
- Error
- Doesn't recognise face from photo so doesnt swap. HOT 1
- Unable to determine which face was not detected
- The localhost doesn't work normally. HOT 5
- Error and doesn't work HOT 2
- Crashing at extracting frames. HOT 1
- (question for a friend) press reface but nothing appears in terminal HOT 2
- "CUDAExecutioner" In terminal missing after I accidentally uninstalled onnxruntime HOT 1
- Add option to use codeformer? HOT 1
- Option to swap to all faces? HOT 2
- I don't know what caused it, please help determine.
- Limitation Of a Video File? HOT 2
- numpy.core._exceptions._ArrayMemoryError
- Insightface Issue
- Hello, dnt work on colab HOT 2
- Issue HOT 2
- Error when creating a video
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refacer.