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§
- Lora
Checkpoint - Tensors and metadata read from an adapter file.
- Lora
Metadata - LoRA settings stored in an adapter file’s metadata.
- Training
Checkpoint - Everything besides the adapter weights needed to resume a run.
- Training
State - Progress and settings of a training run (also read by
ferrotensor-monitorfromtraining_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
tensorswith the weight of the same name inweights_ctx; names that are missing are logged and skipped. - save_
lora_ checkpoint - Save LoRA adapter weights (F32 safetensors) to
path, withmetadatain the header. The file is written to a temporary name and renamed, so a crash never leaves a truncated adapter behind.