Running PyTorch + Huggingface on Apple Silicon (M1)

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

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