# Running PyTorch + Huggingface on Apple Silicon (M1)

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-pytorch-huggingface-on-apple-silicon-m1%2F14983%3E%5C
**Category:** Beginners\
**Created:** [February 21, 2022, 5:11pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-pytorch-huggingface-on-apple-silicon-m1%2F14983 "2022-02-21T17:11:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barlen](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@barlen](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbarlen)%5C
**Post date:** [February 21, 2022, 5:11pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-pytorch-huggingface-on-apple-silicon-m1%2F14983%2F1 "2022-02-21T17:11:58Z")

</div>

How do I run PyTorch and Huggingface models on Apple Silicon (M1) GPU? This traditional way doesn’t seem to work

```auto
import torch
device = torch.cuda.current_device() if torch.cuda.is_available() else 'cpu'
print(f"device: {device}")

```

---

<div class="post-metadata">

**Author:** ![iamcos](https://avatars.discourse-cdn.com/v4/letter/i/f475e1/32.png) [@iamcos](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fiamcos)%5C
**Post date:** [August 24, 2022, 8:12pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frunning-pytorch-huggingface-on-apple-silicon-m1%2F14983%2F2 "2022-08-24T20:12:20Z")

</div>

in my very recent expirience with trying to run Huggingface and others on apple m1, there is an option to use device called ‘mps’ in place of cuda and cpy. However it falls behind in support.  
[General MPS op coverage tracking issue · Issue #77764 · pytorch/pytorch · GitHub](https://github.com/pytorch/pytorch/issues/77764) - oficial issue tracker for MPS is here.
