首页 > 解决方案 > RuntimeError: cuda 运行时错误 (35) : CUDA 驱动程序版本对于torch/csrc/cuda/Module.cpp:51 的CUDA 运行时版本不足

问题描述

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

checkpoint = torch.load(pathname)

我懂了:

RuntimeError: cuda 运行时错误 (35) : CUDA 驱动程序版本对于torch/csrc/cuda/Module.cpp:51 的CUDA 运行时版本不足

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

如何加载检查点?

标签: pythonpytorchcheckpointing

解决方案


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

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

checkpoint = torch.load(pathname, map_location=map_location)

推荐阅读