yolov5用gpu训练时报错了,nvcc -V一看,no command
操作一番后,nvcc -V OK, but 问题依旧
How to Install PyTorch with CUDA 10.2
torch.cuda.is_available()返回false的解决办法
进入python查看当前pytorch是否可用gpu,发现是false
>>> import torch
>>> torch.cuda.is_available()
/home/ubuntu/anaconda3/envs/wby_py38/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:109.)
return torch._C._cuda_getDeviceCount() > 0
False
再查看pytorch版本,可以看到pytorch版本是18,需要对应的cuda10.2,通过 "nvidia_smi" 看到本地的cuda是10.1,问题出在这里。
>>> torch.__version__
'1.8.1+cu102'
通过cuda_10.2.89_440.33.01_linux.run确认下载显卡驱动版本大于等于440.33.01