From 1b3ba8534433266665365c5e7b8ef2d1d783a826 Mon Sep 17 00:00:00 2001 From: Eunwoo Shin Date: Wed, 26 Apr 2023 18:41:16 +0900 Subject: [PATCH] Bug fix: Progress goes 100% and back 0 % repeatedly during auto decrease bs in Geti (#2074) * disable OTXProgressHook * align with pre commit --- .../common/adapters/mmcv/utils/automatic_bs.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/otx/algorithms/common/adapters/mmcv/utils/automatic_bs.py b/otx/algorithms/common/adapters/mmcv/utils/automatic_bs.py index c45b490ff30..a4578d35094 100644 --- a/otx/algorithms/common/adapters/mmcv/utils/automatic_bs.py +++ b/otx/algorithms/common/adapters/mmcv/utils/automatic_bs.py @@ -64,10 +64,15 @@ def train_func_single_iter(batch_size): else: copied_cfg.runner["max_epochs"] = 1 - if not validate: # disable validation - for hook in copied_cfg.custom_hooks: - if hook["type"] == "AdaptiveTrainSchedulingHook": - hook["enable_eval_before_run"] = False + otx_prog_hook_idx = None + for i, hook in enumerate(copied_cfg.custom_hooks): + if not validate and hook["type"] == "AdaptiveTrainSchedulingHook": + hook["enable_eval_before_run"] = False + elif hook["type"] == "OTXProgressHook": + otx_prog_hook_idx = i + + if otx_prog_hook_idx is not None: + del copied_cfg.custom_hooks[otx_prog_hook_idx] new_datasets = [SubDataset(datasets[0], batch_size)]