set different seed in gan_dataset when it is multi-workers

This commit is contained in:
Eren Gölge 2021-04-08 11:13:28 +02:00
parent 6ee211c137
commit aee24b0704
1 changed files with 2 additions and 1 deletions

View File

@ -69,7 +69,8 @@ class GANDataset(Dataset):
cache acoustic features """
# set the seed differently for each worker
random.seed(torch.utils.data.get_worker_info().seed)
if torch.utils.data.get_worker_info():
random.seed(torch.utils.data.get_worker_info().seed)
if self.return_segments:
item1 = self.load_item(idx)