Shawn’s Blog
  • πŸ—‚οΈ Collections
    • πŸ–₯️ Slides Gallery
    • πŸ§‘β€πŸ³οΈ Cooking Ideas
    • 🍱 Cookbook
    • πŸ’¬ Language Learning
    • 🎼 Songbook
  • βš™οΈ Projects
    • βš› Continual Learning Arena
  • πŸ“„ Papers
    • AdaHAT
    • FG-AdaHAT
  • πŸŽ“ CV
    • CV (English)
    • CV (Mandarin)
  • About
  1. Components
  2. Lightning Loggers
  • Welcome to CLArena
  • Getting Started
  • Configure Pipelines
  • Continual Learning (CL)
    • CL Main Experiment
    • Save and Evaluate Model
    • Full Experiment
    • Output Results
  • Continual Unlearning (CUL)
    • CUL Main Experiment
    • Full Experiment
    • Output Results
  • Multi-Task Learning (MTL)
    • MTL Experiment
    • Save and Evaluate Model
    • Output Results
  • Single-Task Learning (STL)
    • STL Experiment
    • Save and Evaluate Model
    • Output Results
  • Components
    • CL Dataset
    • MTL Dataset
    • STL Dataset
    • CL Algorithm
    • CUL Algorithm
    • MTL Algorithm
    • STL Algorithm
    • Backbone Network
    • Optimizer
    • Learning Rate Scheduler
    • Trainer
    • Metrics
    • Lightning Loggers
    • Callbacks
    • Other Configs
  • Implement Your Modules (TBC)
  • API Reference
  1. Components
  2. Lightning Loggers

Configure Lightning Loggers

Modified

August 26, 2025

Under the PyTorch Lightning framework, metrics collected by the Lightning Trainer are delivered to Lightning Logger objects to produce output, as shown in the Output Results (CL) section. The metrics can include training loss, validation loss, accuracy, etc. If you are not familiar with the metrics involved in continual learning, feel free to learn more from my article: A Summary of Continual Learning Metrics.

Each logger type is designed for a specific output, such as CSV files (by CSVLogger) or TensorBoard logs (by TensorBoardLogger). We can apply multiple loggers to produce different forms of output at the same time. Lightning provides the following built-in loggers: CSVLogger, TensorBoardLogger, WandbLogger, NeptuneLogger, MLFlowLogger, and CometLogger.

Lightning loggers are a sub-config under the experiment index config (CL Main). To configure custom loggers, create a YAML file in the lightning_loggers/ folder. Unlike optimizers, there is no point in assigning distinct loggers to each task. We use a uniform logger setting across all tasks. Below is an example of the Lightning loggers config.

Example

configs
β”œβ”€β”€ __init__.py
β”œβ”€β”€ entrance.yaml
β”œβ”€β”€ experiment
β”‚   β”œβ”€β”€ example_clmain_train.yaml
β”‚   └── ...
β”œβ”€β”€ lightning_loggers
β”‚   β”œβ”€β”€ default.yaml
β”‚   β”œβ”€β”€ csv
β”‚   β”‚   └── default.yaml
β”‚   β”œβ”€β”€ tensorboard
β”‚   β”‚   └── default.yaml
...
configs/experiment/example_clmain_train.yaml
defaults:
  ...
  - /lightning_loggers: default.yaml
  ...

The Lightning loggers config maintains a β€œmaster panel” that controls which loggers are applied. When a logger is not applied, set its corresponding field in the master panel to null, or simply remove the field:

configs/lightning_loggers/default.yaml
defaults:
  - csv: default.yaml
  - tensorboard: default.yaml
  - comet: null # or simply remove this field
  - wandb: null # or simply remove this field
  - neptune: null # or simply remove this field
  - mlflow: null # or simply remove this field

Each logger is defined in its own sub-config:

configs/lightning_loggers/csv/default.yaml
_target_: lightning.pytorch.loggers.CSVLogger
save_dir: ${output_dir}

Supported Lightning Loggers & Required Config Fields

All Lightning built-in loggers are supported, including:

  • CSV Logger: CSVLogger
  • TensorBoard Logger: TensorBoardLogger
  • WandB Logger: WandbLogger
  • Neptune Logger: NeptuneLogger
  • MLFlow Logger: MLFlowLogger
  • Comet Logger: CometLogger

To choose a logger, assign the _target_ field to the corresponding class name, such as lightning.pytorch.loggers.CSVLogger for CSVLogger. Each logger has its own hyperparameters and configurations, which means it has its own required fields. The required fields are the same as the arguments of the class specified by _target_. The arguments for each logger class can be found in the PyTorch Lightning documentation.

PyTorch Lightning Documentation (Built-In Loggers)

Note that some loggers require additional setup, such as installing software or setting API keys. Please follow the instructions in the PyTorch Lightning documentation for each logger.

Back to top
Metrics
Callbacks
 
 

©️ 2025 Pengxiang Wang. All rights reserved.