I had a similar issue but in a multi-gpu system. I resolved it by using CUDA_VISIBLE_DEVICES=0 i.e. using a single gpu, it seems like DataParallel was not able to gather outputs from multiple gpus but it’s fine since I wanted to run it on a single gpu.