Hi, I have met a similar error, and  setting num_workers=0 solves my problem. Note the warning of DistributedDataParallel in the documentation:
If you plan on using this module with a  nccl  backend or a  gloo  backend (that uses Infiniband), together with a DataLoader that uses multiple workers, please change the multiprocessing start method to  forkserver  (Python 3 only) or  spawn . Unfortunately Gloo (that uses Infiniband) and NCCL2 are not fork safe, and you will likely experience deadlocks if you don’t change this setting.
I think use multiprocessing.set_start_method('forkserver') will also work, I will try this method later.