Running PyTorch on Apple Silicon #255
-
Slightly off topic, was wondering if there's anyone who's running PyTorch on M1/M2 Mac. I have a M2 Mac and I did not quite get how to run GPU enabled PyTorch |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi, Unfortunately, I don't have an Apple system but have a look at the following: I hope it can help you. |
Beta Was this translation helpful? Give feedback.
-
Hy, I am running M1. This setup video by @mrdbourke could be helpful. |
Beta Was this translation helpful? Give feedback.
-
Hi @msp99000, @shmuhammad2004 and @AlienSarlak are right there are a couple of methods to get it setup. Try this code snippet as well to use the Apple Silicon GPU from the PyTorch Cheatsheet - https://www.learnpytorch.io/pytorch_cheatsheet/#device-agnostic-code-using-pytorch-on-cpu-gpu-or-mps # Setup device-agnostic code
if torch.cuda.is_available():
device = "cuda" # NVIDIA GPU
elif torch.backends.mps.is_available():
device = "mps" # Apple GPU
else:
device = "cpu" # Defaults to CPU if NVIDIA GPU/Apple GPU aren't available
print(f"Using device: {device}") |
Beta Was this translation helpful? Give feedback.
Hi,
Unfortunately, I don't have an Apple system but have a look at the following:
https://towardsdatascience.com/installing-pytorch-on-apple-m1-chip-with-gpu-acceleration-3351dc44d67c
I hope it can help you.