Skip to content

Config Saver Callback

Source

Lightning callback for storing CAREamics configuration in checkpoints.

ConfigSaverCallback

Bases: Callback

Callback to save CAREamics configuration in Lightning checkpoints.

This callback automatically stores CAREamics version, experiment name, and training configuration in the checkpoint file for reproducibility.

Parameters:

  • careamics_version (str) –

    Version of CAREamics used for training.

  • experiment_name (str) –

    Name of the experiment.

  • training_config (TrainingConfig) –

    Training configuration to store in checkpoint.

Attributes:

  • careamics_version (str) –

    Version of CAREamics used for training.

  • experiment_name (str) –

    Name of the experiment.

  • training_config (TrainingConfig) –

    Training configuration to store in checkpoint.

__init__(careamics_version, experiment_name, training_config)

Initialize the callback.

Parameters:

  • careamics_version (str) –

    Version of CAREamics used for training.

  • experiment_name (str) –

    Name of the experiment.

  • training_config (TrainingConfig) –

    Training configuration to store in checkpoint.

on_save_checkpoint(trainer, pl_module, checkpoint)

Lightning hook called when saving a checkpoint.

Adds CAREamics configuration to the checkpoint dictionary.

Parameters:

  • trainer (Trainer) –

    Lightning trainer instance.

  • pl_module (LightningModule) –

    Lightning module being trained.

  • checkpoint (dict[str, Any]) –

    Checkpoint dictionary to modify.