Invalid device id error

Im trying to get predictions from my model using multiple GPU’s for which i have,

model = retinanet
model = torch.nn.DataParallel(model, device_ids =[ 0,2])

But when i run this i get ,

AssertionError: Invalid device id 

Both those device ids are valid, I’m not sure whats going on here, any suggestions would be helpful, Thanks in advance.

You can try the suggestion of setting CUDA_VISIBLE_DEVICES as given in this post