-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 a bug where logs are missing when two or more loggers were set #1015
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1015 +/- ##
==========================================
+ Coverage 64.57% 64.59% +0.02%
==========================================
Files 152 152
Lines 9792 9796 +4
Branches 1779 1779
==========================================
+ Hits 6323 6328 +5
- Misses 3141 3142 +1
+ Partials 328 326 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This modification is very helpful and makes the logger system robust in some cases. Currently, most users write the config file like: log_config = dict(
interval=100,
hooks=[
dict(type='TextLoggerHook'),
dict(type='TensorboardLoggerHook')]) Thus, they will not meet the bug mentioned in this PR. However, once we change the order of the hooks like this: log_config = dict(
interval=100,
hooks=[
dict(type='TensorboardLoggerHook'),
dict(type='TextLoggerHook')]) The |
Hi @ritosonn !First of all, we want to express our gratitude for your significant PR in the MMCV project. Your contribution is highly appreciated, and we are grateful for your efforts in helping improve this open-source project during your personal time. We believe that many developers will benefit from your PR. We would also like to invite you to join our Special Interest Group (SIG) private channel on Discord, where you can share your experiences, ideas, and build connections with like-minded peers. To join the SIG channel, simply message moderator— OpenMMLab on Discord or briefly share your open-source contributions in the #introductions channel and we will assist you. Look forward to seeing you there! Join us :https://discord.gg/UjgXkPWNqA If you have WeChat account,welcome to join our community on WeChat. You can add our assistant :openmmlabwx. Please add "mmsig + Github ID" as a remark when adding friends:) |
Motivation
When the users want to check multi-logs like both the CLI and the other (like tensorboard, wandb, mlflow), current implementation may be missing some values because of their
reset_flag
option. This PR fixed these bugs.Modification
this PR includes 2 commits.
LoggerHook.before_run(runner)
set a flag whetherself
is the last logger or not. Then, otherLoggerHook
s have to call this method.reset_flag
s should be initializedFalse
in order tobefore_run()
works well.BC-breaking (Optional)
nothing.
Use cases (Optional)
For example, using
MlflowLoggerHook
andTextLoggerHook
as follows:original output: both
LoggerHook
s resets the values, thenTextLoggerHook
miss to print some logging values.assumed output & fixed output: only
TextLoggerHook
reset the values.Checklist
pre-commit
environment, and visually checked.