Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use GPU with Pytorch

I keep getting this error when trying to use Pytorch.

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

I installed Pytorch using conda install pytorch torchvision cudatoolkit=10.1 -c pytorch.

With tensorflow my GPU runs just fine.

like image 623
A.Sheriff Avatar asked Aug 24 '26 21:08

A.Sheriff


1 Answers

You can fix this error by installing CUDA 10.2 (The Latest Version) and, additionally re-install Pytorch with this command:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
like image 144
LJ-dev Avatar answered Aug 26 '26 23:08

LJ-dev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!