RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1.

发布时间 2023-10-16 14:57:08作者: Liang-ml

问题:服务器上多块卡,使用其中一张训练的模型,在本地预测的时候报错。

解决:在torch.load中加入map_location,指定一块卡