Code Monkey home page Code Monkey logo

Error occurred when executing ReActorFaceSwap: Input type (torch.FloatTensor) and weight type (PrivateUse1FloatType) should be the same or input should be a MKLDNN tensor and weight is a dense tensor about comfyui-reactor-node HOT 7 CLOSED

gourieff avatar gourieff commented on August 20, 2024
Error occurred when executing ReActorFaceSwap: Input type (torch.FloatTensor) and weight type (PrivateUse1FloatType) should be the same or input should be a MKLDNN tensor and weight is a dense tensor

from comfyui-reactor-node.

Comments (7)

Gourieff avatar Gourieff commented on August 20, 2024

onnxruntime 1.16.1
onnxruntime-directml 1.16.0
onnxruntime-gpu 1.15.1

Only one version of ORT must be installed in one environment
ReActor works with onnxruntime
You have to uninstall onnxruntime-directml and onnxruntime-gpu and reinstall onnxruntime
Perhaps, you have other nodes that can reinstall ORT-GPU or ORT-directm back...
Too many nodes you have... 😣 With such amount of nodes you need to edit their requirements to be equal with some packages and versions
To make things right in this case you need (from the root directory):

  1. python_embeded\python.exe -m pip uninstall -y onnxruntime onnxruntime-gpu onnxruntime-directml
  2. python_embeded\python.exe -m pip install onnxruntime

opencv-contrib-python 4.8.0.74
opencv-python 4.8.0.76
opencv-python-headless 4.7.0.72

Almost the same here
It's not right to have these libs with different versions, they must be equal or ideally only one opencv
4.7.0.72 - good variant

And about torch-directml 0.2.0.dev230426 #40 (comment)

from comfyui-reactor-node.

lord-lethris avatar lord-lethris commented on August 20, 2024

Unfortunately I have an AMD based machine - so I need directml. I cannot run just onnxruntime

from comfyui-reactor-node.

Gourieff avatar Gourieff commented on August 20, 2024

Unfortunately I have an AMD based machine - so I need directml. I cannot run just onnxruntime

Why not? ORT works with every platform, it uses CPUExecutionProvider

And as I said above, you have 3 versions of ORT installed at the same time - it's not right. ORT won't be able to work properly. Only one version must be installed.

from comfyui-reactor-node.

lord-lethris avatar lord-lethris commented on August 20, 2024

torch-directml gives me the speed of my GPU and utilises the VRam better. This is the recommended install by Comfyui for AMD based machines. And it really does make a difference - I've tested it.

What I don't understand (and this isn't your fault) is why Pytorch isn't using ROCm for windows. ROCm is up to 5.7.1 on Windows, but Pytorch simply doesn't use it - only the Linux version.

This would solve everything.

image

from comfyui-reactor-node.

lord-lethris avatar lord-lethris commented on August 20, 2024

Right - I did what you suggested, and collated all the nodes "requirement" into one file - removed all the old ones and just installed the nessasery requirements making sure there are no multiple versions.

I sill had to install torch-directml because ComfyUI simply does not work without it. Yes I tried onnxruntime CPU only and it does not work.

I still get the same errors as above.

As a note, I removed all onnxruntime and onnx, but when I installed torch-directml (as its an AMD requirement) it installed :

onnx                         1.15.0
onnxruntime                  1.16.1
onnxruntime-directml         1.16.1

As dependencies. So yeaaaa, 3 Onnx runtimes.

Pip list:

PS C:\Users\lethris> pip list
WARNING: Ignoring invalid distribution -rotobuf (d:\apps\python\python310\lib\site-packages)
Package                      Version
---------------------------- ------------------
absl-py                      1.4.0
accelerate                   0.24.1
addict                       2.4.0
aiofiles                     23.2.1
aiohttp                      3.8.6
aiosignal                    1.3.1
albumentations               1.3.1
aliyun-python-sdk-core       2.13.36
aliyun-python-sdk-kms        2.16.1
altair                       5.1.1
annotated-types              0.5.0
antlr4-python3-runtime       4.9.3
anyio                        3.7.1
asgiref                      3.7.2
astunparse                   1.6.3
async-timeout                4.0.2
asyncer                      0.0.2
attrs                        23.1.0
basicsr                      1.4.2
beautifulsoup4               4.12.2
boltons                      23.0.0
boto3                        1.28.44
botocore                     1.31.44
cachetools                   5.3.1
certifi                      2023.7.22
cffi                         1.15.1
chardet                      3.0.4
charset-normalizer           3.2.0
click                        8.1.6
cmake                        3.27.7
colorama                     0.4.6
coloredlogs                  15.0.1
compel                       2.0.2
contourpy                    1.1.0
controlnet-aux               0.0.7
crcmod                       1.7
cryptography                 41.0.3
cssselect2                   0.7.0
cstr                         0.1.0
cycler                       0.11.0
Cython                       3.0.5
deep-translator              1.11.4
diffusers                    0.22.0.dev0
Django                       4.2.4
dynamicprompts               0.29.0
easydict                     1.10
einops                       0.7.0
exceptiongroup               1.1.3
facexlib                     0.3.0
fairscale                    0.4.13
fastapi                      0.103.1
ffmpeg                       1.4
ffmpy                        0.3.0
filelock                     3.13.1
filetype                     1.2.0
filterpy                     1.4.5
flatbuffers                  23.5.26
fonttools                    4.42.0
frozenlist                   1.4.0
fsspec                       2023.6.0
ftfy                         6.1.1
future                       0.18.3
fvcore                       0.1.5.post20221221
gast                         0.4.0
gdown                        4.7.1
gfpgan                       1.3.8
gitdb                        4.0.10
GitPython                    3.1.40
google-auth                  2.22.0
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
googletrans                  3.1.0a0
gradio                       3.42.0
gradio_client                0.5.0
grpcio                       1.56.2
h11                          0.9.0
h2                           3.2.0
h5py                         3.9.0
hpack                        3.0.0
hstspreload                  2023.1.1
httpcore                     0.9.1
httpx                        0.13.3
huggingface-hub              0.17.3
humanfriendly                10.0
hyperframe                   5.2.0
idna                         2.10
image                        1.5.33
imageio                      2.31.6
imageio-ffmpeg               0.4.9
img2texture                  1.0.6
importlib-metadata           6.8.0
importlib-resources          6.0.1
insightface                  0.7.3
iopath                       0.1.10
Jinja2                       3.1.2
jmespath                     0.10.0
joblib                       1.3.2
jsonschema                   4.19.0
jsonschema-specifications    2023.7.1
keras                        2.10.0
Keras-Preprocessing          1.1.2
kiwisolver                   1.4.4
lark                         1.1.7
lazy_loader                  0.3
libclang                     16.0.6
llvmlite                     0.41.1
lmdb                         1.4.1
lxml                         4.9.3
Markdown                     3.4.4
markdown-it-py               3.0.0
MarkupSafe                   2.1.3
matplotlib                   3.8.0
mdurl                        0.1.2
mediapipe                    0.10.7
mmcv                         2.0.0
mmdet                        3.0.0
mmengine                     0.7.4
model-index                  0.1.11
mpmath                       1.3.0
multidict                    6.0.4
networkx                     3.1
numba                        0.58.1
numexpr                      2.8.7
numpy                        1.26.1
oauthlib                     3.2.2
omegaconf                    2.3.0
onnx                         1.15.0
onnxruntime                  1.16.1
onnxruntime-directml         1.16.1
openai                       0.27.8
opencv-contrib-python        4.8.1.78
opencv-python                4.8.1.78
opendatalab                  0.0.9
openmim                      0.3.9
openxlab                     0.0.17
opt-einsum                   3.3.0
ordered-set                  4.1.0
orjson                       3.9.5
oss2                         2.17.0
packaging                    23.1
pandas                       2.1.2
piexif                       1.1.3
pilgram                      1.2.1
Pillow                       9.5.0
pip                          23.2.1
platformdirs                 3.10.0
pooch                        1.7.0
portalocker                  2.7.0
prettytable                  3.6.0
protobuf                     3.20.3
psutil                       5.9.6
py-cpuinfo                   9.0.0
pyasn1                       0.5.0
pyasn1-modules               0.3.0
pycocoevalcap                1.2
pycocotools                  2.0.6
pycparser                    2.21
pycryptodome                 3.18.0
pydantic                     2.3.0
pydantic_core                2.6.3
pydub                        0.25.1
pygit2                       1.12.2
Pygments                     2.15.1
PyMatting                    1.1.8
pyparsing                    3.0.9
pypng                        0.20220715.0
pyreadline3                  3.4.1
PySocks                      1.7.1
python-dateutil              2.8.2
python-multipart             0.0.6
pytz                         2023.3
PyWavelets                   1.4.1
pywin32                      306
PyYAML                       6.0.1
pyzbar                       0.1.9
qrcode                       7.4.2
qudida                       0.0.4
referencing                  0.30.2
regex                        2023.6.3
rembg                        2.0.52
reportlab                    4.0.4
requests                     2.28.2
requests-oauthlib            1.3.1
requirements-parser          0.5.0
rfc3986                      1.5.0
rich                         13.6.0
rich-argparse                1.4.0
rpds-py                      0.10.2
rsa                          4.9
s3transfer                   0.6.2
safetensors                  0.4.0
scikit-image                 0.22.0
scikit-learn                 1.3.2
scipy                        1.11.3
seaborn                      0.12.2
segment-anything             1.0
semantic-version             2.10.0
setuptools                   60.2.0
shapely                      2.0.1
simpleeval                   0.9.13
simplejson                   3.19.1
six                          1.16.0
smmap                        5.0.0
sniffio                      1.3.0
sounddevice                  0.4.6
soupsieve                    2.4.1
sqlparse                     0.4.4
starlette                    0.27.0
svglib                       1.5.1
sympy                        1.12
tabulate                     0.9.0
tb-nightly                   2.12.0a20230126
tensorboard                  2.10.1
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.10.1
tensorflow-cpu               2.10.0
tensorflow-directml-plugin   0.4.0.dev230202
tensorflow-estimator         2.10.0
tensorflow_intel             2.10.0
tensorflow-io-gcs-filesystem 0.31.0
termcolor                    2.3.0
terminaltables               3.1.10
threadpoolctl                3.2.0
tifffile                     2023.7.18
timm                         0.9.8
tinycss2                     1.2.1
tokenizers                   0.14.1
tomli                        2.0.1
toolz                        0.12.0
torch                        2.0.0
torch-directml               0.2.0.dev230426
torchaudio                   2.0.0
torchsde                     0.2.6
torchvision                  0.15.1
tqdm                         4.66.1
trampoline                   0.1.2
transformers                 4.34.1
types-setuptools             68.1.0.0
typing_extensions            4.7.1
tzdata                       2023.3
ultralytics                  8.0.147
urllib3                      1.26.16
uvicorn                      0.23.2
watchdog                     3.0.0
wcwidth                      0.2.6
webencodings                 0.5.1
websockets                   11.0.3
Werkzeug                     2.3.6
wheel                        0.41.2
wrapt                        1.15.0
yacs                         0.1.8
yapf                         0.40.2
yarl                         1.9.2
zipp                         3.16.2

from comfyui-reactor-node.

lord-lethris avatar lord-lethris commented on August 20, 2024

After much playing about. it ONLY works for me with this Specific Condition:

image

No other "swap_models" or "face_restore_models" will work.

I am happy to use this for now, as it it somewhat better than it was before :)

Edit:

Spoke to soon - It's stopped working again :(
Nothing has changed. No installs, no configs, nothing. it just stopped working.

Error occurred when executing ReActorFaceSwap:

Input type (torch.FloatTensor) and weight type (PrivateUse1FloatType) should be the same or input should be a MKLDNN tensor and weight is a dense tensor
15:56:37 - ReActor Node - STATUS - Working: source face index [0], target face index [0]
15:56:37 - ReActor Node - INFO - Source Image MD5 Hash = add6bcd76dfbbd4449e32bb7c008b34d
15:56:37 - ReActor Node - INFO - Source Image the Same? True
15:56:37 - ReActor Node - STATUS - Using Ready Source Face(s) Model...
15:56:37 - ReActor Node - INFO - Target Image MD5 Hash = 8a153c904aee6ddef74c8be34540a371
15:56:37 - ReActor Node - INFO - Target Image the Same? True
15:56:37 - ReActor Node - STATUS - Using Ready Target Face(s) Model...
15:56:37 - ReActor Node - STATUS - Source Face 0: Detected Gender -F-
15:56:37 - ReActor Node - STATUS - OK - Detected Gender matches Condition
15:56:37 - ReActor Node - STATUS - Target Face 0: Detected Gender -F-
15:56:37 - ReActor Node - STATUS - OK - Detected Gender matches Condition
ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
  File "D:\apps\SD-WebUI\ComfyUI\execution.py", line 153, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "D:\apps\SD-WebUI\ComfyUI\execution.py", line 83, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "D:\apps\SD-WebUI\ComfyUI\execution.py", line 76, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "D:\apps\SD-WebUI\ComfyUI\custom_nodes\comfyui-reactor-node\nodes.py", line 134, in execute
    self.face_helper.get_face_landmarks_5(only_center_face=False, resize=640, eye_dist_threshold=5)
  File "E:\ASSETS\AI-TOOLS\COMFY-DATA\custom_nodes\comfyui-reactor-node\r_facelib\utils\face_restoration_helper.py", line 151, in get_face_landmarks_5
    bboxes = self.face_det.detect_faces(input_img)
  File "E:\ASSETS\AI-TOOLS\COMFY-DATA\custom_nodes\comfyui-reactor-node\r_facelib\detection\retinaface\retinaface.py", line 215, in detect_faces
    loc, conf, landmarks, priors = self.__detect_faces(image)
  File "E:\ASSETS\AI-TOOLS\COMFY-DATA\custom_nodes\comfyui-reactor-node\r_facelib\detection\retinaface\retinaface.py", line 162, in __detect_faces
    loc, conf, landmarks = self(inputs)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "E:\ASSETS\AI-TOOLS\COMFY-DATA\custom_nodes\comfyui-reactor-node\r_facelib\detection\retinaface\retinaface.py", line 127, in forward
    out = self.body(inputs)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\apps\Python\Python310\lib\site-packages\torchvision\models\_utils.py", line 69, in forward
    x = module(x)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\container.py", line 217, in forward
    input = module(input)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\container.py", line 217, in forward
    input = module(input)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "D:\apps\Python\Python310\lib\site-packages\torch\nn\modules\conv.py", line 459, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.FloatTensor) and weight type (PrivateUse1FloatType) should be the same or input should be a MKLDNN tensor and weight is a dense tensor

from comfyui-reactor-node.

Gourieff avatar Gourieff commented on August 20, 2024

Should work now
f3b01a4

from comfyui-reactor-node.

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.