ComfyUI-InstantID icon indicating copy to clipboard operation
ComfyUI-InstantID copied to clipboard

Return type mismatch between linked nodes: insightface, INSIGHTFACE != INSIGHTFACEMODEL

Open HaydenReeve opened this issue 1 year ago • 17 comments

No errors or warnings during boot, all requirements satisfied and present.

Workflow doesn't even attempt to start. Hits the INSIGHTFACE loader and stops.

ERROR:root:Failed to validate prompt for output 12:
ERROR:root:* IDGenerationNode 15:
ERROR:root:  - Return type mismatch between linked nodes: insightface, INSIGHTFACE != INSIGHTFACEMODEL
ERROR:root:Output will be ignored
invalid prompt: {'type': 'prompt_outputs_failed_validation', 'message': 'Prompt outputs failed validation', 'details': '', 'extra_info': {}}

HaydenReeve avatar Jan 24 '24 11:01 HaydenReeve

Not going to pretend I know what I'm doing, but in making the following changes I managed to progress to the next error at least.

diff --git a/InstantIDNode.py b/InstantIDNode.py
index 88d0684..4ec1876 100644
--- a/InstantIDNode.py
+++ b/InstantIDNode.py
@@ -62,7 +62,7 @@ class InsightFaceLoader_Node_Zho:
             },
         }

-    RETURN_TYPES = ("INSIGHTFACEMODEL",)
+    RETURN_TYPES = ("INSIGHTFACE",)
     FUNCTION = "load_insight_face_antelopev2"
     CATEGORY = "📷InstantID"

@@ -228,7 +228,7 @@ class IDGenerationNode_Zho:
             "required": {
                 "face_image": ("IMAGE",),
                 "pipe": ("MODEL",),
-                "insightface": ("INSIGHTFACEMODEL",),
+                "insightface": ("INSIGHTFACE",),
:
diff --git a/InstantIDNode.py b/InstantIDNode.py
index 88d0684..4ec1876 100644
--- a/InstantIDNode.py
+++ b/InstantIDNode.py
@@ -62,7 +62,7 @@ class InsightFaceLoader_Node_Zho:
             },
         }

-    RETURN_TYPES = ("INSIGHTFACEMODEL",)
+    RETURN_TYPES = ("INSIGHTFACE",)
     FUNCTION = "load_insight_face_antelopev2"
     CATEGORY = "📷InstantID"

@@ -228,7 +228,7 @@ class IDGenerationNode_Zho:
             "required": {
                 "face_image": ("IMAGE",),
                 "pipe": ("MODEL",),
-                "insightface": ("INSIGHTFACEMODEL",),
+                "insightface": ("INSIGHTFACE",),

HaydenReeve avatar Jan 24 '24 11:01 HaydenReeve

Also recommend adding

@@ -186,6 +186,9 @@ class Ipadapter_instantidLoader_Node_Zho:
     def load_ip_adapter_instantid(self, pipe, Ipadapter_instantid_path, filename):
         # 使用hf_hub_download方法获取PhotoMaker文件的路径
         face_adapter = os.path.join(Ipadapter_instantid_path, filename)
+        
+        if not os.path.exists(face_adapter):
+            raise FileNotFoundError(f"Cannot find '{face_adapter}' as it does not exist.")

         # load adapter
         pipe.load_ip_adapter_instantid(face_adapter)

As I realised the paths here are quite confusing

HaydenReeve avatar Jan 24 '24 12:01 HaydenReeve

Is this the result of having IPAdapter installed? because the insightface loader node conflicts with the InstantID insightface loader node? perhaps giving it a different naming scheme?

EDIT: I uninstalled IPAdapter to see if that was the case, I had to rename .json after that, had to redownload all the antelopev2 files, now trying to solve why it says CUDA isn't loaded, but it works on my cpu I am pretty sure it is the IPAdapter conflict for this particular error unfortunately... hopefully we get an update that fixes this conflict

Starzilla29 avatar Jan 24 '24 15:01 Starzilla29

Same

cerarslan avatar Jan 24 '24 16:01 cerarslan

Same as well, thanks for resolving (won't work otherwise)

CaptainGrock avatar Jan 24 '24 23:01 CaptainGrock

Getting these same errors. Hopefully, someone will get a working InstantID soon.

camoody1 avatar Jan 24 '24 23:01 camoody1

Is this the result of having IPAdapter installed? because the insightface loader node conflicts with the InstantID insightface loader node? perhaps giving it a different naming scheme?

EDIT: I uninstalled IPAdapter to see if that was the case, I had to rename .json after that, had to redownload all the antelopev2 files, now trying to solve why it says CUDA isn't loaded, but it works on my cpu I am pretty sure it is the IPAdapter conflict for this particular error unfortunately... hopefully we get an update that fixes this conflict

That would check out.

If anybody wants to avoid uninstalling the default IPAdapter you can make the changes here instead:

https://github.com/ZHO-ZHO-ZHO/ComfyUI-InstantID/issues/27#issuecomment-1907979128

I'll get around to making a pull request at some point...

HaydenReeve avatar Jan 25 '24 03:01 HaydenReeve

@HaydenReeve In which file should I make these changes? And can I make the changes using Notepad++?

camoody1 avatar Jan 25 '24 03:01 camoody1

InstantIDNode.py and yes.

The red is what it looked like before the change, the green is what it looks like after the change.

HaydenReeve avatar Jan 25 '24 04:01 HaydenReeve

@HaydenReeve I made the second change you suggested regarding the face_adapter path error. I didn't make the first set of Insightface changes because I don't see those lines in the InstantIDNode.py file.

I am now getting this error message:

got prompt ERROR:root:!!! Exception during processing !!! ERROR:root:Traceback (most recent call last): File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 155, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 85, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 78, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-InstantID\InstantIDNode.py", line 194, in load_ip_adapter_instantid pipe.load_ip_adapter_instantid(face_adapter) File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-InstantID\pipeline_stable_diffusion_xl_instantid.py", line 156, in load_ip_adapter_instantid self.set_image_proj_model(model_ckpt, image_emb_dim, num_tokens) File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-InstantID\pipeline_stable_diffusion_xl_instantid.py", line 174, in set_image_proj_model self.image_proj_model = image_proj_model.to(self.device, dtype=self.dtype) ^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\diffusers\configuration_utils.py", line 137, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'StableDiffusionXLInstantIDPipeline' object has no attribute 'dtype'

Prompt executed in 36.00 seconds

camoody1 avatar Jan 25 '24 04:01 camoody1

You're now looking at the issue described in #5

I don't have a solution for this yet.

HaydenReeve avatar Jan 25 '24 04:01 HaydenReeve

@HaydenReeve Here's another InstantID GitHub project that looks like it was forked from here. It doesn't even have the file that you had me modify. Sadly, I get the same error message with it, too. 🤷🏼‍♂️

https://github.com/huxiuhan/ComfyUI-InstantID

The author of that project suggested that I not use the portable installation of Comfy. Much like the person suggested in Issue #5. But I'm not going to switch to a Linux installation. That's just not my cup of tea, unfortunately.

camoody1 avatar Jan 25 '24 05:01 camoody1

You don't need a linux installation.

Just clone the main comfy repo, install the python prereqs on your system, and then run using an editor such as Jetbrains Fleet or VSCode which can execute the launch command.

The repo you linked was actually the first one I tried. Didn't work for me either.

HaydenReeve avatar Jan 25 '24 05:01 HaydenReeve

@HaydenReeve I made the second change you suggested regarding the face_adapter path error. I didn't make the first set of Insightface changes because I don't see those lines in the InstantIDNode.py file.

I am now getting this error message:

got prompt ERROR:root:!!! Exception during processing !!! ERROR:root:Traceback (most recent call last): File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 155, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 85, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\execution.py", line 78, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-InstantID\InstantIDNode.py", line 194, in load_ip_adapter_instantid pipe.load_ip_adapter_instantid(face_adapter) File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-InstantID\pipeline_stable_diffusion_xl_instantid.py", line 156, in load_ip_adapter_instantid self.set_image_proj_model(model_ckpt, image_emb_dim, num_tokens) File "H:\ComfyUI\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-InstantID\pipeline_stable_diffusion_xl_instantid.py", line 174, in set_image_proj_model self.image_proj_model = image_proj_model.to(self.device, dtype=self.dtype) ^^^^^^^^^^ File "H:\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\diffusers\configuration_utils.py", line 137, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'StableDiffusionXLInstantIDPipeline' object has no attribute 'dtype'

Prompt executed in 36.00 seconds

Just pip install -U -r requeriments.txt from inside custom_nodes/ComfyUI-InstantID.

pauloalves86 avatar Jan 25 '24 18:01 pauloalves86

hi, are you using v1 workflow? try use v2 workflow.

yueziii avatar Feb 05 '24 02:02 yueziii

Hi - I figured this out but unfortunately it seems that my 12GB vram card can't support this workflow (maxed out and ridiculously slow). Unless you have a more efficient method, unfortunately I'll have to wait until I get a stronger video card. Thanks so much for your help.

On Sun, Feb 4, 2024 at 9:40 PM yueziii @.***> wrote:

hi, are you using v1 workflow? try use v2 workflow.

— Reply to this email directly, view it on GitHub https://github.com/ZHO-ZHO-ZHO/ComfyUI-InstantID/issues/27#issuecomment-1926126090, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB7RBRTARKQF36DTKLWFHYTYSBBB7AVCNFSM6AAAAABCITH25KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRWGEZDMMBZGA . You are receiving this because you commented.Message ID: @.***>

CaptainGrock avatar Feb 05 '24 02:02 CaptainGrock

InstantIDNode.py and yes.

The red is what it looked like before the change, the green is what it looks like after the change.

Hi, when I make those changes and reload ComfyUI, it is showing all the InstantID nodes in red as if they are missing. If I then install missing nodes, it reverts the changes. Am I supposed to change something else other than changing "INSIGHTFACEMODEL" to "INSIGHTFACE"?

waltm avatar Feb 10 '24 02:02 waltm