mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-11 12:31:23 +08:00
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:
committed by
William Falcon
parent
7824b5c5f5
commit
12edc3099c
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user