From 45ffb9e62af85ea1197f53f19e7caa8da79a2961 Mon Sep 17 00:00:00 2001 From: JIAKUNHAO Date: Wed, 23 Nov 2022 20:34:10 +0800 Subject: [PATCH] =?UTF-8?q?GPU=E9=80=89=E6=8B=A9debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/yolov5/train_server.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/yolov5/train_server.py b/app/yolov5/train_server.py index 3a18779..15548ff 100644 --- a/app/yolov5/train_server.py +++ b/app/yolov5/train_server.py @@ -610,16 +610,16 @@ def main(opt,data_list,id,callbacks=Callbacks()): # DDP mode device = select_device(opt.device, batch_size=opt.batch_size) print(device.type) - if LOCAL_RANK != -1: - msg = 'is not compatible with YOLOv5 Multi-GPU DDP training' - assert not opt.image_weights, f'--image-weights {msg}' - assert not opt.evolve, f'--evolve {msg}' - assert opt.batch_size != -1, f'AutoBatch with --batch-size -1 {msg}, please pass a valid --batch-size' - assert opt.batch_size % WORLD_SIZE == 0, f'--batch-size {opt.batch_size} must be multiple of WORLD_SIZE' - assert torch.cuda.device_count() > LOCAL_RANK, 'insufficient CUDA devices for DDP command' - torch.cuda.set_device(LOCAL_RANK) - device = torch.device('cuda', LOCAL_RANK) - dist.init_process_group(backend="nccl" if dist.is_nccl_available() else "gloo") + # if LOCAL_RANK != -1: + # msg = 'is not compatible with YOLOv5 Multi-GPU DDP training' + # assert not opt.image_weights, f'--image-weights {msg}' + # assert not opt.evolve, f'--evolve {msg}' + # assert opt.batch_size != -1, f'AutoBatch with --batch-size -1 {msg}, please pass a valid --batch-size' + # assert opt.batch_size % WORLD_SIZE == 0, f'--batch-size {opt.batch_size} must be multiple of WORLD_SIZE' + # assert torch.cuda.device_count() > LOCAL_RANK, 'insufficient CUDA devices for DDP command' + # torch.cuda.set_device(LOCAL_RANK) + # device = torch.device('cuda', LOCAL_RANK) + # dist.init_process_group(backend="nccl" if dist.is_nccl_available() else "gloo") # Train if not opt.evolve: