RuntimeError: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start.
在import torch的时候就报了这个错,试了一下在程序中设置环境变量并不能解决这个问题。
最终解决方案:
sudo apt-get install nvidia-modprobe