RuntimeError: cuda runtime error (35) : CUDA 驱动程序版本对于 Torch/csrc/cuda/Module.cpp:51 中的 CUDA 运行时版本不足

Tom*_*ale 1 python checkpointing pytorch

当我尝试加载 pytorch 检查点时:

checkpoint = torch.load(pathname)
Run Code Online (Sandbox Code Playgroud)

我懂了:

RuntimeError: cuda runtime error (35) : CUDA 驱动程序版本对于 Torch/csrc/cuda/Module.cpp:51 中的 CUDA 运行时版本不足

我用可用的 GPU 创建了检查点,但现在只有 CPU 可用。

如何加载检查点?

Tom*_*ale 7

将检查点数据加载到当前可用的最佳位置:

if torch.cuda.is_available():
    map_location=lambda storage, loc: storage.cuda()
else:
    map_location='cpu'

checkpoint = torch.load(pathname, map_location=map_location)
Run Code Online (Sandbox Code Playgroud)