diff --git a/docs/LightningModule/RequiredTrainerInterface.md b/docs/LightningModule/RequiredTrainerInterface.md index 9cecf8a0..8014b0b8 100644 --- a/docs/LightningModule/RequiredTrainerInterface.md +++ b/docs/LightningModule/RequiredTrainerInterface.md @@ -143,10 +143,15 @@ def training_step(self, batch, batch_nb): out = self.forward(x) loss = self.loss(out, x) + logger_logs = {'training_loss': loss} # optional (MUST ALL BE TENSORS) + + # if using TestTubeLogger or TensorboardLogger you can nest scalars + logger_logs = {'losses': logger_logs} # optional (MUST ALL BE TENSORS) + output = { 'loss': loss, # required 'progress_bar': {'training_loss': loss}, # optional (MUST ALL BE TENSORS) - 'log': {'training_loss': loss} # optional (MUST ALL BE TENSORS) + 'log': logger_logs } # return a dict diff --git a/docs/Trainer/Logging.md b/docs/Trainer/Logging.md index f3e93b14..aa59a089 100644 --- a/docs/Trainer/Logging.md +++ b/docs/Trainer/Logging.md @@ -33,7 +33,10 @@ Lightning supports several common experiment tracking frameworks out of the box --- #### Test tube -Log using [test tube](https://williamfalcon.github.io/test-tube/). +Log using [test tube](https://williamfalcon.github.io/test-tube/). Test tube logger is +a strict subclass of [PyTorch SummaryWriter](https://pytorch.org/docs/stable/tensorboard.html), refer to their +documentation for all supported operations. The TestTubeLogger adds a nicer folder structure +to manage experiments and snapshots all hyperparameters you pass to a LightningModule. ```{.python} from pytorch_lightning.logging import TestTubeLogger @@ -46,6 +49,16 @@ tt_logger = TestTubeLogger( trainer = Trainer(logger=tt_logger) ``` +Use the logger anywhere in you LightningModule as follows: +```python +def train_step(...): + # example + self.logger.experiment.whatever_method_summary_writer_supports(...) + +def any_lightning_module_function_or_hook(...): + self.logger.experiment.add_histogram(...) +``` + --- #### MLFlow @@ -60,6 +73,16 @@ mlf_logger = MLFlowLogger( trainer = Trainer(logger=mlf_logger) ``` +Use the logger anywhere in you LightningModule as follows: +```python +def train_step(...): + # example + self.logger.experiment.whatever_ml_flow_supports(...) + +def any_lightning_module_function_or_hook(...): + self.logger.experiment.whatever_ml_flow_supports(...) +``` + --- #### Custom logger @@ -101,13 +124,14 @@ a pull request to add it to Lighting! #### Using loggers You can call the logger anywhere from your LightningModule by doing: ```python -self.logger - -# add an image if using TestTubeLogger -self.logger.experiment.add_image(...) +def train_step(...): + # example + self.logger.experiment.whatever_method_summary_writer_supports(...) + +def any_lightning_module_function_or_hook(...): + self.logger.experiment.add_histogram(...) ``` - #### Display metrics in progress bar ``` {.python} # DEFAULT