Reason: Pytorch and CUDA versions are not right
(It is also possible that there is not enough memory space, you can change the virtual space size)
Uninstall Pytorch: Conda Uninstall Pytorch, and if you install CUDA, it will automatically override the CUDA version.
Open CMD and type from the command line
import torch
print(torch.__version__)
print(torch.version.cuda)
Similar errors occur if the cudA version is not installed with the torch version.
Here’s how to install CUDA:
1. Open the NVIDIA control panel to view the CUDA version supported by the current video card driver:
2. Download CUDA address
https://developer.nvidia.com/cuda-toolkit-archive
Or offline installation package download required in https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/. Tar..bz2
Background Conda Install XXXX.. tar.bz2
Install after installation is complete
First anaconda Conda switches to the domestic source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --set show_channel_urls yes
Conda Install Pytorch Torchvision Cudatoolkit =10.0
Install other packages
Pytorch official website: Pytorch official website
Download according to the actual situation:
3. After successful download, double-click the exe file to install.
The verification method for successful installation is to enter nvcc-v
under CMD
The installation was successful. You can see in system variables:
Or you can see nvCC.exe under the installation path