测试ComfyUI-InstantID 时出现如下
[2024-04-12 00:37] !!! Exception during processing !!!
[2024-04-12 00:37] Traceback (most recent call last):
File "/mnt/data/share/aigc/ComfyUI/execution.py", line 177, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/mnt/data/share/aigc/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 "/mnt/data/share/aigc/ComfyUI/execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/mnt/data/share/aigc/ComfyUI/custom_nodes/ComfyUI-InstantID/InstantIDNode.py", line 287, in id_generate_image
output = pipe(
File "/mnt/data/share/aigc/ComfyUI/venv/Comfyui/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/mnt/data/share/aigc/ComfyUI/custom_nodes/ComfyUI-InstantID/pipeline_stable_diffusion_xl_instantid.py", line 438, in __call__
self.check_inputs(
File "/mnt/data/share/aigc/ComfyUI/venv/Comfyui/lib/python3.10/site-packages/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py", line 685, in check_inputs
TypeError: For single controlnet: `controlnet_conditioning_scale` must be type `float`.
经过定位,应该是diffusers的版本差异引发的,问题为参数传递问题:
pipeline_controlnet_sd_xl.py文件中的定义为:
def check_inputs(
self,
prompt,
prompt_2,
image,
callback_steps,
negative_prompt=None,
negative_prompt_2=None,
prompt_embeds=None,
negative_prompt_embeds=None,
pooled_prompt_embeds=None,
ip_adapter_image=None,
ip_adapter_image_embeds=None,
negative_pooled_prompt_embeds=None,
controlnet_conditioning_scale=1.0,
control_guidance_start=0.0,
control_guidance_end=1.0,
callback_on_step_end_tensor_inputs=None,
):
而pipeline_stable_diffusion_xl_instantid.py文件中的调用如下 (大约在453行)
self.check_inputs(
prompt,
prompt_2,
image,
callback_steps,
negative_prompt,
negative_prompt_2,
prompt_embeds,
negative_prompt_embeds,
pooled_prompt_embeds,
negative_pooled_prompt_embeds,
controlnet_conditioning_scale,
control_guidance_start,
control_guidance_end,
callback_on_step_end_tensor_inputs,
)
bug修复方式为:将pipeline_stable_diffusion_xl_instantid.py调用部分修改为:
self.check_inputs(
prompt,
prompt_2,
image,
callback_steps,
negative_prompt,
negative_prompt_2,
prompt_embeds,
negative_prompt_embeds,
pooled_prompt_embeds,
negative_pooled_prompt_embeds,
controlnet_conditioning_scale = controlnet_conditioning_scale,
control_guidance_start = control_guidance_start,
control_guidance_end = control_guidance_end,
callback_on_step_end_tensor_inputs = callback_on_step_end_tensor_inputs,
)
问题解决