Skip to content

Commit c22c683

Browse files
author
Songki Choi
authored
Fix mmcls bug not wrapping model in DataParallel on CPUs (#2601)
Wrap multi-label and h-label classification models by MMDataParallel in case of CPU training. --------- Signed-off-by: Songki Choi <[email protected]>
1 parent ba1a30d commit c22c683

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ All notable changes to this project will be documented in this file.
88

99
- Update ModelAPI configuration(<https://github.com/openvinotoolkit/training_extensions/pull/2564>)
1010
- Add Anomaly modelAPI changes (<https://github.com/openvinotoolkit/training_extensions/pull/2563>)
11+
12+
### Bug fixes
13+
1114
- Fix IBLoss enablement with DeiT-Tiny when class incremental training (<https://github.com/openvinotoolkit/training_extensions/pull/2595>)
15+
- Fix mmcls bug not wrapping model in DataParallel on CPUs (<https://github.com/openvinotoolkit/training_extensions/pull/2601>)
1216

1317
## \[v1.4.3\]
1418

src/otx/algorithms/classification/adapters/mmcls/task.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ def _train_model(
381381

382382
# Model
383383
model = self.build_model(cfg, fp16=cfg.get("fp16", False))
384+
if not torch.cuda.is_available():
385+
# NOTE: mmcls does not wrap models w/ DP for CPU training not like mmdet
386+
# Raw DataContainer "img_metas" is exposed, which results in errors
387+
model = build_data_parallel(model, cfg, distributed=False)
384388
model.train()
385389

386390
if cfg.distributed:

0 commit comments

Comments
 (0)