From ece7d3f5681bf8fe46a6c3e5293bf8c5aab6cbce Mon Sep 17 00:00:00 2001 From: Rafael Valle Date: Tue, 19 Mar 2019 13:47:01 -0700 Subject: [PATCH] train.py: changing dataloder params given sampler --- train.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/train.py b/train.py index 4287016..b612b9a 100644 --- a/train.py +++ b/train.py @@ -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)