今天跑了一下yolov5的一个代码,只训练了200多张图片,但是一开始一个epoch训练了一分钟,仔细检查命令行后发现没有使用gpu
同时报错:skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5 /home/liuzhen/miniconda3/envs/yolov5/lib/python3.9/site-packages/torch/cuda/__init__.py:107: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10020). 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 ../c10/cuda/CUDAFunctions.cpp:109.)
这里的原因就是cuda 版本和pytorch的版本不匹配导致的
由于服务器端的驱动不好安装,这里只需要将你的项目的pytorch版本替换即可
命令行输入nvidia-smi查看cuda版本,我这里是10.2
在下面链接找到对应的pytorch版本
Previous PyTorch Versions | PyTorch
同时最好检查一下pytorch的版本符不符合项目要求
远程pip搭建环境即可
最后,八张卡同时训练,飞一般的感觉!