Checkpoint<T, TInput, TOutput>
Models & Types · AiDotNet.Models
Represents a saved checkpoint of model training state.
How It Works
For Beginners: A checkpoint is like a save point in a video game - it captures everything needed to resume training from that exact point.
Constructors
| Constructor | Summary |
|---|---|
Checkpoint() |
Initializes a new instance of the Checkpoint class. |
Checkpoint(object model, Dictionary<string, object> optimizerState, string optimizerTypeName, int epoch, int step, Dictionary<string, T> metrics, Dictionary<string, object> metadata, byte[] optimizerData) |
Initializes a new instance of the Checkpoint class with specified values. |
Checkpoint(object model, IOptimizer<T, TInput, TOutput> optimizer, int epoch, int step, Dictionary<string, T> metrics, Dictionary<string, object> metadata) |
Initializes a new instance of the Checkpoint class with an optimizer object. |
Properties
| Property | Summary |
|---|---|
DateTime CreatedAt { get; set; } |
Gets the timestamp when this checkpoint was created. |
Dictionary<string, T> Metrics { get; set; } |
Gets or sets the performance metrics at this checkpoint. |
Dictionary<string, object> Metadata { get; set; } |
Gets or sets additional metadata. |
Dictionary<string, object> OptimizerState { get; set; } |
Gets or sets the optimizer state as a serializable dictionary. |
bool OptimizerDataInSidecar { get; set; } |
Whether OptimizerData was written to the checkpoint’s binary optimizer sidecar instead of the JSON. |
byte[] OptimizerData { get; set; } |
Gets or sets the serialized optimizer payload. |
int Epoch { get; set; } |
Gets or sets the training epoch number. |
int Step { get; set; } |
Gets or sets the training step number. |
object Model { get; set; } |
Gets or sets the model at this checkpoint. |
string CheckpointId { get; set; } |
Gets the unique identifier for this checkpoint. |
string FilePath { get; set; } |
Gets or sets the file path where the checkpoint is stored. |
string OptimizerTypeName { get; set; } |
Gets or sets the optimizer type name for reconstruction. |
Methods
| Method | Summary |
|---|---|
bool ShouldSerializeModel() |
Whether the checkpoint’s JSON carries Model (Newtonsoft’s ShouldSerialize convention). |
bool ShouldSerializeOptimizerData() |
Whether the checkpoint’s JSON carries OptimizerData (Newtonsoft’s ShouldSerialize convention): only when it is not in the optimizer sidecar. |
bool TryRestoreOptimizer(IOptimizer<T, TInput, TOutput> optimizer) |
Attempts to restore the saved optimizer state into an existing optimizer instance. |
void RestoreOptimizer(IOptimizer<T, TInput, TOutput> optimizer) |
Restores the saved optimizer state into an existing optimizer instance. |