记录
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device(‘cpu’) to map your storages to the CPU.
解决:
在torch/storage.py 更改函数 _load_from_bytes
def _load_from_bytes(b):
return torch.load(io.BytesIO(b), map_location=torch.device(‘cpu’))