-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Feat/controlnet nodes #3405
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
Feat/controlnet nodes #3405
Conversation
0bd7b62 to
84727a7
Compare
Looking at your node graph, what should be happening is that the OpenPose preprocessor node resizes the image to 512x512 pixels before it is fed to the OpenPose algorithm. And redundantly resizing the resulting image again to 512x512 pixels before it is sent to the ControlNet node, which doesn't do any resizing. However OpenPose node is also sending width=512 and height=512 params to Noise node. So possibly the 768x768 SD2.1 model doesn't like the 64x64 latent being passed in from Noise? Or it could be something in ControlNet code in latent.py -- I'll do some testing... |
|
I think it is likely because he's not using 2.1 Controlnet models, but is using SD 2.1. |
|
@GreggHelt2 ill have to get back to you on if this breaks when I use the correct 2.1 control net models However this is unexpected, why is the control net preprocessor resizing my image? The control image is not 512x512 and the results are not either. Also, what are the two integer parameters use for on the preprocessor? If we are expression some image size or resolution, wouldn't be want to include both width and height? |
The image preprocessors are definitely a mixed bag. Some have See Mikubill/sd-webui-controlnet#924 for discussion of resizing complexity that led to adding a "pixel_perfect" option in ControlNet auto1111 extension that autoresizes. I have not yet implemented that option but it is on my TODO list (probably another PR after this one gets merged). |
hipsterusername
left a comment
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.
Tested - Aside from minor nits I've called out previously (follow-on fixes) this thing is ready for main!
|
@GreggHelt2 - Seeing a number of conflicts in here - May be due to other PRs being merged in? |
|
Just realized, this is going to need some care while rebasing due to the images refactor pr. I'm happy to have a go at that tomorrow since I'm familiar with the changes, and the resolution may not be trivial. |
+1 .. I ran it quite a bit today. The ControlNet part itself is pretty solid. There's some UI/UX stuff that might need refining but can happen in a future PR. Also the Model Management PR needs to be merged in so it can handle the ControlNet models from disk rather than loading from HF. |
|
Whoever merges this, maybe do a squash merge coz there's a large number of commits and a traceback might get harder. Unless @GreggHelt2 wants to retain the commit history. |
|
Update: Recent modifications to PR including pinning to the newly released controlnet_aux v0.0.4, reinstating the Zoe depth preprocessor node, and adding a Mediapipeface preprocessor node. Also, thanks to a great session with @psychedelicious , we got polymorphic input ports on nodes working. So now the control input port on TextToLatents can take either a single ControlField input or a list of ControlFields. So a single ControlNet can connect directly to TextToLatents without going through a Collect node, like: |
|
If you've manually installed controlnet_aux v0.0.4 to test this PR, you may want to check what version of the timm package is installed. It needs to be <= 0.6.13 in order for Zoe processors to work (see issue isl-org/ZoeDepth#26). Currently in the InvokeAI pyproject.toml I'm forcing the timm version to 0.6.13, so I think a |
I'm not worried about the conflicts. Most of the currently reported conflicts are in the autogenerated stuff, I think from doing a |
I do like retaining commit history. "git bisect" with more precise history has saved me more than once. Maybe see how messy a final rebase is before deciding? I've been rebasing pretty much every time there's another PR merged to main just to make sure this PR isn't straying too far away. Though I haven't rebased after image refactoring PR (mentioned by @psychedelicious above) was merged yesterday/yesternight. |
|
@GreggHelt2 - I think mediapipe may need to be added to pyproject.toml after your latest commits. Were you going to address conflicts or were you waiting for @psychedelicious to do that? |
Thanks for catching the issue with mediapipe. For now like you suggested I added requirement to pyproject.toml. I'll put in a PR to controlnet_aux repo to add to its requirements instead, so eventually we should be able to remove again from pyproject.toml.
I'll deal with those conflicts today. |
|
Sounds great - pushing the big ol' merge button once they are! :) |
…Txt2Img in backend/generator. Although backend/generator will likely disappear by v3.x, right now they are very useful for testing core ControlNet and MultiControlNet functionality while node codebase is rapidly evolving.
MidasDepth
ZoeDepth
MLSD
NormalBae
Pidi
LineartAnime
ContentShuffle
Removed pil_output options, ControlNet preprocessors should always output as PIL. Removed diagnostics and other general cleanup.
… node, stripped controlnet stuff form image processing/analysis nodes.
…sor mismatch issue.
…data struct. Also redid how multiple controlnets are handled.
each ControlNet, and which step to end using each controlnet (specified as fraction of total steps)
…gnostic printing. Also fixed error when there is no controlnet input.
…aux release that supports it.
…t of popular ControlNet model names.
…urned of pre-processor params that were added post v0.0.3. Also change defaults for shuffle.
…extToLatents.invoke(), and make upcoming integration with LatentsToLatents easier.
Also hacked in ability to specify HF subfolder when loading ControlNet models from string.
…s and min_confidence params.
…nOutput. Also added FloatOutput.
…ntrolnet_aux package adds mediapipe to its requirements.
…ts to work with revised Image services.
3a23956 to
a4b0140
Compare
All working now and rebased to main! |


This PR adds support for ControlNet (and multiple ControlNets) within the nodes backend and nodes UI.
It adds:
Usage:
Single controlnet using preprocessed image
Multiple controlnets using image preprocessors
One limitation on current implementation is that there must be a Collect node between the controlnet(s) control output and the TextToLatents control input. Directly connecting a ControlNet node to TextToLatent node will result in an error. This is because I haven't figured out how to set up a polymorphic input port that can take either a single ControlField item or a list of ControlField items. I'm pretty sure it can be done but everything I've tried so far results in errors. Will reach out on discord for help on this, but I don't think it's a big enough issue to block the PR.