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 grad_scaler for MPS, which doesn't support FP64 #144022

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

Conversation

masc-it
Copy link

@masc-it masc-it commented Dec 31, 2024

  • remove fp64 intermediate cast if on mps device

Original error:

scaler.unscale_(optimizer)
  File "..../lib/python3.10/site-packages/torch/amp/grad_scaler.py", line 335, in unscale_
    inv_scale = self._scale.double().reciprocal().float()
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

I don't know if this is the correct way to do it, just trying to escalate this annoying error for mps folks.

cc @mcarilli @ptrblck @leslie-fang-intel @jgong5

Copy link

pytorch-bot bot commented Dec 31, 2024

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit 03e39b0 with merge base 01034e9 (image):

NEW FAILURE - The following job has failed:

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

Copy link

CLA Not Signed

Copy link
Contributor

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants