Skip to content

[optim] Fix bug when default dtype is BF16 #2286

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

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

gau-nernst
Copy link
Collaborator

Happened in #2235

When torch.set_default_dtype(torch.bfloat16) is set, qmap = torch.tensor(...) becomes BF16. Hence, dequantizing the low-bit tensor subclass results in BF16, leading to dtype mismatch in Adam logic.

Copy link

pytorch-bot bot commented May 31, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2286

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 1 Pending

As of commit e658764 with merge base bc68b11 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 31, 2025
@gau-nernst gau-nernst added the topic: bug fix Use this tag for PRs that fix bugs label May 31, 2025
@gau-nernst gau-nernst requested review from msaroufim and HDCharles May 31, 2025 05:58
@gau-nernst gau-nernst force-pushed the optim/default_dtype branch from c87f106 to e658764 Compare June 4, 2025 02:08
@gau-nernst
Copy link
Collaborator Author

@msaroufim Can I get a stamp on this? Thank you!

@msaroufim msaroufim merged commit 3aa9361 into pytorch:main Jun 4, 2025
19 checks passed
@gau-nernst gau-nernst deleted the optim/default_dtype branch June 4, 2025 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: bug fix Use this tag for PRs that fix bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants