浏览代码

Validate with 2x `--workers` single-GPU/CPU fix (#6659)

Fix for #6658 for single-GPU and CPU training use cases
modifyDataloader
Glenn Jocher GitHub 2 年前
父节点
当前提交
1ff43702a8
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      utils/datasets.py

+ 1
- 1
utils/datasets.py 查看文件

@@ -110,7 +110,7 @@ def create_dataloader(path, imgsz, batch_size, stride, single_cls=False, hyp=Non

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

正在加载...
取消
保存