class AUCMLoss(torch.nn.Module):
def __init__(self,
margin=1.0,
imratio=None,
version='v1',
device=None):
super(AUCMLoss, self).__init__()
if not device:
self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
else:
self.device = device
The lightning framework supports the use of multiple devices, and users who do not use the framework can use the to method to move to the desired device, and the "device" parameter makes the lightning framework use RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:2 and cuda:0!
So I suggest removing the "device" parameter