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

Support Metal Performance Shaders #41

Merged
merged 12 commits into from
May 29, 2024

Conversation

levje
Copy link
Contributor

@levje levje commented May 28, 2024

Should be merged after: #40

Allow the support of Metal Performance Shaders (MPS) backend to train on a Mac M1. Whilst this is not meant to perform a complete training (could still be possible), this is meant to at least be able to debug and run the training process without access to CUDA.

I basically changed everything that was hardcoded "cuda" or "cuda:0" by utility functions so that we can add multiple backends easily. However, to actually use MPS to train a model, PyTorch 2.4.0 will be needed once it's out (there was a known bug that just got fixed). For now, we can just install a recent nighty build (torch==2.4.0.dev20240520, torchaudio==2.2.0.dev20240520, torchvision==0.19.0.dev20240520. With index: https://download.pytorch.org/whl/nightly/) manually and everything should work fine.

So: pip install torch==2.4.0.dev20240520 torchaudio==2.2.0.dev20240520 torchvision==0.19.0.dev20240520 --index=https://download.pytorch.org/whl/nightly/

I propose we merge this to support MPS everywhere in the code and so it's available for all subsequent branches, and if we want to use it locally we can just install the torch nightly build.

I'll take note of upgrading to torch 2.4.0 once the official release is out in late July.

@AntoineTheb AntoineTheb merged commit 66808b5 into scil-vital:main May 29, 2024
2 checks passed
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.

2 participants