Gourieff / comfyui-reactor-node

Fast and Simple Face Swap Extension Node for ComfyUI
GNU General Public License v3.0
1.09k stars 114 forks source link

CUDA not being used #283

Open trinityhades opened 2 months ago

trinityhades commented 2 months ago

First, confirm

What happened?

ReActor won't use my GPU/CUDA no matter what I try to do. It works great on FaceFusion, and A1111. But on comfyUI with this node, it never has worked for me

Steps to reproduce the problem

Default

Sysinfo

Windows 10, Brave Browser, RTX 3080

Relevant console log

N/A

Additional information

No response

Gourieff commented 2 months ago

Perhaps you have ORT installed (instead of ORT-GPU) inside your ComfyUI build Please provide pip list of installed libs inside the ComfyUI's python's enclosure

trinityhades commented 2 months ago
aiohttp                3.9.5
aiosignal              1.3.1
albumentations         1.4.4
annotated-types        0.6.0
async-timeout          4.0.3
attrs                  23.2.0
certifi                2024.2.2
charset-normalizer     3.3.2
colorama               0.4.6
coloredlogs            15.0.1
contourpy              1.2.1
cycler                 0.12.1
Cython                 3.0.10
easydict               1.13
einops                 0.7.0
filelock               3.13.3
flatbuffers            24.3.25
fonttools              4.51.0
frozenlist             1.4.1
fsspec                 2024.3.1
gitdb                  4.0.11
GitPython              3.1.43
huggingface-hub        0.22.2
humanfriendly          10.0
idna                   3.6
imageio                2.34.0
imageio-ffmpeg         0.4.9
insightface            0.7.3
intel-openmp           2021.4.0
Jinja2                 3.1.3
joblib                 1.4.0
kiwisolver             1.4.5
kornia                 0.7.2
kornia_rs              0.1.2
lazy_loader            0.4
MarkupSafe             2.1.5
matplotlib             3.8.4
mkl                    2021.4.0
mpmath                 1.3.0
multidict              6.0.5
networkx               3.2.1
numpy                  1.26.4
onnx                   1.16.0
onnxruntime            1.17.3
onnxruntime-gpu        1.17.1
opencv-python          4.9.0.80
opencv-python-headless 4.9.0.80
packaging              24.0
pandas                 2.2.2
piexif                 1.1.3
pillow                 10.3.0
pip                    24.0
prettytable            3.10.0
protobuf               5.26.1
psutil                 5.9.8
py-cpuinfo             9.0.0
pydantic               2.7.0
pydantic_core          2.18.1
pyparsing              3.1.2
pyreadline3            3.4.1
python-dateutil        2.9.0.post0
pytz                   2024.1
PyYAML                 6.0.1
regex                  2023.12.25
requests               2.31.0
requirements-parser    0.9.0
safetensors            0.4.3
scikit-image           0.23.1
scikit-learn           1.4.2
scipy                  1.13.0
seaborn                0.13.2
segment-anything       1.0
setuptools             69.2.0
six                    1.16.0
smmap                  5.0.1
sympy                  1.12
tbb                    2021.12.0
thop                   0.1.1.post2209072238
threadpoolctl          3.4.0
tifffile               2024.2.12
tokenizers             0.19.1
torch                  2.3.0+cu121
torchsde               0.2.6
torchvision            0.18.0+cu121
tqdm                   4.66.2
trampoline             0.1.2
transformers           4.40.1
types-setuptools       69.5.0.20240415
typing_extensions      4.10.0
tzdata                 2024.1
ultralytics            8.2.0
urllib3                2.2.1
wcwidth                0.2.13
wheel                  0.43.0
yarl                   1.9.4
Placidina commented 2 months ago

I have a same problem, GPU not used

pip list
Package                   Version
------------------------- --------------------
absl-py                   2.1.0
addict                    2.4.0
aiohttp                   3.9.3
aiosignal                 1.3.1
albumentations            1.4.3
antlr4-python3-runtime    4.9.3
anyio                     4.3.0
attrs                     23.2.0
certifi                   2024.2.2
cffi                      1.16.0
chardet                   5.2.0
charset-normalizer        3.3.2
coloredlogs               15.0.1
colorlog                  6.8.2
colour-science            0.4.4
contourpy                 1.2.1
cryptography              42.0.5
cssselect2                0.7.0
cycler                    0.12.1
Cython                    3.0.10
decorator                 4.4.2
Deprecated                1.2.14
diskcache                 5.6.3
distro                    1.9.0
easydict                  1.13
einops                    0.7.0
embreex                   2.17.7.post4
filelock                  3.13.3
flatbuffers               24.3.25
fonttools                 4.51.0
frozenlist                1.4.1
fsspec                    2024.3.1
ftfy                      6.2.0
future                    1.0.0
fvcore                    0.1.5.post20221221
gitdb                     4.0.11
GitPython                 3.1.43
grpcio                    1.62.2
h11                       0.14.0
httpcore                  1.0.5
httpx                     0.27.0
huggingface-hub           0.22.2
humanfriendly             10.0
idna                      3.6
imageio                   2.34.0
imageio-ffmpeg            0.4.9
importlib_metadata        7.1.0
insightface               0.7.3
iopath                    0.1.10
jax                       0.4.26
jaxlib                    0.4.26
Jinja2                    3.1.3
joblib                    1.4.0
jsonschema                4.21.1
jsonschema-specifications 2023.12.1
kiwisolver                1.4.5
kornia                    0.7.2
kornia_rs                 0.1.3
lazy_loader               0.4
llama_cpp_python          0.2.26+cu121
llvmlite                  0.42.0
lmdb                      1.4.1
lpips                     0.1.4
lxml                      5.2.1
mapbox-earcut             1.0.1
Markdown                  3.6
MarkupSafe                2.1.5
matplotlib                3.8.4
matrix-client             0.4.0
mediapipe                 0.10.11
ml-dtypes                 0.4.0
moviepy                   1.0.3
mpmath                    1.3.0
multidict                 6.0.5
networkx                  3.3
numba                     0.59.1
numpy                     1.26.4
nvidia-cublas-cu12        12.1.3.1
nvidia-cuda-cupti-cu12    12.1.105
nvidia-cuda-nvrtc-cu12    12.1.105
nvidia-cuda-runtime-cu12  12.1.105
nvidia-cudnn-cu12         8.9.2.26
nvidia-cufft-cu12         11.0.2.54
nvidia-curand-cu12        10.3.2.106
nvidia-cusolver-cu12      11.4.5.107
nvidia-cusparse-cu12      12.1.0.106
nvidia-nccl-cu12          2.19.3
nvidia-nvjitlink-cu12     12.4.127
nvidia-nvtx-cu12          12.1.105
omegaconf                 2.3.0
onnx                      1.16.0
onnxruntime               1.17.1
onnxruntime-gpu           1.17.1
opencv-contrib-python     4.9.0.80
opencv-python             4.9.0.80
opencv-python-headless    4.9.0.80
opt-einsum                3.3.0
packaging                 24.0
pandas                    2.2.2
piexif                    1.1.3
pillow                    10.3.0
pip                       24.0
pixeloe                   0.0.9
platformdirs              4.2.0
pooch                     1.8.1
portalocker               2.8.2
prettytable               3.10.0
proglog                   0.1.10
protobuf                  3.20.3
psutil                    5.9.8
py-cpuinfo                9.0.0
pycollada                 0.8
pycparser                 2.22
PyGithub                  2.3.0
PyJWT                     2.8.0
PyMatting                 1.1.12
PyNaCl                    1.5.0
pyparsing                 3.1.2
python-dateutil           2.9.0.post0
pytz                      2024.1
PyYAML                    6.0.1
referencing               0.34.0
regex                     2023.12.25
rembg                     2.0.56
reportlab                 4.1.0
requests                  2.31.0
rpds-py                   0.18.0
Rtree                     1.2.0
safetensors               0.4.2
scikit-build              0.17.6
scikit-image              0.22.0
scikit-learn              1.4.1.post1
scipy                     1.13.0
seaborn                   0.13.2
segment-anything          1.0
setuptools                65.5.0
shapely                   2.0.3
six                       1.16.0
smmap                     5.0.1
sniffio                   1.3.1
sounddevice               0.4.6
svg.path                  6.3
svglib                    1.5.1
sympy                     1.12
tabulate                  0.9.0
tb-nightly                2.17.0a20240423
tensorboard-data-server   0.7.2
termcolor                 2.4.0
thop                      0.1.1.post2209072238
threadpoolctl             3.4.0
tifffile                  2024.2.12
timm                      0.9.16
tinycss2                  1.2.1
tokenizers                0.15.2
tomli                     2.0.1
torch                     2.2.2
torchsde                  0.2.6
torchvision               0.17.2
tqdm                      4.66.2
trampoline                0.1.2
transformers              4.39.3
trimesh                   4.2.4
triton                    2.2.0
typing                    3.7.4.3
typing_extensions         4.11.0
tzdata                    2024.1
ultralytics               8.1.47
urllib3                   1.26.18
vhacdx                    0.0.6
wcwidth                   0.2.13
webencodings              0.5.1
Werkzeug                  3.0.2
wheel                     0.43.0
wrapt                     1.16.0
xatlas                    0.0.9
xxhash                    3.4.1
yacs                      0.1.8
yapf                      0.40.2
yarl                      1.9.4
zipp                      3.18.1
** ComfyUI startup time: 2024-04-24 20:01:55.399109
** Platform: Linux
** Python version: 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801]
** Python executable: ***
** Log path: ***

Total VRAM 12029 MB, total RAM 31912 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3060 : cudaMallocAsync
VAE dtype: torch.bfloat16
Using pytorch cross attention
### Loading: ComfyUI-Manager (V2.22.1)
### ComfyUI Revision: 2143 [27d5808f] | Released on '2024-04-23'
------------------------------------------
### N-Suite Revision: dbeb9ae9 
Current version of packaging: 24.0
Version of cpuinfo: Not found
Current version of git: 3.1.43
Current version of moviepy: 1.0.3
Current version of cv2: 4.9.0
Current version of skbuild: 0.17.6
Version of typing: Not found
Current version of diskcache: 5.6.3
Current version of llama_cpp: 0.2.26+cu121
Current version of timm: 0.9.16
[ReActor] - STATUS - Running v0.5.0-a1 in ComfyUI
Torch version: 2.2.2+cu121

ArchLinux 6.8.7-arch1-1

Gourieff commented 2 months ago

onnxruntime 1.17.3 onnxruntime-gpu 1.17.1

You should uninstall both versions and install only one - onnxruntime-gpu if you want to use CUDA

Gourieff commented 2 months ago

ReActor uses GPU (if CUDA is available and ORT-GPU is installed properly) when swapping and restoring faces and CPU when analyzing faces - in other cases it uses CPU only for all of tasks

jax-explorer commented 2 months ago

Is it possible to use the GPU when analyzing the face as well, currently the slower step is analyzing the face

Gourieff commented 2 months ago

Is it possible to use the GPU when analyzing the face as well, currently the slower step is analyzing the face

It's gonna be solved in future updates

jax-explorer commented 2 months ago

That's really nice, we can discuss it together, because I'm using that feature in my project as well, but so far it looks like there's some wasted GPU, I can come and submit a PR if needed.

derspanier1 commented 1 month ago

onnxruntime 1.17.3 onnxruntime-gpu 1.17.1

You should uninstall both versions and install only one - onnxruntime-gpu if you want to use CUDA

First of all, thank you for this amazing node, i have the same issue that my GPU is not being used and pip list shows both onnxruntime and onnxruntime_gpu being installed.

i really have no clue how to uninstall and then only reinstall onnxruntime_gpu, so i kindly ask if you could point me in the right direction.

have a nice day. Chris

calonye commented 2 weeks ago

如果大家用这个插件,发现很慢时,检查以下是否有在用GPU,可能正在用CPU ,所以,按以下步骤尝试,大概步骤就是,卸载插件依赖的onnxruntime onnxruntime-gpu卸载,然后重新安装onnxruntime-gpu,通常来说就可以正常调用了。我测试了,可以解决问题。

  1. pip list
  2. pip uninstall onnxruntime 以及 pip uninstall onnxruntime-gpu
  3. pip install onnxruntime-gpu

以上步骤大概意思就是,检查你现在装的依赖版本,然后都卸载,再重新安装仅GPU 版本,重启启动 enjoy~~