Detectron2 dataloader training in parallel num_workers (“process exited unexpectedly”)

When training on different GPUs on the same server, I get errors like RuntimeError: DataLoader worker (pid 30141) exited unexpectedly with exit code 1.

The fix was to set the number of workers to 0: 1

cfg.DATALOADER.NUM_WORKERS = 2