Checkpointing is config-driven β add
save_strategy / save_steps to config.yaml. Add val_split_ratio to carve an eval set and the best-checkpoint and early-stopping keys light up.Quick Start
1
Save every N steps
Write a checkpoint on a step interval so a crash loses at most
save_steps worth of work.2
Resume after an interruption
Re-launch with
resume_from_checkpoint: true β the trainer picks the latest checkpoint in output_dir.3
Keep only the most recent K
Bound disk usage β keep only the N newest checkpoints.
4
Load the best model at the end
Hold out an eval set, then reload the best-scoring checkpoint when training finishes.
How It Works
val_split_ratio carves an eval set from the training data; the trainer evaluates on a schedule, tracks the best checkpoint, and reloads it when load_best_model_at_end is set.
load_best_model_at_end auto-aligns save_strategy to eval_strategy (and save_steps to eval_steps under "steps") β the Trainer requires them to match.Configuration Options
Checkpointing & Resume
Evaluation & Best-Checkpoint
Early Stopping
Common Patterns
Keep the best model and stop when it plateaus
Hold out 5% for eval, keep the best checkpoint, and stop early after 3 flat evals.Resume a long run after a crash
Save often, keep a handful, and resume from the latest on re-launch.Resume from a specific checkpoint
Pointresume_from_checkpoint at an explicit path instead of the latest.
Best Practices
Set save_total_limit to bound disk
Set save_total_limit to bound disk
Frequent checkpoints fill disk fast.
save_total_limit: 3 keeps only the newest few β enough to resume, without running out of space mid-run.Use final_model_dir for a stable output path
Use final_model_dir for a stable output path
final_model_dir (default lora_model) is where the final adapter is written and where post-training inference reloads it. Keep it stable so load_model finds the adapter β this fixes the old bug where the adapter was saved and read from different directories.save_strategy must match eval_strategy for load_best_model_at_end
save_strategy must match eval_strategy for load_best_model_at_end
The Trainer requires the two to match. The trainer auto-aligns them when
load_best_model_at_end: true, but if you set both by hand, keep save_strategy and eval_strategy (and save_steps / eval_steps) identical.early_stopping_patience needs val_split_ratio
early_stopping_patience needs val_split_ratio
Early stopping ranks checkpoints on the eval metric, so it requires a held-out eval set. Set
val_split_ratio (e.g. 0.05) β without it the trainer raises ValueError.Related
Train
Fine-tuning overview and full config reference.
Multi-GPU
Fine-tune across multiple GPUs with torchrun.
Train CLI
Resume and multi-GPU launch from the CLI.
praisonai-train Package
Install and use training without the full wrapper.

