I’m trying to run the VGG16 pre-trained model on GPU using Pytorch on Linux Mint. This code snippet
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from PIL import Image
import torchvision.models as models
import time
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print( device)
vgg16 = models.vgg16(pretrained=True).cuda()
prints cpu
and throws error
RuntimeError: No CUDA GPUs are available
Tp solve the issue, I tun the following command in terminal
nvcc --version
and the output is
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
Since the version is 11.5.119
, I installed this
pip install torch torchvision torchaudio -f https://download.pytorch.org/whl/cu11.5.119/torch_stable.html
But the error still persists. How can I solve the issue?
9