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. Continual Unlearning (CUL)
  2. Configure CUL Main Experiment
  3. Callbacks
  • Welcome to CLArena
  • Get Started
  • Continual Learning (CL)
    • Configure CL Main Experiment
      • Experiment Index Config
      • CL Algorithm
      • CL Dataset
      • Backbone Network
      • Optimizer
      • Learning Rate Scheduler
      • Trainer
      • Metrics
      • Lightning Loggers
      • Callbacks
      • Other Configs
    • Save and Evaluate Model
    • Full Experiment
    • Output Results
  • Continual Unlearning (CUL)
    • Configure CUL Main Experiment
      • Experiment Index Config
      • Unlearning Algorithm
      • Callbacks
    • Full Experiment
    • Output Results
  • Multi-Task Learning (MTL)
    • Configure MTL Experiment
      • Experiment Index Config
      • MTL Algorithm
      • MTL Dataset
      • Backbone Network
      • Optimizer
      • Learning Rate Scheduler
      • Trainer
      • Metrics
      • Callbacks
    • Save and Evaluate Model
    • Output Results
  • Single-Task Learning (STL)
    • Configure STL Experiment
      • Experiment Index Config
      • STL Dataset
      • Backbone Network
      • Optimizer
      • Learning Rate Scheduler
      • Trainer
      • Metrics
      • Callbacks
    • Save and Evaluate Model
    • Output Results
  • Implement Your Modules (TBC)
  • API Reference

On this page

  • Example
  • Supported Callbacks & Required Config Fields
  1. Continual Unlearning (CUL)
  2. Configure CUL Main Experiment
  3. Callbacks

Configure Callbacks (CUL)

Modified

August 16, 2025

Under the framework of PyTorch Lightning, we use callbacks to add additional actions and functionalities integrated in different timing of the experiment. This includes before, during, or after training, validating, or testing process.

Each type of callback is designed for one set of actions, such as save sample images, generating logging information, etc. we can apply multiple callbacks to enables different sets of actions at the same time.

This section is only about configuring callbacks other than metric callbacks. To configure metric callbacks, please refer to Configure Metrics (CL Main) section.

Callbacks is a sub-config under the experiment index config (CUL Main) and experiment index config (CUL full evaluation). To configure custom callbacks, you need to create a YAML file in callbacks/ folder. At the moment, we only support uniform callbacks setting across all tasks. Below shows examples of the callbacks config.

Example

configs
β”œβ”€β”€ __init__.py
β”œβ”€β”€ entrance.yaml
β”œβ”€β”€ experiment
β”‚   β”œβ”€β”€ example_clmain_train.yaml
β”‚   └── ...
β”œβ”€β”€ callback
β”‚   β”œβ”€β”€ cul_default.yaml
...
configs/experiment/example_culmain_train.yaml
defaults:
  ...
  - /callbacks: cul_default.yaml
  ...

The callbacks config is a list of callback objects:

configs/callbacks/cul_default.yaml
- _target_: clarena.callbacks.CULPyloggerCallback
- _target_: clarena.callbacks.CLRichProgressBar
- _target_: clarena.callbacks.SaveFirstBatchImagesCallback
  save_dir: ${output_dir}/samples/
- _target_: clarena.callbacks.SaveModelCallback
  save_dir: ${output_dir}/saved_models/

Supported Callbacks & Required Config Fields

All Lightning built-in callbacks are supported. In CLArena, we also implemented many callbacks in clarena.callbacks module that you can use for your CUL Main experiment.

The _target_ field of each callback must be assigned to the corresponding class name, such as lightning.pytorch.callbacks.EarlyStopping for EarlyStopping. Each callback has its own required fields, which are the same as the arguments of the class specified by _target_. The arguments of each callback class can be found in PyTorch Lightning documentation and CLArena API documentation.

PyTorch Lightning Documentation (Built-In Callbacks) API Reference (Callbacks) Source Code (Callbacks)

Below is the full list of supported callbacks that can be applied to CUL Main experiment. Note that the β€œCallback” is exactly the class name that the _target_ field is assigned.

Callback Description Required Config Fields
SaveModelCallback Saves the model at the end of each training task. Please refer to Save and Evaluate Model (CLMain) section. Same as SaveModelCallback class arguments
CULPyloggerCallback Provides additional logging messages for during continual unlearning progress. For example, at the start and end of each training and testing task, log the task ID and other relevant information. Same as CULPyloggerCallback class arguments
SaveFirstBatchImagesCallback Saves images and labels of the first batch of training data into files. Applies to all tasks. Same as SaveFirstBatchImagesCallback class arguments
CLRichProgressBar Customised RichProgressBar for continual learning. Same as CLRichProgressBar class arguments

The callbacks that can be applied to CUL full evaluation experiment include CULPyloggerCallback and CLRichProgressBar.

Back to top
Unlearning Algorithm
Full Experiment
 
 

©️ 2025 Pengxiang Wang. All rights reserved.