Got error 'AssertionError: Torch not compiled with CUDA enabled' on Macbook M1 pro
htnha opened this issue · comments
I have tried the example on my Macbook M1 pro but got this error:
=>outputs = model.generate(tokenizer(inputs, return_tensors="pt", padding=True).input_ids.to('cuda'), max_length=512)
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
Please help!
Hi @htnha,
Did you install pytorch with CUDA supported? If no, please try to uninstall your current pytorch version and reinstall pytorch with CUDA supported, for example pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
On Macbook M1 Pro, there is no Nvidia Card, so it does not support Cuda but Apple m1 pro chip with GPU.
Hmm if you can't run the model on GPU, just remove .to('cuda')
to run the model on CPU. In addition, you can try our model on Google Colab, which provides free GPU.
Can I have your Google colab link?