Skip to content

Conversation

@CanvaChen
Copy link
Contributor

@CanvaChen CanvaChen commented Jun 16, 2024

What does this PR do?

Add support for XFormers in SD3 (#8535)

Before submitting

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.

@sayakpaul @yiyixuxu

@sayakpaul sayakpaul requested a review from yiyixuxu June 16, 2024 18:44
@CanvaChen
Copy link
Contributor Author

Hi @yiyixuxu @sayakpaul , could you please take a moment to review this PR when you have time? Thank you!

Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@sayakpaul
Copy link
Member

Thanks!

Could you also provide a test script for this so that we can run some tests?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@CanvaChen
Copy link
Contributor Author

CanvaChen commented Jul 6, 2024

def test_sd3(model_path, prompt):
    pipe = StableDiffusion3Pipeline.from_pretrained(model_path, torch_dtype=torch.float16).to('cuda')
    pipe.enable_xformers_memory_efficient_attention()

    image = pipe(prompt, negative_prompt='',
                 num_inference_steps=28, guidance_scale=7.5,
                 height=1024, width=768).images[0]

@sayakpaul
Copy link
Member

@DN6 how should this test set be added?

@CanvaChen
Copy link
Contributor Author

Do you mean adding a test script to the 'tests' folder for submission?

…mers

# Conflicts:
#	src/diffusers/models/attention_processor.py
@DN6
Copy link
Collaborator

DN6 commented Jul 17, 2024

Pipeline tests for xformers is handled via the PipelineTesterMixin, so an additional pipeline test is not needed. It would be nice to add a test in for the SD3 Transformer though. Similar to how we have it here

def test_xformers_enable_works(self):

@CanvaChen
Copy link
Contributor Author

CanvaChen commented Jul 20, 2024

============================= test session starts ==============================
collecting ... collected 1 item
models/transformers/test_models_transformer_sd3.py::SD3TransformerTests::test_xformers_enable_works PASSED [100%]
============================== 1 passed in 2.16s ===============================

done @sayakpaul @DN6

@DN6
Copy link
Collaborator

DN6 commented Aug 16, 2024

@CanvaChen Could you please run make style && make quality for the QC checks to pass?

@CanvaChen
Copy link
Contributor Author

done @DN6 @sayakpaul

ruff check examples scripts src tests utils benchmarks setup.py
ruff format --check examples scripts src tests utils benchmarks setup.py
1069 files left unchanged
doc-builder style src/diffusers docs/source --max_len 119 --check_only
python utils/check_doc_toc.py

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Sep 14, 2024
@sayakpaul sayakpaul removed the stale Issues that haven't received updates label Oct 16, 2024
@sayakpaul
Copy link
Member

Apologies for this delay. @DN6 could you give this a review?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Nov 9, 2024
@sayakpaul sayakpaul removed the stale Issues that haven't received updates label Nov 9, 2024
@sayakpaul
Copy link
Member

@CanvaChen I think this is still quite relevant. Would you maybe like to resolve the conflicts so that we can attempt a merge?

# Conflicts:
#	src/diffusers/models/attention_processor.py
@CanvaChen
Copy link
Contributor Author

@sayakpaul @DN6 I have resolved the code conflicts and also incorporated the recent changes from JointAttnProcessor2_0.

@sayakpaul
Copy link
Member

@DN6 could you please give this a review?

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Dec 11, 2024
@sayakpaul sayakpaul removed the stale Issues that haven't received updates label Dec 12, 2024
@sayakpaul
Copy link
Member

Failing tests are unrelated.

@sayakpaul sayakpaul merged commit 7db9463 into huggingface:main Dec 12, 2024
14 of 15 checks passed
sayakpaul added a commit that referenced this pull request Dec 23, 2024
* Add support for XFormers in SD3

* sd3 xformers test

* sd3 xformers quality

* sd3 xformers update

---------

Co-authored-by: Sayak Paul <[email protected]>
Co-authored-by: YiYi Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants