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

Raise an error when trying to use SD Cascade Decoder with dtype bfloat16 and torch < 2.2 #7244

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

DN6
Copy link
Collaborator

@DN6 DN6 commented Mar 7, 2024

What does this PR do?

It is currently not possible to use the bfloat16 dtype with the SD Cascade decoder pipeline when torch version < 2.2
This PR adds a check that raises an error when this is attempted.

Fixes # (issue)

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.

@DN6 DN6 requested a review from sayakpaul March 7, 2024 11:15
@@ -361,6 +361,8 @@ def __call__(
device = self._execution_device
dtype = self.decoder.dtype
self._guidance_scale = guidance_scale
if is_torch_version("<", "2.2.0") and dtype == torch.bfloat16:
Copy link
Member

Choose a reason for hiding this comment

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

Is it only the decoder dtype or the general torch_dtype that we use?

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

LGTM.

Would be great if we added a test here as well to make sure this bug is raised accordingly.

@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.

@DN6
Copy link
Collaborator Author

DN6 commented Mar 7, 2024

Would be great if we added a test here as well to make sure this bug is raised accordingly.

Maybe in a follow up? We would need a new env with torch 2.1, all our containers use 2.2 now.

@sayakpaul
Copy link
Member

Yeah no need then. Feel free to merge!

@DN6 DN6 merged commit 39dfb7a into main Mar 7, 2024
17 checks passed
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.

3 participants