Solved by ptrblck in post #4 
              
              
                I don’t know why shuffle=True should raise the error only, as it seems that your dataset might be empty. 
While creating the DataLoader a RandomSampler or SequentialSampler will be created if shuffle is set to True or False, respectively, and no custom sampler is passed as seen here. 
In both cases …