From f9944662898e1192277aa2c3b2cfc38e4d10437e Mon Sep 17 00:00:00 2001 From: James Betker Date: Sun, 10 May 2020 10:49:37 -0600 Subject: [PATCH] Initialize test dataloader with a worker count proportional to the batch size. --- codes/data/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/data/__init__.py b/codes/data/__init__.py index ca59477a..cc1d9e86 100644 --- a/codes/data/__init__.py +++ b/codes/data/__init__.py @@ -22,7 +22,7 @@ def create_dataloader(dataset, dataset_opt, opt=None, sampler=None): pin_memory=False) else: batch_size = dataset_opt['batch_size'] or 1 - return torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=False, num_workers=0, + return torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=False, num_workers=int(batch_size/2), pin_memory=False)