I guess this line of code:
torch.set_default_tensor_type('torch.cuda.FloatTensor')

might be problematic, as it could use CUDA tensors inside the Dataset and thus inside each process, which could then fail due to using multiprocessing with multiple CUDA context instances.