8000 Need support and testing for Adam optimizer for MPS · Issue #105382 · pytorch/pytorch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Need support and testing for Adam optimizer for MPS #105382
Closed
@zihaomu

Description

@zihaomu

🚀 The feature, motivation and pitch

Environment of Mac M2

Python3.10
torch              2.1.0.dev20230717
torchaudio         2.1.0.dev20230717
torchvision        0.15.2a0

I want to use the Adam optimizer to train my model. And got an error:

NotImplementedError: The operator 'aten::lerp.Scalar_out' is not currently implemented for the MPS device. If you want this op to be added in priority during the prototype phase of this feature, please comment on https://github.com/pytorch/pytorch/issues/77764. As a temporary fix, you can set the environment variable `PYTORCH_ENABLE_MPS_FALLBACK=1` to use the CPU as a fallback for this op. WARNING: this will be slower than running natively on MPS

And when I set the PYTORCH_ENABLE_MPS_FALLBACK=1, the training speed is quite slower.

I'm testing the tiny VIT model with minist dataset.

The details is following:
M2 chip takes about 2.4 minutes on CPU with Adam for one epoch.
M2 chip takes about 2.0 minutes on GPU with Adam for one epoch( with PYTORCH_ENABLE_MPS_FALLBACK=1).
M2 chip takes about 30 seconds on GPU with SGD for one epoch.

Alternatives

No response

Additional context

No response

cc @vincentqb @jbschlosser @albanD @janeyx99 @crcrpar @kulinseth @malfet @DenisVieriu97 @razarmehr @abhudev @ezyang @gchanan @zou3519

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNot as big of a feature, but technically not a bug. Should be easy to fixmodule: mpsRelated to Apple Metal Performance Shaders frameworkmodule: optimizerRelated to torch.optimtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0