Fix the number of training batches used in the training loop (#653)

* Fix the number of processed training batches

* Fix tests

* fix tests

* fix tests

* One more attempt

* Fix another test
This commit is contained in:
Vadim Bereznyuk
2020-01-05 14:37:09 -05:00
committed by William Falcon
parent 7824b5c5f5
commit 12edc3099c
4 changed files with 9 additions and 10 deletions
+4 -5
View File
@@ -367,6 +367,10 @@ class TrainerTrainLoopMixin(ABC):
# run epoch
for batch_idx, batch in enumerate(self.get_train_dataloader()):
# stop epoch if we limited the number of training batches
if batch_idx >= self.num_training_batches:
break
self.batch_idx = batch_idx
model = self.get_model()
@@ -413,11 +417,6 @@ class TrainerTrainLoopMixin(ABC):
if early_stop_epoch or self.fast_dev_run:
break
# stop epoch if we limited the number of training batches
met_batch_limit = batch_idx >= self.num_training_batches
if met_batch_limit:
break
# epoch end hook
if self.is_function_implemented('on_epoch_end'):
model = self.get_model()