pythonpytorchcheckpointing

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


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?


Solution

  • 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)