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

MPS Mixed-precision Autocast #20497

Open
laclouis5 opened this issue Dec 13, 2024 · 2 comments · May be fixed by #20531
Open

MPS Mixed-precision Autocast #20497

laclouis5 opened this issue Dec 13, 2024 · 2 comments · May be fixed by #20531
Labels
feature Is an improvement or enhancement

Comments

@laclouis5
Copy link

laclouis5 commented Dec 13, 2024

Description & Motivation

Support for MPS autocasting has recently be added in PyTorch 2.5.0 here and there is an ongoing effort to implement gradient scaling here.

PyTorch Lightning does not currently support mixed-precision on MPS device but it could be added in a near future when gradient scaling is finalized.

Is this feature considered? This would allow reducing memory usage and improving training time for some models.

Pitch

Currently PyTorch Lightning falls back to FP32 when trying to use mixed-precision and issues a warning mentioning CUDA.

I think that considering adding a path for MPS mixed-precision would be great.

Alternatives

Stick to FP32 training when using MPS device.

Additional context

thanks for your work!

cc @Borda

@laclouis5 laclouis5 added feature Is an improvement or enhancement needs triage Waiting to be triaged by maintainers labels Dec 13, 2024
@lantiga
Copy link
Collaborator

lantiga commented Jan 6, 2025

Thank you @laclouis5, we'll be happy to accept a PR when grad scaling is in. Would you like to give it a shot?

@lantiga lantiga removed the needs triage Waiting to be triaged by maintainers label Jan 6, 2025
@laclouis5 laclouis5 linked a pull request Jan 6, 2025 that will close this issue
7 tasks
@laclouis5
Copy link
Author

@lantiga Yes, sure! The draft pull request is here: #20531.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants