cubiq / ComfyUI_IPAdapter_plus

GNU General Public License v3.0
3.91k stars 293 forks source link

IPAdapterFaceID: #525

Open djc831113 opened 5 months ago

djc831113 commented 5 months ago

Error occurred when executing IPAdapterFaceID:

expected np.ndarray (got NoneType)

File "F:\ComfyUI_windows\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 696, in apply_ipadapter work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, ipa_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI_windows\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 240, in ipadapter_execute face_cond_embeds.append(torch.from_numpy(face[0].normed_embedding).unsqueeze(0)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

llirikkcoder commented 2 months ago

I have the same error. is there any progress on this error?

matwin99 commented 2 months ago

same...

cubiq commented 2 months ago

I need to see the workflow, this should not happen if you have the latest version installed and get instead an error message saying that the face was not detected

matwin99 commented 2 months ago

Here is the error and workflow; submit-workflow.json

Error occurred when executing IPAdapterFaceID:

expected np.ndarray (got NoneType)

File "G:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 790, in apply_ipadapter work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, ipa_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "G:\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 320, in ipadapter_execute face_cond_embeds.append(torch.from_numpy(face[0].normed_embedding).unsqueeze(0)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

matwin99 commented 2 months ago

weirdly it seems to not show an error when swapping the example.png into it....

onsight365 commented 2 months ago

I have the same error!!!

!!! Exception during processing!!! expected np.ndarray (got NoneType) Traceback (most recent call last): File "E:\StabilityMatrix-win-x64\Data\Packages\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "E:\StabilityMatrix-win-x64\Data\Packages\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "E:\StabilityMatrix-win-x64\Data\Packages\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "E:\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 790, in apply_ipadapter work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, ipa_args) File "E:\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 320, in ipadapter_execute face_cond_embeds.append(torch.from_numpy(face[0].normed_embedding).unsqueeze(0)) TypeError: expected np.ndarray (got NoneType)

Prompt executed in 1.20 seconds

onsight365 commented 2 months ago

image

cubiq commented 2 months ago

the model wasn't probably able to find the face. it happens if the image is too small and with highly styled illustrations.

image

onsight365 commented 2 months ago

It should not be the image problem, I tried the image with no face, the error returned is “Error occurred when executing IPAdapterFaceID: InsightFace: No face detected.”

zoho-pic commented 1 month ago

same... Error occurred when executing IPAdapterFaceID:

expected np.ndarray (got NoneType)

File "F:\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 822, in apply_ipadapter work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, ipa_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ComfyUI\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus\IPAdapterPlus.py", line 344, in ipadapter_execute face_cond_embeds.append(torch.from_numpy(face[0].normed_embedding).unsqueeze(0))

cubiq commented 1 month ago

I cannot replicate, send me the reference image I'll try with that.

Also remember to UPGRADE comfyui

LEDExperiments commented 1 month ago

I have the same problem. I upgraded comfyui. I used via google drive.

This is my Log:

FETCH DATA from: /content/drive/MyDrive/AI/ComfyUI/custom_nodes/ComfyUI-Manager/extension-node-map.json [DONE]
got prompt
model weight dtype torch.float16, manual cast: None
model_type EPS
Using pytorch attention in VAE
Using pytorch attention in VAE
Model doesn't have a device attribute.
Model doesn't have a device attribute.
Model doesn't have a device attribute.
INFO: Clip Vision model loaded from /content/drive/MyDrive/AI/ComfyUI/models/clip_vision/CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors
/usr/local/lib/python3.10/dist-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
  return self.fget.__get__(instance, owner)()
INFO: IPAdapter model loaded from /content/drive/MyDrive/AI/ComfyUI/models/ipadapter/ip-adapter-faceid-plusv2_sd15.bin
INFO: LoRA model loaded from /content/drive/MyDrive/AI/ComfyUI/models/loras/ipadapter/ip-adapter-faceid-plusv2_sd15_lora.safetensors
A new version of Albumentations is available: 1.4.13 (you have 1.4.12). Upgrade using: pip install -U albumentations. To disable automatic update checks, set the environment variable NO_ALBUMENTATIONS_UPDATE to 1.
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: /content/drive/MyDrive/AI/ComfyUI/models/insightface/models/buffalo_l/1k3d68.onnx landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: /content/drive/MyDrive/AI/ComfyUI/models/insightface/models/buffalo_l/2d106det.onnx landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: /content/drive/MyDrive/AI/ComfyUI/models/insightface/models/buffalo_l/det_10g.onnx detection [1, 3, '?', '?'] 127.5 128.0
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: /content/drive/MyDrive/AI/ComfyUI/models/insightface/models/buffalo_l/genderage.onnx genderage ['None', 3, 96, 96] 0.0 1.0
set det-size: (640, 640)
INFO: InsightFace model loaded with CPU provider
/usr/local/lib/python3.10/dist-packages/insightface/utils/transform.py:68: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.
  P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4
!!! Exception during processing!!! expected np.ndarray (got NoneType)
Traceback (most recent call last):
  File "/content/drive/MyDrive/AI/ComfyUI/execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/content/drive/MyDrive/AI/ComfyUI/execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/content/drive/MyDrive/AI/ComfyUI/execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "/content/drive/MyDrive/AI/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/IPAdapterPlus.py", line 822, in apply_ipadapter
    work_model, face_image = ipadapter_execute(work_model, ipadapter_model, clip_vision, **ipa_args)
  File "/content/drive/MyDrive/AI/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus/IPAdapterPlus.py", line 344, in ipadapter_execute
    face_cond_embeds.append(torch.from_numpy(face[0].normed_embedding).unsqueeze(0))
TypeError: expected np.ndarray (got NoneType)

So question is: why has face[0].normed_embedding the value None?

I have looked into insight face and found the following for the property normed_embedding: Insightface repo which returns None, when self.embedding is None. So why is this None in the case of all the users in this thread?

I am not sure how this insightface works and how to debug this right. But found a some lines below the code fails are command: 2024-08-09 00_21_40-ComfyUI_IPAdapter_plus_IPAdapterPlus py at df8c78b6bfe8450bdeed1209dfb3f94c9c597 "# TODO: hacky but seems to be working" Maybe it does not work as expected? Can you please take a look at that line and let me know how to debug this further @cubiq . Thanks in advance!

alexcisija commented 4 days ago

I think that line face[0].normed_embedding is failing because the face embedding isn't being generated. You might be missing a few files. I would try downloading the buffalo_l model from here: https://github.com/deepinsight/insightface/releases

Extract that to a folder in ComfyUI/models/insightface/models/ so that you have the buffalo_l folder with the 5 onnx files sitting in it