The PyTorch website reveals that I can now do accelerated model training with PyTorch on my Mac (which has one of the new Silicon M series chips):
In collaboration with the Metal engineering team at Apple, we are excited to announce support for GPU-accelerated PyTorch training on Mac. Until now, PyTorch training on Mac only leveraged the CPU, but with the upcoming PyTorch v1.12 release, developers and researchers can take advantage of Apple silicon GPUs for significantly faster model training. This unlocks the ability to perform machine learning workflows like prototyping and fine-tuning locally, right on Mac.
As the website says, this new PyTorch acceleration capability is due to Metal, which is Apple’s graphics processing (or GPU) technology.
This means I no longer need to use remote machines when training models. I can do it all on my trusty home computer. Let’s check.
The easiest way to check is, if you haven’t already, first install PyTorch. I would use Anaconda:
conda install pytorch torchvision -c pytorch
With PyTorch installed, run Python and then run the commands:
import torch
print(torch.backends.mps.is_available())
print(torch.backends.mps.is_built())
If the last commands works without a hitch, you have PyTorch installed. The last two commands should return True, meaning that PyTorch can use your graphics card for (accelerated) calculations.