RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False.

错误信息:

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='cpu' to map your storages to the CPU.

 

错误语句:

model = torch.load('filename')

改为:

model = torch.load('filename',map_location = 'CPU')

 

posted @ 2022-04-15 20:16  liyuSCU  阅读(2215)  评论(0编辑  收藏  举报