Thank you for that information.
I can’t provide a link to the full script because it is quite long, but here’s a partial one of the call to the training of the model.

  
      gist.github.com
  
  
    https://gist.github.com/Freyj/30b937f7a32079c3b100ef49c52ea6a4 9
partial.py
#check gpu availability, can force cpu use with -1 as gpu                                                                                                                                                       
    cuda = torch.cuda.is_available()
    if cuda and gpu_to_use > -1:
        use_cuda = True
        torch.cuda.device(gpu_to_use)
        torch.cuda.seed()
        device = torch.device("cuda", gpu_to_use)
        print("Using CUDA.")
    else:
        use_cuda = False
This file has been truncated. show original




  
  
    
    
  
  


This gist has two revisions, the first one without the modifications to take into account what you said about torch.cuda.device, and the second, current one the modification with the
with torch.cuda.device(gpu_to_use):
but I am not entirely sure it should not be elsewhere.