Maybe you should use replace “cuda:2” with “gpu:2” ?
Moreover, you can also change used GPU with a torch.cuda.device() or torch.cuda.set_device() 3.
You can refer this 2 to set up and run CUDA operations.