Git Product home page Git Product logo

Comments (16)

azoksky avatar azoksky commented on August 19, 2024

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.

nlienard avatar nlienard commented on August 19, 2024

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.

azoksky avatar azoksky commented on August 19, 2024

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.

nlienard avatar nlienard commented on August 19, 2024

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.

nlienard avatar nlienard commented on August 19, 2024

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.

azoksky avatar azoksky commented on August 19, 2024

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

243660723-b4cc4dca-61cf-4606-a781-1ade36c2ff01 (1)

from refacer.

nlienard avatar nlienard commented on August 19, 2024

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.

image

What am I missing ?

from refacer.

azoksky avatar azoksky commented on August 19, 2024

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.
Screenshot 2023-06-24 172409

from refacer.

nlienard avatar nlienard commented on August 19, 2024

Same result:

image

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.

nlienard avatar nlienard commented on August 19, 2024

Ok i did a mistake, i m redoing it properly:

image

Still same issue

from refacer.

azoksky avatar azoksky commented on August 19, 2024

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.

nlienard avatar nlienard commented on August 19, 2024

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

image

image

from refacer.

nlienard avatar nlienard commented on August 19, 2024

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;

image

from refacer.

azoksky avatar azoksky commented on August 19, 2024

This is the exact setup I have and it works flawlessly.

from refacer.

nlienard avatar nlienard commented on August 19, 2024

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.

azoksky avatar azoksky commented on August 19, 2024

Okay good for you.. mine works right out of the box.. without having to install torch..

from refacer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.