From 4d96f19493f854bbbd6f093a36faf02d50b046db Mon Sep 17 00:00:00 2001 From: Kunal Mundada <53429438+AlKun25@users.noreply.github.com> Date: Fri, 26 Feb 2021 01:38:32 +0530 Subject: [PATCH] Document exceptions in loggers (#6171) * Document exceptions in loggers * minor formatting * docstring changed in comet.py * Apply suggestions from code review Co-authored-by: Rohit Gupta --- pytorch_lightning/loggers/comet.py | 6 ++++++ pytorch_lightning/loggers/mlflow.py | 3 +++ pytorch_lightning/loggers/neptune.py | 4 ++++ pytorch_lightning/loggers/test_tube.py | 4 ++++ pytorch_lightning/loggers/wandb.py | 6 ++++++ 5 files changed, 23 insertions(+) diff --git a/pytorch_lightning/loggers/comet.py b/pytorch_lightning/loggers/comet.py index 9356552cbe..31c768fa5f 100644 --- a/pytorch_lightning/loggers/comet.py +++ b/pytorch_lightning/loggers/comet.py @@ -115,6 +115,12 @@ class CometLogger(LightningLoggerBase): prefix: A string to put at the beginning of metric keys. \**kwargs: Additional arguments like `workspace`, `log_code`, etc. used by :class:`CometExperiment` can be passed as keyword arguments in this logger. + + Raises: + ImportError: + If required Comet package is not installed on the device. + MisconfigurationException: + If neither ``api_key`` nor ``save_dir`` are passed as arguments. """ LOGGER_JOIN_CHAR = '-' diff --git a/pytorch_lightning/loggers/mlflow.py b/pytorch_lightning/loggers/mlflow.py index 8ae59581fe..4aa4c67b57 100644 --- a/pytorch_lightning/loggers/mlflow.py +++ b/pytorch_lightning/loggers/mlflow.py @@ -79,6 +79,9 @@ class MLFlowLogger(LightningLoggerBase): Has no effect if `tracking_uri` is provided. prefix: A string to put at the beginning of metric keys. + Raises: + ImportError: + If required MLFlow package is not installed on the device. """ LOGGER_JOIN_CHAR = '-' diff --git a/pytorch_lightning/loggers/neptune.py b/pytorch_lightning/loggers/neptune.py index 3960a983d9..d4f24567ca 100644 --- a/pytorch_lightning/loggers/neptune.py +++ b/pytorch_lightning/loggers/neptune.py @@ -171,6 +171,10 @@ class NeptuneLogger(LightningLoggerBase): prefix: A string to put at the beginning of metric keys. \**kwargs: Additional arguments like `params`, `tags`, `properties`, etc. used by :func:`neptune.Session.create_experiment` can be passed as keyword arguments in this logger. + + Raises: + ImportError: + If required Neptune package is not installed on the device. """ LOGGER_JOIN_CHAR = '-' diff --git a/pytorch_lightning/loggers/test_tube.py b/pytorch_lightning/loggers/test_tube.py index 5734f0fd8a..84f231b0f1 100644 --- a/pytorch_lightning/loggers/test_tube.py +++ b/pytorch_lightning/loggers/test_tube.py @@ -74,6 +74,10 @@ class TestTubeLogger(LightningLoggerBase): the user has defined the `self.example_input_array` attribute in their model. prefix: A string to put at the beginning of metric keys. + + Raises: + ImportError: + If required TestTube package is not installed on the device. """ __test__ = False diff --git a/pytorch_lightning/loggers/wandb.py b/pytorch_lightning/loggers/wandb.py index 864ef092a4..68c7e228cc 100644 --- a/pytorch_lightning/loggers/wandb.py +++ b/pytorch_lightning/loggers/wandb.py @@ -61,6 +61,12 @@ class WandbLogger(LightningLoggerBase): \**kwargs: Additional arguments like `entity`, `group`, `tags`, etc. used by :func:`wandb.init` can be passed as keyword arguments in this logger. + Raises: + ImportError: + If required WandB package is not installed on the device. + MisconfigurationException: + If both ``log_model`` and ``offline``is set to ``True``. + Example:: from pytorch_lightning.loggers import WandbLogger