Solved by chris1 in post #2 
              
              
                I managed to find the issue. It has nothing to do with the dataset or dataloader but with torch multiprocessing. I am using multiple GPUs and therefore call torch.multiprocessing.set_start_method('spawn') before running the training loop. 
If I don’t execute this command everything works fine.