How are you assigning self.steps_per_epoch
? Perhaps this is the wrong value.
I doubt that this is the problem, but perhaps the 2 extra steps are coming from the 2 steps performed during the sanity check. You could check if this is the case by setting trainer = Trainer(num_sanity_val_steps=0)
.