Issue with device Id

Hello. I am getting invalid device id in
image
But
image
Can you help me?

You’re probably evaluating torch.device as an index but it’s an object

>>> torch.cuda.device_count()
2
>>> device = torch.device("cuda:0")
>>> device
device(type='cuda', index=0)
>>> device.index
0