Skip to content
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

support print hooks before running. #1123

Merged
merged 10 commits into from
Jun 25, 2021

Conversation

mzr1996
Copy link
Member

@mzr1996 mzr1996 commented Jun 22, 2021

Motivation

Now, hooks are added in silence, so it's not convenient to observe which hooks are used and the execution order.

Modification

This PR will print stage-wise hook info in the order of execution and print their priority, like

2021-06-22 16:10:31,951 - mmcls - INFO - Start running, host: xxx, work_dir: /home/xxx/work_dirs
2021-06-22 16:10:31,951 - mmcls - INFO - Use hooks (Hooks will be executed in the following order):
before_run:
(VERY_HIGH   ) CosineAnnealingLrUpdaterHook       
(NORMAL      ) CheckpointHook                     
(NORMAL      ) EvalHook                           
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_train_epoch:
(VERY_HIGH   ) CosineAnnealingLrUpdaterHook       
(NORMAL      ) EvalHook                           
(LOW         ) IterTimerHook                      
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_train_iter:
(VERY_HIGH   ) CosineAnnealingLrUpdaterHook       
(NORMAL      ) EvalHook                           
(LOW         ) IterTimerHook                      
 -------------------- 
after_train_iter:
(ABOVE_NORMAL) OptimizerHook                      
(NORMAL      ) CheckpointHook                     
(NORMAL      ) EvalHook                           
(LOW         ) IterTimerHook                      
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
after_train_epoch:
(NORMAL      ) CheckpointHook                     
(NORMAL      ) EvalHook                           
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_val_epoch:
(LOW         ) IterTimerHook                      
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
before_val_iter:
(LOW         ) IterTimerHook                      
 -------------------- 
after_val_iter:
(LOW         ) IterTimerHook                      
 -------------------- 
after_val_epoch:
(VERY_LOW    ) TextLoggerHook                     
 -------------------- 
2021-06-22 16:10:31,951 - mmcls - INFO - workflow: [('train', 1)], max: 300 epochs

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@codecov
Copy link

codecov bot commented Jun 22, 2021

Codecov Report

Merging #1123 (40a1d7b) into master (eb08835) will increase coverage by 0.20%.
The diff coverage is 95.45%.

❗ Current head 40a1d7b differs from pull request most recent head 98f488d. Consider uploading reports for the commit 98f488d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1123      +/-   ##
==========================================
+ Coverage   67.74%   67.95%   +0.20%     
==========================================
  Files         159      159              
  Lines       10337    10417      +80     
  Branches     1873     1896      +23     
==========================================
+ Hits         7003     7079      +76     
- Misses       2966     2969       +3     
- Partials      368      369       +1     
Flag Coverage Δ
unittests 67.95% <95.45%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmcv/utils/__init__.py 88.23% <ø> (ø)
mmcv/runner/base_runner.py 78.30% <92.30%> (+0.83%) ⬆️
mmcv/utils/config.py 90.38% <94.87%> (+0.50%) ⬆️
mmcv/runner/epoch_based_runner.py 82.85% <100.00%> (+0.16%) ⬆️
mmcv/runner/hooks/hook.py 96.29% <100.00%> (+0.94%) ⬆️
mmcv/runner/iter_based_runner.py 57.14% <100.00%> (+0.30%) ⬆️
mmcv/runner/priority.py 71.42% <100.00%> (+3.00%) ⬆️
mmcv/utils/misc.py 95.23% <100.00%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb08835...98f488d. Read the comment docs.

mmcv/runner/hooks/hook.py Outdated Show resolved Hide resolved
mmcv/runner/hooks/hook.py Outdated Show resolved Hide resolved
@mzr1996 mzr1996 requested a review from ZwwWayne June 25, 2021 03:52
mmcv/utils/misc.py Outdated Show resolved Hide resolved
@mzr1996 mzr1996 requested a review from innerlee June 25, 2021 09:36
mmcv/runner/hooks/hook.py Outdated Show resolved Hide resolved
@ZwwWayne ZwwWayne merged commit 1b15f02 into open-mmlab:master Jun 25, 2021
@mzr1996 mzr1996 deleted the print-using-hooks branch June 28, 2021 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants