I have two GPUs and when I run
import torch
print('count: ', torch.cuda.device_count()) # prints count: 2
However, my model throws an error
RuntimeError: Attempting to deserialize object on CUDA device 2 but torch.cuda.device_count() is 1
on the line
torch.load(model_path, map_location='cuda:1')
What could cause it and how to fix it?
This issue is somehow linked to my Flask, because the training itself works with torch.load(model_path, map_location='cuda:1')