Do you set persistent_workers to True when you construct the DataLoader instance?
I have encountered an error when both persistent_workers and pin_memory are set to True, and num_workers is more than zero. Perhaps you are hitting the same issue?
I don’t remember the exact error message now, but if you are facing the same issue as I did, setting persistent_workers to False may make it go away.