Skip to content

Commit

Permalink
[Fix] Fix wandb logger drop result bug (#913)
Browse files Browse the repository at this point in the history
* fix wandb logger drop result bug by delete step param

* add global_step in wandb log to help align train and val step log

* fix wandb hook test unit fail bug

* fix lint issue

* add with_step param of WandbLoggerHook in wandb.py
  • Loading branch information
shenmishajing authored Apr 9, 2021
1 parent d525cfd commit d636257
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mmcv/runner/hooks/logger/wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ def __init__(self,
ignore_last=True,
reset_flag=True,
commit=True,
by_epoch=True):
by_epoch=True,
with_step=True):
super(WandbLoggerHook, self).__init__(interval, ignore_last,
reset_flag, by_epoch)
self.import_wandb()
self.init_kwargs = init_kwargs
self.commit = commit
self.with_step = with_step

def import_wandb(self):
try:
Expand All @@ -41,8 +43,12 @@ def before_run(self, runner):
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 self.with_step:
self.wandb.log(
tags, step=self.get_iter(runner), commit=self.commit)
else:
tags['global_step'] = self.get_iter(runner)
self.wandb.log(tags, commit=self.commit)

@master_only
def after_run(self, runner):
Expand Down

0 comments on commit d636257

Please sign in to comment.