Skip to content

Commit

Permalink
Turn off persistent worker if num_worker is zero in classification ta…
Browse files Browse the repository at this point in the history
…sk (#2208)

* turn off persistent worker if num worker is zero

* update changelog
  • Loading branch information
eunwoosh authored May 31, 2023
1 parent 8a3efaa commit 8be9f2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
### Bug fixes

- Fix a bug that auto adapt batch size doesn't work with cls incr case (<https://github.com/openvinotoolkit/training_extensions/pull/2199>)
- Fix a bug that persistent worker is True even if num_workers is zero (<https://github.com/openvinotoolkit/training_extensions/pull/2208>)

### Known issues

Expand Down
4 changes: 3 additions & 1 deletion otx/algorithms/classification/adapters/mmcls/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,16 @@ def _infer_model(

# Data loader
mm_dataset = build_dataset(cfg.data.test)
workers_per_gpu = cfg.data.test_dataloader.get("workers_per_gpu", 0)
dataloader = build_dataloader(
mm_dataset,
samples_per_gpu=cfg.data.test_dataloader.get("samples_per_gpu", 1),
workers_per_gpu=cfg.data.test_dataloader.get("workers_per_gpu", 0),
workers_per_gpu=workers_per_gpu,
num_gpus=len(cfg.gpu_ids),
dist=cfg.distributed,
seed=cfg.get("seed", None),
shuffle=False,
persistent_workers=(workers_per_gpu > 0),
)

# Model
Expand Down

0 comments on commit 8be9f2c

Please sign in to comment.