Error: runtimeerror: attempting to deserialize object on CUDA device 2 but torch.cuda.device_count() is 1
reason: an error is reported when loading the model using pytoch. The loaded model is trained with two GPUs, while the computer loading the model has only one GPU, so an error will occur
solution: model = torch.load (model)_path)
is changed to: model = torch.load (model)_path, map_location =’cuda: 0 ‘)
if it is 4 to 2 blocks: put the map_change location to: Map_location={‘cuda:1’: ‘cuda:0’}