Skip to content
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 PAG support to SD1.5 #8710

Closed
2 of 6 tasks
yiyixuxu opened this issue Jun 26, 2024 · 17 comments · Fixed by #8725, #9386 or #9463
Closed
2 of 6 tasks

Add PAG support to SD1.5 #8710

yiyixuxu opened this issue Jun 26, 2024 · 17 comments · Fixed by #8725, #9386 or #9463
Labels
contributions-welcome good first issue Good for newcomers help wanted Extra attention is needed

Comments

@yiyixuxu
Copy link
Collaborator

yiyixuxu commented Jun 26, 2024

We recently integrated PAG into diffusers! See this PR [here] (#7944) we added PAG to SDXL

we also want to add PAG support to SD1.5 pipelines! we will need:

  1. You should put it under the pag folder
  2. you can use the implementation of SDXL PAG pipelines as a reference (see this PRhttps://github.com/add PAG support  #7944 and you can find all the sdxl pag pipelines here https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines/pag)
  3. you need to add AutoPipeline so that you can use this API to create it
       AutoPipelineForImage2Image.from_pretrained(repo_id, controlnet=controlnet, enable_pag=True ...)
  4. tests and docs

If you are interested in working on this, Let me know which pipeline(s) you want to work on:)

@blaisedmello
Copy link

blaisedmello commented Jun 26, 2024

Hello, I would like to have a go at it. Can I work on the StableDiffusionPAGInpaintPipeline?

@yiyixuxu
Copy link
Collaborator Author

@blaisedmello sure!

@shauray8
Copy link
Contributor

Looks rather interesting, adding support for StableDiffusionPAGPipeline.

@sajadn
Copy link
Contributor

sajadn commented Jun 26, 2024

Hey, I'll work on StableDiffusionPAGImg2ImgPipeline

@tuanh123789
Copy link
Contributor

Hi, can i take StableDiffusionControlNetPAGPipeline

@yiyixuxu
Copy link
Collaborator Author

@tuanh123789 sure!

@Bhavay-2001
Copy link
Contributor

Hi @yiyixuxu, I think I can work on StableDiffusionControlNetPAGImg2ImgPipeline. Pls assign this to me.

@yiyixuxu
Copy link
Collaborator Author

@Bhavay-2001 sure!

@AbhinavJangra29
Copy link

@yiyixuxu can i try ?

@darshil0805
Copy link
Contributor

Hi, I'd like to work on StableDiffusionPAGInpaintPipeline if it's still open

@yiyixuxu
Copy link
Collaborator Author

@darshil0805 sure!

@darshil0805
Copy link
Contributor

Hi @yiyixuxu , @a-r-r-o-w. I have opened a PR for SD Inpainting PAG Pipeline, can you review and help me to test this pipeline?

@crapthings
Copy link

how do i know the layer names?
only
up mid down?

@yiyixuxu
Copy link
Collaborator Author

cc @a-r-r-o-w, maybe we should update doc? (did we?)

@a-r-r-o-w
Copy link
Member

how do i know the layer names?
only
up mid down?

The correct usage is to look at either the modeling code, or state dict keys, to see what the layer naming looks like. Then you can specify either the full layer names or partial layer names as valid regular expressions when initializing the pipeline (via pag_applied_layers). For more advanced usage, you can take a look at helper methods in the PAGMixin.

See the docs and examples usages here.

TLDR; Our naming convention follows the pattern of something_blocks.whatever or something_blocks.[layer_index} or blocks.{layer_index} or transformer_blocks.{layer_index}, so the easiest way to enable them without looking into the state dict or modeling code is to specify something like pag_applied_layers="blocks.(10|20|42)" or pag_applied_layers="mid"

cc @a-r-r-o-w, maybe we should update doc? (did we?)

I think we did, but I noticed that the introduction docs are out of sync with the current usage, and I'm not sure if the current example works. I'll test and open a PR soon

@airookie17
Copy link

HI @yiyixuxu I'd like to work on StableDiffusionPAGImg2ImgPipeline if it's still open. Thanks

@yiyixuxu
Copy link
Collaborator Author

@airookie17
I think I'm about to merge in this #9463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions-welcome good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet