你好,我最近开始使用 pytorch,但现在我需要使用我的 GPU,即 Nvidia GTX 1050ti 来处理一些数据,但不幸的是 torch.cuda.is_available() 返回 False 我尝试卸载 cudatoolkit 11.3 并降级它到
11.1
并使用 conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia -c conda-forge
删除并重新安装 pytorch,以下是有关我的本地配置的一些信息:
OS : windows 10
graphical card : nvidia 1050ti
current nvidia driver : 465.89
>>> torch.version.cuda
'11.1'
>>> torch.cuda.is_available()
False
>>> torch.backends.cudnn.enabled
True
>>> torch.__version__
'1.8.1'
-> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Tue_Sep_15_19:12:04_Pacific_Daylight_Time_2020
Cuda compilation tools, release 11.1, V11.1.74
Build cuda_11.1.relgpu_drvr455TC455_06.29069683_0
您可能下载的是单CPU版本。
您是否尝试过使用 pip 和稳定的 pytorch 版本来安装它?
pip install torch torchvision -f https://download.pytorch.org/whl/torch_stable.html
确保之前清除你的 pip 缓存,这样你就不会安装相同的 chached 轮子:
pip uninstall torch
pip chache purge
然后运行上述安装指令。
就我而言,我的卡是
GTX 1050
,更新nvidia driver
到最新版本566.03
后,退出python控制台并重新启动python,torch.cuda.is_available()
从false
更改为true
,这个答案很有用