Skip to content

Commit

Permalink
[Fix] Set the priority of EvalHook to "LOW" to avoid a bug of `Iter…
Browse files Browse the repository at this point in the history
…BasedRunner` (open-mmlab#488)

* Set the priority of EvalHook to LOW.

* add a comment
  • Loading branch information
okotaku authored Oct 20, 2021
1 parent c98302f commit acc5215
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mmcls/apis/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def train_model(model,
eval_cfg = cfg.get('evaluation', {})
eval_cfg['by_epoch'] = cfg.runner['type'] != 'IterBasedRunner'
eval_hook = DistEvalHook if distributed else EvalHook
runner.register_hook(eval_hook(val_dataloader, **eval_cfg))
# `EvalHook` needs to be executed after `IterTimerHook`.
# Otherwise, it will cause a bug if use `IterBasedRunner`.
# Refers to https://github.com/open-mmlab/mmcv/issues/1261
runner.register_hook(
eval_hook(val_dataloader, **eval_cfg), priority='LOW')

if cfg.resume_from:
runner.resume(cfg.resume_from)
Expand Down

0 comments on commit acc5215

Please sign in to comment.