Ok,
So it is something in your actual script that causes this.
Could you disable the DataParallel? It will run on only one of the 4 available gpus but that should work.
When this is disabled, do you still see the gpus disapear while the script runs?
Also what do you mean by “Dataparallel using 20 workers.” there is no notion of workers for DataParallel. Do you repeat some gpus in the device_ids list? If so try and set each gpu once and see what it does.