python - 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 可用。
如何加载检查点?
解决方案
将检查点数据加载到当前可用的最佳位置:
if torch.cuda.is_available():
map_location=lambda storage, loc: storage.cuda()
else:
map_location='cpu'
checkpoint = torch.load(pathname, map_location=map_location)
推荐阅读
- asp.net - 除了第一页,fancybox 不适用于 aspxgridview 页面
- vb.net - 如何使用 vb.net 或任何其他方式单击从多个文件夹中打开 .exe 文件?
- linux - 是否有平台独立的非阻塞方式来判断文件描述符是否是磁盘文件(常规/目录)
- java - 将变量从一种方法传递到另一种方法?
- react-native - 我正在使用 EXPO.IO 处理本机项目,今天它给出了错误 Unable to resolve module @babel
- php - 使用数据提供者时压倒性的 testdox 输出(具有大量数据集)
- html - 我正在尝试设置范围输入的拇指样式,但 webkit 不起作用
- c# - 如果 Employee 存在,则使用 ADO.net 返回员工角色
- php - 将 CakePHP 网站升级到 PHP 7
- c# - 将 AllowsTransparency 属性设置为 true 的 WPF 窗口