Skip to main content

Module checkpoint

Module checkpoint 

Source
Expand description

Saving and restoring LoRA adapters and training state.

Adapters are written as safetensors (F32) with their LoRA settings in the file’s metadata, so ferrotensor-cli generate --lora can rebuild the same adapter shapes. TrainingCheckpoint (JSON) holds the step counter, optimizer moments and loss-scaler state for resuming.

Structs§

LoraCheckpoint
Tensors and metadata read from an adapter file.
LoraMetadata
LoRA settings stored in an adapter file’s metadata.
TrainingCheckpoint
Everything besides the adapter weights needed to resume a run.
TrainingState
Progress and settings of a training run (also read by ferrotensor-monitor from training_state.json).

Functions§

apply_checkpoint
Copy checkpoint values into the matching tensors.
load_lora_checkpoint
Load LoRA adapter weights from a safetensors file (F32, F16 or BF16 tensors are accepted and returned as F32).
load_weights
Overwrite each tensor in tensors with the weight of the same name in weights_ctx; names that are missing are logged and skipped.
save_lora_checkpoint
Save LoRA adapter weights (F32 safetensors) to path, with metadata in the header. The file is written to a temporary name and renamed, so a crash never leaves a truncated adapter behind.