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

Posted AI浩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1.(相关的知识,希望对你有一定的参考价值。

出现这样的原因是因为我用了第二块GPU训练,在另一台机器上加载模型的时候,没有了第二块GPU,这时候就要指定用“cuda:0”
torch.load('./modelSubmit/encoder_48.pth.tar',map_location='cuda:0')

然后加载模型就正常了。

以上是关于RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1.(的主要内容,如果未能解决你的问题,请参考以下文章

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

解决问题:RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available()

解决问题:RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available()

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

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

Spark bind on port 0. Attempting port 1 问题解决