ComfyUI_InstantID icon indicating copy to clipboard operation
ComfyUI_InstantID copied to clipboard

Bypassing ApplyInstantID Node Can Ruin Conditioning

Open Mithrillion opened this issue 1 year ago • 8 comments

Issue screenshot: Using a slightly modified default workflow, we can show that bypassing ApplyInstantID node does not maintain the original behaviour but rather degrades the quality of conditioning. image

Expected behaviour: bypassing a node should have zero effect on the original workflow.

InstantID version: 5149a21

Mithrillion avatar Feb 25 '24 10:02 Mithrillion

this seems to be a bug with comfyui, I'll check better

cubiq avatar Feb 26 '24 14:02 cubiq

had the same issue, and updated InstantID, and now all my workflows with InstantID in them don't work. I hope the developer brings back the old node. Also not only this problem with bypassing, but I found if we have multiple IPAdapters, and put the InstantID weight at 0, it is different than disconnecting the model node from InstantID and running it after it, basically manual bypassing it!

zhoobin021 avatar Feb 26 '24 18:02 zhoobin021

can confirm the new update with the old (legacy) node is fixed, but still a problem with the new one!

workflow (1)

workflow (2)

image png files have workflow included.

zhoobin021 avatar Feb 26 '24 22:02 zhoobin021

~~This can happen if a node mutates something from input in python instead of copying the input first before mutating.~~

While the above is true, the bug mentioned here happens even if you start with the node bypassed, so it's not that. I'm thinking it's because the node has multiple outputs.

However it doesn't seem very straight forward to solve which inputs correspond to which outputs when bypassed apart from getting a hint at with return names.

CapsAdmin avatar Feb 27 '24 00:02 CapsAdmin

From my testing, what happens when you disable applyinstantid in this case is that the positive prompt also becomes the negative prompt. (You can test this by copy pasting the positive prompt in the negative prompt)

This is an issue in comfyui's frontend graphToPrompt function that turns the graph into json that the backend can understand.

CapsAdmin avatar Feb 27 '24 01:02 CapsAdmin

This was indeed the bug, in this specific case, for each ksampler input it finds the node which it's connected to, in this case the disabled instantid and walks through its inputs.

for model it walks through the inputs and finds the first model type for positive it walks through the inputs and finds the first conditioning type for negative it walks through the inputs and finds the first conditioning type

so given this logic, the negative input of ksampler will always be the positive of instantid because it matches the first type

The proposed solution that follows the same logic would be to track consumed inputs and skip connecting to the same input more than once. This solution sort of assumes the order of input is the same.

Matching by name may be a another option, but not all nodes have matching names either.

CapsAdmin avatar Feb 27 '24 01:02 CapsAdmin

for now, we can use a switch node to manually bypass it, until it gets fixed.

image

zhoobin021 avatar Feb 27 '24 15:02 zhoobin021

From my testing, what happens when you disable applying istantid, in this case, is that the positive prompt also becomes the negative prompt. (You can test this by copy-pasting the positive prompt in the negative prompt)

This is an issue in comfyui's frontend graphToPrompt function that turns the graph into json that the backend can understand.

does this have to do anything with SDXL using 2 clip models CLIP_g & CLIP_l ? I know this might be a noob assumption but isn't it how sdxl merges the 2 prompts? and InstantID works with sdxl and this might be that when bypassing the node, it merges them(both positive and negating) into a single positive.

image image from : https://youtu.be/Wk88rK9Zh1Y?t=174

zhoobin021 avatar Feb 27 '24 15:02 zhoobin021