test_tube¶
Classes
Log to local file system in TensorBoard format but using a nicer folder structure (see full docs). |
Test Tube Logger¶
- class pytorch_lightning.loggers.test_tube.TestTubeLogger(save_dir, name='default', description=None, debug=False, version=None, create_git_tag=False, log_graph=False, prefix='')[source]¶
Bases:
pytorch_lightning.loggers.base.LightningLoggerBase
Log to local file system in TensorBoard format but using a nicer folder structure (see full docs).
Install it with pip:
pip install test_tube
from pytorch_lightning import Trainer from pytorch_lightning.loggers import TestTubeLogger logger = TestTubeLogger("tt_logs", name="my_exp_name") trainer = Trainer(logger=logger)
Use the logger anywhere in your
LightningModule
as follows:from pytorch_lightning import LightningModule class LitModel(LightningModule): def training_step(self, batch, batch_idx): # example self.logger.experiment.whatever_method_summary_writer_supports(...) def any_lightning_module_function_or_hook(self): self.logger.experiment.add_histogram(...)
- Parameters
description¶ (
Optional
[str
]) – A short snippet about this experimentversion¶ (
Optional
[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
) – IfTrue
creates a git tag to save the code used in this experiment.log_graph¶ (
bool
) – Adds the computational graph to tensorboard. This requires that the user has defined the self.example_input_array attribute in their model.prefix¶ (
str
) – A string to put at the beginning of metric keys.
- Raises
ImportError – If required TestTube package is not installed on the device.
- log_graph(model, input_array=None)[source]¶
Record model graph
- Parameters
model¶ (
LightningModule
) – lightning modelinput_array¶ – input passes to model.forward
- log_metrics(metrics, step=None)[source]¶
Records metrics. This method logs metrics as as soon as it received them. If you want to aggregate metrics for one specific step, use the
agg_and_log_metrics()
method.
- property experiment: test_tube.Experiment¶
Actual TestTube object. To use TestTube features in your
LightningModule
do the following.Example:
self.logger.experiment.some_test_tube_function()
- property name: str¶
Return the experiment name.
- property save_dir: Optional[str]¶
Return the root directory where experiment logs get saved, or None if the logger does not save data locally.
- property version: int¶
Return the experiment version.