一般是因为pytorch的CUDA版本和服务器能用的不匹配导致的:
版本查询:
nvcc --version
结果:
(mamba) robot@robot-X10SRA:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0
支持到11.7,torch版本当时是2.1.1,太高了,更换成了下面这个:
pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116
参考:
conda环境下Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions问题解决-CSDN博客