The code looks OK (not sure if the progress_bar is relevant, but I just ignore it), so you would need to add the print statements to your code after creating the Dataset and DataLoader.
In particular, add these lines:
print('len(dataset) ', len(dataset))
print('len(loader) ', len(loader))
print('expected number of batches {}'.format(
    math.ceil(N / batch_size)))

before executing the training loop and post these numbers here.