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’}
Similar Posts:
- Error in loading pre training weight in torch. Load() in pytorch
- Solutions to errors encountered by Python
- Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
- [Solved] RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
- RuntimeError: cuda runtime error (30) : unknown errorr
- [Solved] torch.cuda.CudaError: CUDA driver version is insufficient for CUDA runtime version (35) [ WARN:0
- InternalError: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runti…
- [Solved] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
- [Solved] GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation
- [Solved] RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same