EOFError in PyTorch loader

I am trying to load a dataset using the pytorch’s data loader. When I run

for batch_idx, (data, label) in enumerate(loader):
    <rest of the code>

I get the following error:

Exception has occurred: EOFError (note: full exception trace is shown but execution is paused at: )
Ran out of input
File “”, line 1, in (Current frame)

I don’t know what’s wrong. The same dataset runs elsewhere, and I can also see some values in loader.dataset.data.shape and loader.dataset.label with correct values.

Any help?

The EOFError is usually raised by the data loading. Does the stacktrace show more information which line of code is failing?

There is no more information unfortunately, and no info about which line is causing the error. However, when I debug and try to get the first batch of (data, label) in the for loop, it causes this error.