-
Notifications
You must be signed in to change notification settings - Fork 6k
Add ControlNetUnion #10131
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
Add ControlNetUnion #10131
Conversation
@@ -1,80 +1,86 @@ | |||
from typing import TYPE_CHECKING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why the whitespace changed here 🤷♂️
…into controlnet-union
Ready for review. |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!!
cc @asomoza |
I'll test as soon as I can, this is the controlnet that I use the most on a daily basis so I'll love the idea to have it in the core. Just a bit more information on the official repository, first I tried using it without the need of a different repository, which lead me to use the code in this space and I asked the model author to do a different model repository for the promax version without any response, so at the end I also had to make my own to avoid the custom code to just load it. There's quite a bit of discussion about changing the model naming but the author never answers any of them. Also the promax version came after the original one, but once we have it, there's not much incentive on using the older when the newer one does the same and more. |
ok merged! thank you both |
the design here makes it a nightmare to use and very different than any other controlnet model.
so i understand that you need to signal the union controlnet whats the input type, but this is not a unique scenario. |
This ControlNet works differently than Flux ControlNet Union. The design is explained in the opening comment, also see the original code, we avoid sync on every step. |
I understand it works differently, but you can't override image param to become something completely else. at least create a new property then. |
just to take note on this, we also have some inconsistencies with the naming of the normal controlnet conditioning images across some pipelines, IMO it should never be |
the controlnet union pipelines introduced a new parameter called we can change the argument for check_input here to something else if that's what you want
|
agree with @asomoza. Here, we have some inconsistency with the parameter names; But it is irrelevant to this PR, this PR does not have this issue at all |
ok I just saw the refactor |
Hi, Can I use promax version for now? Thanks, |
there is no separate promax code, its the same architecture so same limitations. |
Thanks for replying my question. I can't find the code on promax input and union input. where those are? |
@john09282922 There is no separate promax code. |
What does this PR do?
Model
Original code
Weights
Changes include:
ControlNetConditioningEmbedding
,ControlNetOutput
,zero_module
imported fromcontrolnet
.ResidualAttentionMlp
instead ofnn.Sequential
/OrderedDict
.nn.LayerNorm
.num_trans_channel
etc to__init__
/config.transformer_layers
asnn.ModuleList
instead ofnn.Sequential
.ControlNetModel
(type hints, etc)Pipelines
StableDiffusionXLControlNetUnionPipeline
StableDiffusionXLControlNetPipeline
StableDiffusionXLControlNetUnionImg2ImgPipeline
StableDiffusionXLControlNetImg2ImgPipeline
StableDiffusionXLControlNetUnionInpaintPipeline
StableDiffusionXLControlNetInpaintPipeline
ControlNetUnionInput
/ControlNetUnionInputProMax
The original requires pipeline input where
image_list
is a list like[0, 0, 0, controlnet_img, 0, 0]
with the ControlNet conditioning image in the correct index, andunion_control_type
as a tensor liketorch.Tensor([0, 0, 0, 1, 0, 0])
with the same indexing.This has been replaced by
ControlNetUnionInput
/ControlNetUnionInputProMax
, these allow the user to provide a single input like:Appropriate
control_type
tensor is produced in the pipeline.Example
Note: a better example prompt/image would be great
Example output
StableDiffusionXLControlNetUnionImg2ImgPipeline example (`tile`)
Tile example output
StableDiffusionXLControlNetUnionInpaintPipeline example (`inpaint`, `outpaint`)
Note: a better example prompt/image would be great, non-optimal results in this example due to resized image+mask
Inpaint example output
Fixes #9772
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.