From 850693248e948e31918a28d168e8f12c1745a993 Mon Sep 17 00:00:00 2001 From: Kaushik Ram Sadagopan Date: Sat, 10 Oct 2020 11:36:18 -0700 Subject: [PATCH] Adding tensorboard_logdir argument to TensorboardLogger. (#3184) --- parlai/core/logs.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/parlai/core/logs.py b/parlai/core/logs.py index d6c0273a2ad..897c4061841 100644 --- a/parlai/core/logs.py +++ b/parlai/core/logs.py @@ -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: @@ -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)