mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
Add support for multiple loggers (#903)
* Add support for multiple loggers * Fix PEP * Cleanup * Cleanup * Add typing to loggers * Update base.py * Replace duck typing with isinstance check * Update CHANGELOG.md * Update comet experiment type, Switch to abstractmethod in logging.py * Fix test * Add passes to LightningLoggerBase * Update experiment_logging.rst
This commit is contained in:
@@ -137,3 +137,26 @@ The Wandb logger is available anywhere in your LightningModule
|
||||
some_img = fake_image()
|
||||
self.logger.experiment.add_image('generated_images', some_img, 0)
|
||||
|
||||
|
||||
Multiple Loggers
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
PyTorch-Lightning supports use of multiple loggers, just pass a list to the `Trainer`.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pytorch_lightning.loggers import TensorBoardLogger, TestTubeLogger
|
||||
|
||||
logger1 = TensorBoardLogger("tb_logs", name="my_model")
|
||||
logger2 = TestTubeLogger("tt_logs", name="my_model")
|
||||
trainer = Trainer(logger=[logger1, logger2])
|
||||
|
||||
The loggers are available as a list anywhere in your LightningModule
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class MyModule(pl.LightningModule):
|
||||
|
||||
def __init__(self, ...):
|
||||
some_img = fake_image()
|
||||
self.logger.experiment[0].add_image('generated_images', some_img, 0)
|
||||
|
||||
Reference in New Issue
Block a user