Skip to content

Commit

Permalink
ref: inner train loop (intermediate step) 12/n (#3371)
Browse files Browse the repository at this point in the history
* ref: inner train loop (intermediate step) 12/n

* ref: inner train loop (intermediate step) 12/n

* ref: inner train loop (intermediate step) 12/n
  • Loading branch information
williamFalcon authored Sep 6, 2020
1 parent 8eef97c commit d091faf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pytorch_lightning/trainer/training_loop_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ def on_train_epoch_start(self, epoch):
model = self.trainer.get_model()

# set seed for distributed sampler (enables shuffling for each epoch)
# TODO: move to accelerators
if (self.trainer.use_ddp or self.trainer.use_horovod or self.trainer.on_tpu) \
and hasattr(self.trainer.train_dataloader, 'sampler') \
and hasattr(self.trainer.train_dataloader.sampler, 'set_epoch'):
try:
self.trainer.train_dataloader.sampler.set_epoch(epoch)
except Exception:
pass

# update training progress in trainer and model
model.current_epoch = epoch
Expand Down

0 comments on commit d091faf

Please sign in to comment.