M1 AssertionError: Torch not compiled with CUDA enabled

Q: How can I get PyTorch 2.1.0 to use the M1 gpu instead of looking for CUDA?

“AssertionError: Torch not compiled with CUDA enabled”

I have an M1. I have installed PyTorch.

pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu

I am trying to run safetensors safe_open on a safe tensors file.
Googling, I read that PyTorch now supports M1.

Thanks in advance

Try using MPS backend for accessing M1 gpu.