Fixed a while loop error in the trainer

The --pairs option was not handled correctly.