MJ2*_*410 3 python pytorch google-colaboratory
我正在尝试在 google colab 中使用 GPU。以下是我的 colab 中安装的 pytorch 和 cuda 版本的详细信息。
Torch 1.3.1 CUDA 10.1.243
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130
Run Code Online (Sandbox Code Playgroud)
我对使用 GPU 在 pytorch 模型上进行迁移学习还很陌生。我的 torch.cuda.is_available() 返回 false,我无法使用 GPU。torch.backends.cudnn.enabled 返回 true。这里可能出了什么问题?
万一其他人来到这里犯了我所犯的同样的错误:
如果您尝试检查 GPU 是否可用并且您这样做:
if torch.cuda.is_available:
print('GPU available')
else:
print('Please set GPU via Edit -> Notebook Settings.')
Run Code Online (Sandbox Code Playgroud)
GPU 似乎总是可用的。请注意,您需要使用torch.cuda.is_available()
not torch.cuda.is_available
。