I am able to run the code (without that error) using a dummy dataset
class Dataset(torch.utils.data.Dataset):
    def __init__(self):
        super(Dataset, self).__init__()

    def __getitem__(self, i):
        return np.random.randn(5850, 256, 2).astype('float32')

    def __len__(self):
        return 100


trainloader = torch.utils.data.DataLoader(Dataset(), batch_size=8)
validloader = torch.utils.data.DataLoader(Dataset(), batch_size=8)

Can you show the dataset class as well as dataloader ?