Skip to content

Commit

Permalink
[fix]: Fix a bug where logs are missing when two or more loggers were…
Browse files Browse the repository at this point in the history
… set (#1015)

* +super().before_run()

* flip reset_flag
  • Loading branch information
ritosonn authored May 20, 2021
1 parent b8c09f3 commit 1a66977
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion mmcv/runner/hooks/logger/mlflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self,
log_model=True,
interval=10,
ignore_last=True,
reset_flag=True,
reset_flag=False,
by_epoch=True):
"""Class to log metrics and (optionally) a trained model to MLflow.
Expand Down Expand Up @@ -60,6 +60,7 @@ def import_mlflow(self):

@master_only
def before_run(self, runner):
super(MlflowLoggerHook, self).before_run(runner)
if self.exp_name is not None:
self.mlflow.set_experiment(self.exp_name)
if self.tags is not None:
Expand Down
3 changes: 2 additions & 1 deletion mmcv/runner/hooks/logger/pavi.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self,
add_last_ckpt=False,
interval=10,
ignore_last=True,
reset_flag=True,
reset_flag=False,
by_epoch=True,
img_key='img_info'):
super(PaviLoggerHook, self).__init__(interval, ignore_last, reset_flag,
Expand All @@ -34,6 +34,7 @@ def __init__(self,

@master_only
def before_run(self, runner):
super(PaviLoggerHook, self).before_run(runner)
try:
from pavi import SummaryWriter
except ImportError:
Expand Down
3 changes: 2 additions & 1 deletion mmcv/runner/hooks/logger/tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ def __init__(self,
log_dir=None,
interval=10,
ignore_last=True,
reset_flag=True,
reset_flag=False,
by_epoch=True):
super(TensorboardLoggerHook, self).__init__(interval, ignore_last,
reset_flag, by_epoch)
self.log_dir = log_dir

@master_only
def before_run(self, runner):
super(TensorboardLoggerHook, self).before_run(runner)
if TORCH_VERSION < '1.1' or TORCH_VERSION == 'parrots':
try:
from tensorboardX import SummaryWriter
Expand Down
3 changes: 2 additions & 1 deletion mmcv/runner/hooks/logger/wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self,
init_kwargs=None,
interval=10,
ignore_last=True,
reset_flag=True,
reset_flag=False,
commit=True,
by_epoch=True,
with_step=True):
Expand All @@ -32,6 +32,7 @@ def import_wandb(self):

@master_only
def before_run(self, runner):
super(WandbLoggerHook, self).before_run(runner)
if self.wandb is None:
self.import_wandb()
if self.init_kwargs:
Expand Down

0 comments on commit 1a66977

Please sign in to comment.