2

When I try to load a pytorch checkpoint:

checkpoint = torch.load(pathname)

I see:

RuntimeError: cuda runtime error (35) : CUDA driver version is insufficient for CUDA runtime version at torch/csrc/cuda/Module.cpp:51

I created the checkpoint with a GPU available, but now only have CPU available.

How do I load the checkpoint?

talonmies
  • 70,661
  • 34
  • 192
  • 269
Tom Hale
  • 40,825
  • 36
  • 187
  • 242

1 Answers1

8

Load the checkpoint data to the best currently available location:

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

checkpoint = torch.load(pathname, map_location=map_location)
Tom Hale
  • 40,825
  • 36
  • 187
  • 242