Skip to content

Commit

Permalink
train.py: changing dataloder params given sampler
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelvalle committed Mar 19, 2019
1 parent f37998c commit ece7d3f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ def prepare_dataloaders(hparams):
valset = TextMelLoader(hparams.validation_files, hparams)
collate_fn = TextMelCollate(hparams.n_frames_per_step)

train_sampler = DistributedSampler(trainset) \
if hparams.distributed_run else None
if hparams.distributed_run:
train_sampler = DistributedSampler(trainset)
shuffle = False
else:
train_sampler = None
shuffle = True

train_loader = DataLoader(trainset, num_workers=1, shuffle=True,
train_loader = DataLoader(trainset, num_workers=1, shuffle=shuffle,
sampler=train_sampler,
batch_size=hparams.batch_size, pin_memory=False,
drop_last=True, collate_fn=collate_fn)
Expand Down

0 comments on commit ece7d3f

Please sign in to comment.