Skip to content

Commit

Permalink
Fix mmcls bug not wrapping model in DataParallel on CPUs (#2601)
Browse files Browse the repository at this point in the history
Wrap multi-label and h-label classification models by MMDataParallel in case of CPU training.
---------
Signed-off-by: Songki Choi <songki.choi@intel.com>
  • Loading branch information
goodsong81 authored Nov 6, 2023
1 parent ba1a30d commit c22c683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ All notable changes to this project will be documented in this file.

- Update ModelAPI configuration(<https://github.com/openvinotoolkit/training_extensions/pull/2564>)
- Add Anomaly modelAPI changes (<https://github.com/openvinotoolkit/training_extensions/pull/2563>)

### Bug fixes

- Fix IBLoss enablement with DeiT-Tiny when class incremental training (<https://github.com/openvinotoolkit/training_extensions/pull/2595>)
- Fix mmcls bug not wrapping model in DataParallel on CPUs (<https://github.com/openvinotoolkit/training_extensions/pull/2601>)

## \[v1.4.3\]

Expand Down
4 changes: 4 additions & 0 deletions src/otx/algorithms/classification/adapters/mmcls/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ def _train_model(

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

if cfg.distributed:
Expand Down

0 comments on commit c22c683

Please sign in to comment.