Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Adding tensorboard_logdir argument to TensorboardLogger. (#3184)
Browse files Browse the repository at this point in the history
  • Loading branch information
kauterry authored Oct 10, 2020
1 parent e7c0686 commit 8506932
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion parlai/core/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ def add_cmdline_args(argparser):
help="Tensorboard logging of metrics, default is %(default)s",
hidden=False,
)
logger.add_argument(
'-tblogdir',
'--tensorboard-logdir',
type=str,
default=None,
help="Tensorboard logging directory, defaults to model_file.tensorboard",
hidden=False,
)

def __init__(self, opt: Opt):
try:
Expand All @@ -50,7 +58,11 @@ def __init__(self, opt: Opt):
except ImportError:
raise ImportError('Please run `pip install tensorboard tensorboardX`.')

tbpath = opt['model_file'] + '.tensorboard'
if opt['tensorboard_logdir'] is not None:
tbpath = opt['tensorboard_logdir']
else:
tbpath = opt['model_file'] + '.tensorboard'

logging.debug(f'Saving tensorboard logs to: {tbpath}')
if not PathManager.exists(tbpath):
PathManager.mkdirs(tbpath)
Expand Down

0 comments on commit 8506932

Please sign in to comment.