-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Set the priority of EvalHook
to "LOW" to avoid a bug of IterBasedRunner
#488
Conversation
Codecov Report
@@ Coverage Diff @@
## master #488 +/- ##
==========================================
+ Coverage 77.96% 78.51% +0.54%
==========================================
Files 102 102
Lines 5619 5612 -7
Branches 923 915 -8
==========================================
+ Hits 4381 4406 +25
+ Misses 1111 1087 -24
+ Partials 127 119 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Usually classification tasks use |
Yes, I encountered this error when I used the |
@@ -151,7 +151,8 @@ 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)) | |||
runner.register_hook( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment here to describe why the priority
needs to be set as 'LOW'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example,
# `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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
EvalHook
to "LOW" to avoid a bug of IterBasedRunner
…BasedRunner` (open-mmlab#488) * Set the priority of EvalHook to LOW. * add a comment
Motivation
If the priority of EvalHook is higher than IterTimerHook, it will cause KeyError: 'data_time' (open-mmlab/mmsegmentation#758, open-mmlab/mmcv#1261).
Since the time key will add to the output of log_buffer after IterTimeHook, the TextLoggerHook will print the time and data_time at the same time.
This PR is based on open-mmlab/mmsegmentation#766 open-mmlab/mmdetection#5882 .
This PR will be useful for models that uses IterBasedRunner.
Modification
Set the priority of EvalHook to LOW.
BC-breaking (Optional)
Does the modification introduce changes that break the backward compatibility of the downstream repositories?
No
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here and update the documentation.
Checklist
Before PR:
After PR: