From 438708c33d741779cfa6ad8603370a552d11512b Mon Sep 17 00:00:00 2001 From: William Falcon Date: Thu, 16 Jan 2020 17:35:02 -0500 Subject: [PATCH] added loggers --- pytorch_lightning/logging/neptune.py | 2 +- pytorch_lightning/logging/tensorboard.py | 16 ++++++++------ pytorch_lightning/logging/test_tube.py | 27 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pytorch_lightning/logging/neptune.py b/pytorch_lightning/logging/neptune.py index 1b42a135..c6743f49 100644 --- a/pytorch_lightning/logging/neptune.py +++ b/pytorch_lightning/logging/neptune.py @@ -93,7 +93,7 @@ class NeptuneLogger(LightningLoggerBase): trainer = Trainer(max_epochs=10, logger=neptune_logger) Args: - api_key (str|None): Required in online mode. Neputne API token, found on https://neptune.ml. + api_key (str | None): Required in online mode. Neputne API token, found on https://neptune.ml. Read how to get your API key https://docs.neptune.ml/python-api/tutorials/get-started.html#copy-api-token. project_name (str): Required in online mode. Qualified name of a project in a form of "namespace/project_name" for example "tom/minst-classification". diff --git a/pytorch_lightning/logging/tensorboard.py b/pytorch_lightning/logging/tensorboard.py index e5f0d2e2..937fc3e6 100644 --- a/pytorch_lightning/logging/tensorboard.py +++ b/pytorch_lightning/logging/tensorboard.py @@ -11,12 +11,15 @@ from .base import LightningLoggerBase, rank_zero_only class TensorBoardLogger(LightningLoggerBase): - r"""Log to local file system in TensorBoard format + r""" + + Log to local file system in TensorBoard format Implemented using :class:`torch.utils.tensorboard.SummaryWriter`. Logs are saved to `os.path.join(save_dir, name, version)` - :example: + Example + -------- .. code-block:: python @@ -24,11 +27,12 @@ class TensorBoardLogger(LightningLoggerBase): trainer = Trainer(logger=logger) trainer.train(model) - :param str save_dir: Save directory - :param str name: Experiment name. Defaults to "default". - :param int version: Experiment version. If version is not specified the logger inspects the save + Args: + save_dir (str): Save directory + name (str): Experiment name. Defaults to "default". + version (int): Experiment version. If version is not specified the logger inspects the save directory for existing versions, then automatically assigns the next available version. - :param \**kwargs: Other arguments are passed directly to the :class:`SummaryWriter` constructor. + \**kwargs (dict): Other arguments are passed directly to the :class:`SummaryWriter` constructor. """ NAME_CSV_TAGS = 'meta_tags.csv' diff --git a/pytorch_lightning/logging/test_tube.py b/pytorch_lightning/logging/test_tube.py index 6144368f..ccb50ef3 100644 --- a/pytorch_lightning/logging/test_tube.py +++ b/pytorch_lightning/logging/test_tube.py @@ -38,6 +38,33 @@ from .base import LightningLoggerBase, rank_zero_only class TestTubeLogger(LightningLoggerBase): + r""" + + Log to local file system in TensorBoard format but using a nicer folder structure. + + Implemented using :class:`torch.utils.tensorboard.SummaryWriter`. Logs are saved to + `os.path.join(save_dir, name, version)` + + Example + -------- + + .. code-block:: python + + logger = TestTubeLogger("tt_logs", name="my_exp_name") + trainer = Trainer(logger=logger) + trainer.train(model) + + Args: + save_dir (str): Save directory + name (str): Experiment name. Defaults to "default". + description (str): A short snippet about this experiment + debug (bool): If True, it doesn't log anything + version (int): Experiment version. If version is not specified the logger inspects the save + directory for existing versions, then automatically assigns the next available version. + create_git_tag (bool): If True creates a git tag to save the code used in this experiment + + """ + __test__ = False def __init__(