diffusers
diffusers copied to clipboard
Add FluxPAGPipeline with support for PAG
What does this PR do?
This PR adds support for Perturbed Attention Guidance (PAG) to the FluxPipeline
Fixes #11488
Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the contributor guideline?
- [x] Did you read our philosophy doc (important for complex PRs)?
- [x] Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
- [ ] Did you write any new necessary tests?
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag members/contributors who may be interested in your PR.
@tongyu0924 Is this ready for review? If so, could you move the pipeline under src/diffusers/pipelines/pag please and make the changes needed to import the pipeline?
@tongyu0924 Is this ready for review? If so, could you move the pipeline under
src/diffusers/pipelines/pagplease and make the changes needed to import the pipeline?
Done! The pipeline is now under src/diffusers/pipelines/pag. It's ready for review
Thank you @tongyu0924 👍🏽! Could we add the pipeline to the necessary init files
PAG Module: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pag/init.py
Pipelines Module: https://github.com/huggingface/diffusers/blob/049082e013fb71d78f3abf487916f3de2b674908/src/diffusers/pipelines/init.py#L175
Diffusers main init https://github.com/huggingface/diffusers/blob/049082e013fb71d78f3abf487916f3de2b674908/src/diffusers/init.py#L341
And then could you please add a fast test for the pipeline, similar to how it has been done here https://github.com/huggingface/diffusers/blob/049082e013fb71d78f3abf487916f3de2b674908/tests/pipelines/pag/test_pag_sd3.py#L26
Thank you @tongyu0924 👍🏽! Could we add the pipeline to the necessary init files
PAG Module: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pag/init.py
Pipelines Module:
https://github.com/huggingface/diffusers/blob/049082e013fb71d78f3abf487916f3de2b674908/src/diffusers/pipelines/init.py#L175
Diffusers main init
https://github.com/huggingface/diffusers/blob/049082e013fb71d78f3abf487916f3de2b674908/src/diffusers/init.py#L341
And then could you please add a fast test for the pipeline, similar to how it has been done here
https://github.com/huggingface/diffusers/blob/049082e013fb71d78f3abf487916f3de2b674908/tests/pipelines/pag/test_pag_sd3.py#L26
I've added the pipeline to the necessary __init__.py files and added a fast test following the structure in test_pag_sd3.py.
Please update the following if possible
diffusers/src/diffusers/pipelines/pag/pipeline_pag_flux.py
EXAMPLE_DOC_STRING = """ Examples: ```py >>> import torch >>> from diffusers import FluxPipeline
>>> pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> prompt = "A cat holding a sign that says hello world"
>>> # Depending on the variant being used, the pipeline call will slightly vary.
>>> # Refer to the pipeline documentation for more details.
>>> image = pipe(prompt, num_inference_steps=4, guidance_scale=0.0).images[0]
>>> image.save("flux.png")
```
"""
hi, just wanted to check in, are there any updates on when this might be merged?