Fixing logic (#1734)

This commit is contained in:
Tian Wang 2020-05-06 02:07:26 +08:00 committed by GitHub
parent 2a2f303ae9
commit d6a0375974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -325,7 +325,7 @@ class TrainerTrainLoopMixin(ABC):
if self.reload_dataloaders_every_epoch:
self.reset_train_dataloader(model)
# set seed for distributed sampler (enables shuffling for each epoch)
if self.use_ddp or self.use_horovod \
if (self.use_ddp or self.use_horovod) \
and hasattr(self.train_dataloader.sampler, 'set_epoch'):
self.train_dataloader.sampler.set_epoch(epoch)