-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add guidance start/stop #3770
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 guidance start/stop #3770
Conversation
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.
Looks like a nice addition to me ,could we add some tests and also add it to the controlnet inpainting pipeline?
Tests should be added here:
https://github.com/huggingface/diffusers/tree/main/tests/pipelines/controlnet
Inpainting pipeline is here:
https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py
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.
Seems to be a nice addition. Would be cool to also see some results with and without it.
And as mentioned by @patrickvonplaten let's add some test cases for it to ensure robustness and feature compatibility.
|
Thanks for the feedback. Seems like implementing this is slightly more complex than I anticipated, but I will try to look at this in the coming weeks. If anyone wants this implemented asap, feel free to take it over. Todos
|
Here is a before and after example:
I find it's quite useful to set guidance end to a number lower than 1. This allows the model to clean up any artifacts caused by controlnet in the last steps of the process. By setting guidance start larger than 0, details that don't exist in the input images are added. |
I've updated the PR to support multicontrolnet, can someone have a look at the changes and let me know if you are fine with the changes? I will add some tests afterwards if we agree to proceed. |
We need this for our qrcode controlnet demo. |
The documentation is not available anymore as the PR was closed or merged. |
Thanks for your PR! Here is a demo colab that shows how to use it to generate qrcodes. I also made the lib sdqrcode to generate ai qrcodes with this method with a simple one-liner (colab) |
Hey @holwech, Sorry for fiddling soo much with your PR. Some tests were missing and I think it's better if we try to not change the controlnet files. Here I just take advantage of the fact that zero'ing out the controlnet result is the same as skipping it. The gain we might get from skipping on controlnet is negligible IMO so design-wise I think it's cleaner to just zero it out. |
* Add guidance start/stop * Add guidance start/stop to inpaint class * Black formatting * Add support for guidance for multicontrolnet * Add inclusive end * Improve design * correct imports * Finish * Finish all * Correct more * make style --------- Co-authored-by: Patrick von Platen <[email protected]>
* Add guidance start/stop * Add guidance start/stop to inpaint class * Black formatting * Add support for guidance for multicontrolnet * Add inclusive end * Improve design * correct imports * Finish * Finish all * Correct more * make style --------- Co-authored-by: Patrick von Platen <[email protected]>
Adds guidance start/stop to the img2img and text2img Stable Diffusion pipeline classe. This is a setting that is available in automatic1111. This PR is heavily inspired by this community pipeline that implements the same functionality.
I've used and tested the PR on my own project and it seems to work fine.