ValueError: `Dataloader` returned 0 length. Please make sure that your Dataloader at least returns 1 batch

I am trying to train on a sample number of examples, for quick testing. I do an 80/10/10 train/val/test split. I am using pytorch lightning.

With 10000 examples, and batchsize 4, I am fine.

However, with 1000 examples, I get this error:

ValueError: `Dataloader` returned 0 length. Please make sure that your Dataloader at least returns 1 batch

Why? I have verified that I have a Dataset of size 800 for train, 100 for val, and 100 for test. This is in the trainer

/usr/local/lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py in _has_len(dataloader)
     47         # try getting the length
     48         if len(dataloader) == 0:
---> 49             raise ValueError('`Dataloader` returned 0 length.'
     50                              ' Please make sure that your Dataloader at least returns 1 batch')
     51         return True

ValueError: `Dataloader` returned 0 length. Please make sure that your Dataloader at least returns 1 batch
1 Like

Please share your code so that we can see the error and rectify it.