-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[WIP] SDXL ControlNet pipeline follow-up fixes #4155
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
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0fc8ca3
Do not force VAE upcast if custom VAE is used
gkorepanov 2ad7b7e
Support switching cfg in controlnet pipeline
gkorepanov 179a7fe
typo
gkorepanov 6ed6a3f
Fixes from review
gkorepanov 5be9e23
Fix tests
gkorepanov acf965c
Add tests for guess mode and no cfg in controlnet SDXL
gkorepanov 33db8e5
Fix case with unbound local
gkorepanov 46ee54d
Disable unrelevant test
gkorepanov 79cff48
style
gkorepanov 9b25fd2
Merge branch 'main' into sdxl-controlnet-fixes
sayakpaul f59a1db
style.
sayakpaul 87b7cfe
Add tests for all combinations of guess mode and cfg scale
gkorepanov edfbb60
Merge branch 'main' into sdxl-controlnet-fixes
gkorepanov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could I have an explanation on why this differs from
diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet.py
Line 924 in 6b1abba
?
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.
Just wanted to make the code around switching CFG more clear, I don't see the point behind scaling latents once for main unet and then the second time for controlnet. So I made a change which is aligned with all inputs (
prompt embeds,text_embeds,time_ids): we first prepare the standard inputs for controlnet, and then expand them (torch.cat([...]*2)for unet if it is required by CFGThere 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.
Got it. Clean.
Uh oh!
There was an error while loading. Please reload this page.
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.
I just took a closer look here. Is it possible to do exactly the same as here? https://github.com/huggingface/diffusers/blob/80871ac5971fe7e708befa3b553463c4e61b22ab/src/diffusers/pipelines/controlnet/pipeline_controlnet.py#L938C19-L938C19
I think the logic is very clear there:
controlnet_modelis addressed within theif ... else ...statementguess_mode and do_classifier_free_guidanceit will differ from our regular Unet model input