ml.loggers.tensorboard
Defines a Tensorboard logging interface.
This is a pretty vanilla Tensorboard setup. Each phase gets its own
SummaryWriter, and scalars are logged to the writer for the current phase.
Additionally, when developing locally, we also start a Tensorboard server
in a subprocess. This can be disabled by setting DISABLE_TENSORBOARD=1
.
Also, a specific Tensorboard port can be specified by setting
TENSORBOARD_PORT=<port>
.
- class ml.loggers.tensorboard.TensorboardLoggerConfig(name: str = '???', write_every_n_seconds: float | None = None, write_train_every_n_seconds: float | None = None, write_val_every_n_seconds: float | None = None, flush_seconds: float = 10.0, wait_seconds: float = 0.0, start_in_subprocess: bool = True)[source]
Bases:
BaseLoggerConfig
- flush_seconds: float = 10.0
- wait_seconds: float = 0.0
- start_in_subprocess: bool = True
- class ml.loggers.tensorboard.TensorboardLogger(config: TensorboardLoggerConfig)[source]
Bases:
BaseLogger
[TensorboardLoggerConfig
]- property tensorboard_log_directory: Path
- property train_writer: SummaryWriter
- property valid_writer: SummaryWriter
- property test_writer: SummaryWriter
- log_scalar(key: str, value: Callable[[], int | float | Tensor], state: State, namespace: str) None [source]
Logs a scalar value.
- Parameters:
key – The key to log
value – The value to log
state – The current log state
namespace – The namespace to be logged
- log_string(key: str, value: Callable[[], str], state: State, namespace: str) None [source]
Logs a string value.
- Parameters:
key – The key to log
value – The value to log
state – The current log state
namespace – The namespace to be logged
- log_image(key: str, value: Callable[[], Tensor], state: State, namespace: str) None [source]
Logs a normalized image, with shape (C, H, W).
- Parameters:
key – The key to log
value – The value to log
state – The current log state
namespace – The namespace to be logged
- log_audio(key: str, value: Callable[[], tuple[torch.Tensor, int]], state: State, namespace: str) None [source]
Logs a normalized audio, with shape (T,).
- Parameters:
key – The key to log
value – The value to log
state – The current log state
namespace – The namespace to be logged
- log_video(key: str, value: Callable[[], Tensor], state: State, namespace: str) None [source]
Logs a normalized video, with shape (T, C, H, W).
- Parameters:
key – The key to log
value – The value to log
state – The current log state
namespace – The namespace to be logged
- log_histogram(key: str, value: Callable[[], Tensor], state: State, namespace: str) None [source]
Logs a histogram, with any shape.
- Parameters:
key – The key to log
value – The value to log
state – The current log state
namespace – The namespace to be logged
- log_point_cloud(key: str, value: Callable[[], Tensor], state: State, namespace: str) None [source]
Logs a normalized point cloud, with shape (B, N, 3).
- Parameters:
key – The key to log
value – The value to log
state – The current log state
namespace – The namespace to be logged