运行时错误:没有可用的 CUDA GPU

AFB*_*AFB 5 python gpu anaconda pytorch

我想在我的笔记本电脑中训练 gpt2 模型,并且我的笔记本电脑中有一个 GPU,我的操作系统是 windows ,但我总是在 python 中遇到此错误:

torch._C._cuda_init()
RuntimeError: No CUDA GPUs are available
Run Code Online (Sandbox Code Playgroud)

当我尝试在 python 控制台中检查 GPU 的可用性时,我得到了答案:

import torch
torch.cuda.is_available()
Out[4]: True
Run Code Online (Sandbox Code Playgroud)

但我无法获取版本

nvcc version 
#or  nvcc --version
NameError: name 'nvcc' is not defined
Run Code Online (Sandbox Code Playgroud)

我使用这个命令来安装CUDA

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch  
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能让 GPU 可用于 python?

小智 -4

确保您已安装 CUDA。对我来说,我从 NVIDIA 目录安装它:https ://developer.nvidia.com/cuda-downloads