Skip to content

Commit 8be9f2c

Browse files
authored
Turn off persistent worker if num_worker is zero in classification task (#2208)
* turn off persistent worker if num worker is zero * update changelog
1 parent 8a3efaa commit 8be9f2c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
1111
### Bug fixes
1212

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

1516
### Known issues
1617

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,16 @@ def _infer_model(
252252

253253
# Data loader
254254
mm_dataset = build_dataset(cfg.data.test)
255+
workers_per_gpu = cfg.data.test_dataloader.get("workers_per_gpu", 0)
255256
dataloader = build_dataloader(
256257
mm_dataset,
257258
samples_per_gpu=cfg.data.test_dataloader.get("samples_per_gpu", 1),
258-
workers_per_gpu=cfg.data.test_dataloader.get("workers_per_gpu", 0),
259+
workers_per_gpu=workers_per_gpu,
259260
num_gpus=len(cfg.gpu_ids),
260261
dist=cfg.distributed,
261262
seed=cfg.get("seed", None),
262263
shuffle=False,
264+
persistent_workers=(workers_per_gpu > 0),
263265
)
264266

265267
# Model

0 commit comments

Comments
 (0)