[Fix] Fix wandb logger drop result bug (#913)

* 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
pull/942/head
shenmishajing 2021-04-09 12:57:49 +08:00 committed by GitHub
parent d525cfde10
commit d636257e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -13,12 +13,14 @@ class WandbLoggerHook(LoggerHook):
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:
@ -41,8 +43,12 @@ class WandbLoggerHook(LoggerHook):
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):