-
Couldn't load subscription status.
- Fork 6.4k
Add PAG support to StableDiffusionControlNetPAGInpaintPipeline #8875
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
Merged
yiyixuxu
merged 21 commits into
huggingface:main
from
juancopi81:pag_controlnet_inpaint_sd15
Oct 1, 2024
Merged
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5885d74
Add pag to controlnet inpainting pipeline
juancopi81 2c11062
Fix minor but with timeste_cond
juancopi81 6267102
Add code to dummy_torch_and_transformers_objects and use autopipeline…
juancopi81 d152e16
Fix logic in auto_pipeline when pag and controlnet are present
juancopi81 d4093e0
Add some debug prints
juancopi81 3f502f1
Change replacement logic for now so it can take ControlNetPAGInpaintP…
juancopi81 f6a98cd
Add check of shapes when unet channels == 9
juancopi81 7d1a260
Remove some print statements, add some debug prints to shapes when un…
juancopi81 088f0c8
Expand mask and masked_image_latents if necessary when unet has 9 cha…
juancopi81 bb01aba
Adjust repeat factor so mask, and masked_image_latents match latent_m…
juancopi81 102ce9d
Concatenate tensors when unet has 9 channels
juancopi81 f9e4543
Add tests to pag controlnet sd inpaint pipeline
juancopi81 512a252
Make style changes
juancopi81 ce28845
Final changes based on @a-r-r-o-w feedback and run make style make qu…
juancopi81 00f8c7a
Fix incorrect comment for message 'Copied from ...'
juancopi81 f7a183e
Add test to ensure StableDiffusionControlNetPAGInpaintPipeline works …
juancopi81 93fca2d
Remove cn_inpainting test for now and change logic if cn and enable_p…
juancopi81 2fb4fd4
Merge branch 'main' into pag_controlnet_inpaint_sd15
yiyixuxu d5214db
Merge branch 'main' into pag_controlnet_inpaint_sd15
yiyixuxu 7b2368b
style
yiyixuxu 669052a
loraloadermixin -> stablediffusionloraloadermixin
yiyixuxu 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
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
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
Oops, something went wrong.
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.
can you provide an example where this code addition is needed? I think it should already be addressed in line 944 no?
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.
Hi @yiyixuxu,
Thank you very much for your comments. Sorry if I am missing something here, but my idea is as follows:
There are 4 cases that need to be handled:
No ControlNet and no Pag -> Keep Pipeline
With ControlNet and no Pag -> Replace Pipeline with ControlNetPipeline
No ControlNet and with Pag -> Replace Pipeline with PAGPipeline
With ControlNet and with Pag -> Replace Pipeline with ControlNetPAGPipeline, which will override the first case.
That's why I added the nested conditions, but maybe I am missing something 🤔
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 see! thank for explaining it, you were absolute ly right!
can we do this instead (to be consistent with AutoPipelineForText2Image and AutoPipelineForImage2Image)
diffusers/src/diffusers/pipelines/auto_pipeline.py
Line 363 in 73acebb
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.
Oh sure, done! This way is better!