https://developer.apple.com/metal/pytorch/
Anaconda
Setup
Apple silicon
1 2
| curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh sh Miniconda3-latest-MacOSX-arm64.sh
|
Install
Anaconda
1
| conda install pytorch torchvision torchaudio -c pytorch-nightly
|
pip
1
| pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
|
Verify
You can verify mps
support using a simple Python script:
1 2 3 4 5 6 7
| import torch if torch.backends.mps.is_available(): mps_device = torch.device("mps") x = torch.ones(1, device=mps_device) print (x) else: print ("MPS device not found.")
|
The output should show:
1
| tensor([1.], device='mps:0')
|