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

Fix custom ops loading in diffusers #1655

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dsocek
Copy link
Contributor

@dsocek dsocek commented Dec 20, 2024

What does this PR do?

This PR has critical fix for custom ops loading in diffusers.

More information

As discussed in PR #1631, removing htcore import before model loading would break quantization support for OH diffusers; however, @skaulintel encountered issues with some workloads when htcore is imported before model is loaded. The underlying issue happens to be due to how GaudiConfig is handled when custom ops precision lists are defined in the configuration (e.g. in Habana/stable-diffusion-2).

This PR fixes the underlying issue.

@dsocek dsocek requested a review from regisss as a code owner December 20, 2024 20:51
@@ -165,8 +165,6 @@ def __init__(
"`torch_dtype=torch.bfloat16` was given. Disabling mixed precision and continuing in bf16 only."
)
self.gaudi_config.use_torch_autocast = False
else:
self.gaudi_config.declare_autocast_bf16_fp32_ops()

Copy link
Collaborator

Choose a reason for hiding this comment

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

where did you set this after change?

Copy link
Contributor

@splotnikv splotnikv left a comment

Choose a reason for hiding this comment

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

LGTM

@regisss
Copy link
Collaborator

regisss commented Dec 23, 2024

@dsocek Is this linked to #1657 ?

@dsocek
Copy link
Contributor Author

dsocek commented Dec 23, 2024

@dsocek Is this linked to #1657 ?

@regisss Yes, here's how:

#1657 is a temporary, less intrusive, and partial fix that can be implemented with minimal validation and testing, ensuring it doesn’t delay the release.

This PR, on the other hand, is the complete fix. However, @libinta recommended postponing it until after the release, as it requires extensive validation.

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.

4 participants