-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ControlNet union pipeline fails on multi-model #10656
Comments
The advantage of controlnet union is that we don't need to use multiple controlnet models, no? We just use multiple control conditionings with the same controlnet union model. What is the use case here? |
lets say i want to run openpose and canny. how? issue is that i need to match number of all params - control_image, controlnet_conditioning_scale, start, end, etc. |
cc @yiyixuxu |
ok, using single 'control_mode': [3, 0], # canny and openpose
'controlnet_conditioning_scale': [0.5, 0.8], # different strength for each conditioning model
'control_guidance_start': [0.1, 0.2], # explicit start
'control_guidance_end': [0.8, 0.9], # explicit stop
'control_image': [<PIL.Image.Image image mode=RGB size=768x768 at 0x773051C06DE0>, <PIL.Image.Image image mode=RGB size=768x768 at 0x773051F37710>], # preprocessed inputs with canny and openpose processors
@hlky so intended behavior as you noted seems to be broken? |
@vladmandic Apologies for the oversight, |
fixed in #10666 :) |
can we wait with closing the issue until its confirmed - either internally or externally?
|
oh sorry, reopen it |
We can only apply a single scale here diffusers/src/diffusers/models/controlnets/controlnet_union.py Lines 813 to 820 in fb42066
In MultiControlNet we wrap the forward to handle list of scales diffusers/src/diffusers/models/controlnets/multicontrolnet.py Lines 32 to 53 in fb42066
The point of ControlNet Union is reducing the inference cost of multiple controlnets but it seems that creates a limitation that we can't apply scale for each control type. For some experiments we could try applying scale at some another point in the code. diffusers/src/diffusers/models/controlnets/controlnet_union.py Lines 751 to 773 in fb42066
|
example you've posted is about conditioning_scale. anyhow my primary goal here is uniform interface. |
control_guidance_start, control_guidance_end and controlnet_conditioning_scale are linked, they all control the final image = pipe(
prompt,
control_image=[controlnet_img, controlnet_img],
control_mode=[3, 3],
controlnet_conditioning_scale=[0.5, 0.5],
control_guidance_start=[0.1, 0.2],
control_guidance_end=[0.8, 0.9],
height=1024,
width=1024,
).images[0] diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl.py Lines 1135 to 1140 in 7b100ce
# control_guidance_start control_guidance_end
[0.1, 0.2] [0.8, 0.9] diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl.py Lines 1279 to 1284 in 7b100ce
should be (with diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet.py Lines 1235 to 1241 in 7b100ce
[[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [1.0, 0.0], [1.0, 0.0], [1.0, 0.0], [1.0, 0.0], [1.0, 0.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [0.0, 1.0], [0.0, 1.0], [0.0, 1.0], [0.0, 1.0], [0.0, 1.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet.py Lines 1271 to 1272 in 7b100ce
[0.0, 0.0] As above we can experiment with applying scale in a different place to get the expected effect. For now the limitation is single value for control_guidance_start, control_guidance_end and controlnet_conditioning_scale. If you'd like we can handle that by taking the first value from the list and logging a warning as you suggested. |
yes, anything to reduce runtime errors - library should be able to handle its own limitations (and there always are some limitations) without crashing. but if we cannot support multiple scale/start/end nicely inside single controlnetunion, perhaps we really should also allow for multiple models to run inside pipeline - just like any other controlnet? |
Hi, controlnet union AFAIK doesn't allow anywhere (here or in any other ui/library) to be controlled with start, end or scale for each condition image, it is always for the whole controlnet, the only advantage of it is that you can use multiple condition images for one controlnet, nothing more. We should make it to be able to be used with other controlnets if people want, or for example, to use a different start,end or scale, people should pass it as another instance which would solve that problem. Of course, if we can control the start, end and scale of each condition image, it would be ideal but that is a feature request and not an issue. |
@asomoza that's pretty much what i wrote?
|
yeah, I was separating the part of the controlling each control type from the issue for future reference and to make it clear. Your list is what this issue should be about and what should be fixed, just take into consideration that this is a very special controlnet that differs a lot from the others, that why we're having this issues and your feedback helps us a lot with it, I almost never use it with other controlnets so it also passed under my radar. |
Describe the bug
All controlnet types are typically defined inside pipeline as below (example from
StableDiffusionXLControlNetPipeline
):however, StableDiffusionXLControlNetUnionPipeline pipeline defines it simply as:
which defeats one of the main advantages of union controlnet - to be able to perform multiple guidances using same model.
for reference, controlnetunion was added via pr #10131
any changes to txt2img pipeline should also be mirrored in img2img and inpaint pipelines.
Reproduction
Logs
System Info
diffusers==0.33.0.dev0
Who can help?
@hlky @yiyixuxu @sayakpaul @DN6
The text was updated successfully, but these errors were encountered: