错误描述:
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.
解决方法:
torch.load(model_path) # 改为 torch.load(model_path, map_location='cpu')
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:PyTorch错误解决RuntimeError: Attempting to deserialize object on a CUDA device but torch.cu - Python技术站