DistillationCheckpointManager<T>
Models & Types · AiDotNet.KnowledgeDistillation
Manages checkpointing during knowledge distillation training.
For Beginners
This class handles saving and loading model states during distillation training. It’s like the “save game” manager in a video game - it decides when to save, what to save, and how to load progress later.
How It Works
Key Features:
- Automatic checkpointing at specified intervals
- Keep only best N checkpoints based on validation metrics
- Save/restore curriculum learning progress
- Support for multi-stage distillation (student → teacher)
- Resume interrupted training
Example Usage:
Constructors
| Constructor | Summary |
|---|---|
DistillationCheckpointManager(DistillationCheckpointConfig config) |
Initializes a new instance of the DistillationCheckpointManager class. |
Methods
| Method | Summary |
|---|---|
CheckpointMetadata GetBestCheckpoint() |
Gets the checkpoint with the best metric value. |
CheckpointMetadata GetCheckpointByEpoch(int epoch) |
Gets a checkpoint for a specific epoch. |
CheckpointMetadata GetMostRecentCheckpoint() |
Gets the most recently saved checkpoint. |
CheckpointMetadata LoadBestCheckpoint(ICheckpointableModel student, ICheckpointableModel teacher) |
Loads the best checkpoint based on the configured metric. |
IReadOnlyList<CheckpointMetadata> GetAllCheckpoints() |
Gets all saved checkpoint metadata as a readonly collection. |
bool SaveCheckpointIfNeeded(int epoch, ICheckpointableModel student, ICheckpointableModel teacher, object strategy, Dictionary<string, double> metrics, int? batch, bool force) |
Saves a checkpoint if conditions are met. |
void LoadCheckpoint(CheckpointMetadata metadata, ICheckpointableModel student, ICheckpointableModel teacher) |
Loads a specific checkpoint. |