-
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] Fix wandb logger drop result bug #913
[Fix] Fix wandb logger drop result bug #913
Conversation
Advice: |
Although it works, the step don't equals self._iter anymore. |
Hi @shenmishajing |
"You can also set commit=False in wandb.log to accumulate metrics, just be sure to call wandb.log without the commit flag to persist the metrics." |
@master_only
def log(self, runner):
tags = self.get_loggable_tags(runner)
# if tags:
# self.wandb.log(
# tags, step=self.get_iter(runner), commit=self.commit)
if tags:
tags['global_step'] =self.get_iter(runner)
self.wandb.log(
tags, commit=self.commit) |
Does it matter? I didn't pay attention to the meaning of step var when I use wandb.
yep, if we use the @master_only
def log(self, runner):
tags = self.get_loggable_tags(runner)
if tags:
self.wandb.log(
tags, step=self.get_iter(runner), commit=self.commit) change to @master_only
def log(self, runner, commit=True):
tags = self.get_loggable_tags(runner)
if tags:
self.wandb.log(
tags, step=self.get_iter(runner) + 0 if commit else 1, commit=commit) And we have to rewrite after_val_epoch func like follows: def after_val_epoch(self, runner):
runner.log_buffer.average()
self.log(runner, commit=False)
if self.reset_flag:
runner.log_buffer.clear_output() Well, I think it is a little bit ugly, how about you? We can use it if you gays can accept the magic |
@master_only
def log(self, runner):
tags = self.get_loggable_tags(runner)
# if tags:
# self.wandb.log(
# tags, step=self.get_iter(runner), commit=self.commit)
if tags:
tags['global_step'] =self.get_iter(runner)
self.wandb.log(
tags, commit=self.commit) We can choose "global_step" as the x-axis in the graphs or do nothing. |
I approve this. |
If user doesn't use 'val' pipeline, this PR will change the original behavior. |
If user doesn't use 'val' pipeline, wandb logger will log once every train iter, so wandb step will always equal to self._iter var. By the way, wandb step is equal to self._iter +1 now.
|
Hi @shenmishajing |
Do you mean we change the log func like follows? @master_only
def log(self, runner):
tags = self.get_loggable_tags(runner)
if tags:
self.wandb.log(
tags, step=self.get_iter(runner), commit=True) In fact, self.commit is True by default. In other word, this do not change anything. |
Lint and CI failed. Could @shenmishajing help fix that? |
I have no idea, in fact. Anyone want to help me? Or where can I find some doc about this? |
|
I can fix the unit tests bug. hook.wandb.log.assert_called_with({
'learning_rate': 0.02,
'momentum': 0.95
},
step=6,
commit=True) But, we have changed the format of log, so I think we have to change it to hook.wandb.log.assert_called_with({
'learning_rate': 0.02,
'momentum': 0.95,
'global_step': 6
},
commit=True) As the lint issus, I have no idea at all. It's ok when I run |
Well, I may fix it :). |
Codecov Report
@@ Coverage Diff @@
## master #913 +/- ##
==========================================
- Coverage 64.70% 64.68% -0.02%
==========================================
Files 151 151
Lines 9599 9603 +4
Branches 1758 1759 +1
==========================================
+ Hits 6211 6212 +1
- Misses 3034 3036 +2
- Partials 354 355 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…_res_bug_by_delete_step_param
Hi @shenmishajing , |
Do you mean the visualization of the log result on wandb site, like this?
After this PR, it will look like above. Before this PR, it also looks like above. The only difference is the step var on wandb site is not equal to self._iter in mmcv runner code any more. After this PR, a var named global_step will be added, which will equal to self._iter. |
LGTM. This PR will be merged after approval by @xvjiarui |
The So I suggest make this change optional. Such that the original behavior could also be preserved. |
approve |
…_res_bug_by_delete_step_param
When will I get the pre-build version mmcv in pip with this pr? |
You can find details at #911.