ZHO-ZHO-ZHO / ComfyUI-InstantID

Unofficial implementation of InstantID for ComfyUI
1.22k stars 67 forks source link

fix: controlnet_conditioning_scale must be type float #124

Open time-river opened 3 months ago

time-river commented 3 months ago

In high diffusers version, two new arguments ip_adapter_image, ip_adapter_image_embeds are added in check_inputs func, which results error:

Error occurred when executing IDGenerationNode:

For single controlnet: controlnet_conditioning_scale must be type float.

File "/home/dan/ComfyUI/execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/home/dan/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 "/home/dan/ComfyUI/execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/home/dan/ComfyUI/custom_nodes/ComfyUI-InstantID/InstantIDNode.py", line 291, in id_generate_image
output = pipe(
File "/home/dan/anaconda3/envs/ollama/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/dan/ComfyUI/custom_nodes/ComfyUI-InstantID/pipeline_stable_diffusion_xl_instantid.py", line 439, in call
self.check_inputs(
File "/home/dan/anaconda3/envs/ollama/lib/python3.10/site-packages/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py", line 684, in check_inputs
raise TypeError("For single controlnet: controlnet_conditioning_scale must be type float.")

Here fix the above problem.

related issue: https://github.com/ZHO-ZHO-ZHO/ComfyUI-InstantID/issues/121

Mahinandaa commented 3 months ago

which version of Diffusers solved your problem? or Could you explain how to reslove

time-river commented 3 months ago

which version of Diffusers solved your problem? or Could you explain how to reslove

Maybe the latest. I don't notice it. How to solve: it's simple, find the calltrace code, you can check it here

yangyang0507 commented 3 months ago

Very nice, you solved my problem

afd2046 commented 3 months ago

哪个版本的扩散器解决了您的问题?或者你能解释一下如何重新爱上吗?

也许是最新的。我没有注意到它。怎么解决:很简单,找到回溯码,可以在这里查看

看不懂怎么解决,是需要修改哪个文件的代码吗?是否有文件下载直接替换呢?链接下载文件为“pipeline_controlnet_sd_xl.py”。它是干嘛的? I don't understand how to solve it. Is it necessary to modify the code of which file? Is there a file that can be downloaded and replaced directly? The download file for the link is "pipeline_controlnet_sd_xl. py". What is it for?

Mahinandaa commented 3 months ago

which version of Diffusers solved your problem? or Could you explain how to reslove

Maybe the latest. I don't notice it. How to solve: it's simple, find the calltrace code, you can check it here

Please, i didn't understand what to change in code. can you explain what to change

niddhishp commented 3 months ago

which version of Diffusers solved your problem? or Could you explain how to reslove

Maybe the latest. I don't notice it. How to solve: it's simple, find the calltrace code, you can check it here

Could you please elaborate? should "pipeline_controlnet_sd_xl. py" be modified? if yes which lines should be modified to what? i downloaded the entire code and replaced it. but it still didn't resolve the problem. am getting the same error.

Mahinandaa commented 3 months ago

@time-river hi, can you please explain us what to do

Usako-USA commented 2 months ago

@Mahinandaa

  1. check the ComfyUI error message. For Me, differnt from your case(using X-Adapter), that is following:
    
    File "C:\development\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-Diffusers-X-Adapter\pipeline\pipeline_sd_xl_adapter_controlnet.py", line 1605, in check_inputs_sd1_5
    raise TypeError("For single controlnet: `controlnet_conditioning_scale` must be type `float`.")
2. check the relevant source code(near line 1605).
        if not isinstance(controlnet_conditioning_scale, float):
            raise TypeError("For single controlnet: `controlnet_conditioning_scale` must be type `float`.")
3. Ignore Exception(Not sure if correct).
        if not isinstance(controlnet_conditioning_scale, float):
            logger.warning(
                    "controlnet_conditioning_scale must be float but IGNORE."
                )
            # raise TypeError("For single controlnet: `controlnet_conditioning_scale` must be type `float`.")
Xx-YB commented 5 days ago

I encountered the same problem. It still hasn't been solved. How did you solve it in the end?