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.

gpu训练后的模型在无gpu机器上面载入参数的时候
需要设置torch.load(map_loction=torch.device('cpu'))
posted @ 2021-10-27 09:52  小艾衰  阅读(532)  评论(0编辑  收藏  举报