Skip to content

Commit c43f135

Browse files
authored
Update nw to max(nd, 1) (#6714)
1 parent 4de8b24 commit c43f135

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def create_dataloader(path, imgsz, batch_size, stride, single_cls=False, hyp=Non
110110

111111
batch_size = min(batch_size, len(dataset))
112112
nd = torch.cuda.device_count() # number of CUDA devices
113-
nw = min([os.cpu_count() // max(nd // 2, 1), batch_size if batch_size > 1 else 0, workers]) # number of workers
113+
nw = min([os.cpu_count() // max(nd, 1), batch_size if batch_size > 1 else 0, workers]) # number of workers
114114
sampler = None if rank == -1 else distributed.DistributedSampler(dataset, shuffle=shuffle)
115115
loader = DataLoader if image_weights else InfiniteDataLoader # only DataLoader allows for attribute updates
116116
return loader(dataset,

0 commit comments

Comments
 (0)