Add `--sync-bn` known issue (#4032)
Browse files* Add `--sync-bn` known issue
* Update train.py
train.py
CHANGED
@@ -217,6 +217,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
|
|
217 |
|
218 |
# SyncBatchNorm
|
219 |
if opt.sync_bn and cuda and RANK != -1:
|
|
|
220 |
model = torch.nn.SyncBatchNorm.convert_sync_batchnorm(model).to(device)
|
221 |
logger.info('Using SyncBatchNorm()')
|
222 |
|
@@ -232,9 +233,9 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary
|
|
232 |
# Process 0
|
233 |
if RANK in [-1, 0]:
|
234 |
valloader = create_dataloader(val_path, imgsz_val, batch_size // WORLD_SIZE * 2, gs, single_cls,
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
|
239 |
if not resume:
|
240 |
labels = np.concatenate(dataset.labels, 0)
|
|
|
217 |
|
218 |
# SyncBatchNorm
|
219 |
if opt.sync_bn and cuda and RANK != -1:
|
220 |
+
raise Exception('can not train with --sync-bn, known issue https://github.com/ultralytics/yolov5/issues/3998')
|
221 |
model = torch.nn.SyncBatchNorm.convert_sync_batchnorm(model).to(device)
|
222 |
logger.info('Using SyncBatchNorm()')
|
223 |
|
|
|
233 |
# Process 0
|
234 |
if RANK in [-1, 0]:
|
235 |
valloader = create_dataloader(val_path, imgsz_val, batch_size // WORLD_SIZE * 2, gs, single_cls,
|
236 |
+
hyp=hyp, cache=opt.cache_images and not noval, rect=True, rank=-1,
|
237 |
+
workers=workers,
|
238 |
+
pad=0.5, prefix=colorstr('val: '))[0]
|
239 |
|
240 |
if not resume:
|
241 |
labels = np.concatenate(dataset.labels, 0)
|