Save SFT last/best checkpoints during training and on interrupt
train_sft used to torch.save only after the full epoch budget, so Ctrl+C dropped all translation weights. Write _last every --ckpt-every steps and on KeyboardInterrupt; write _best when frozen eval (success, chrF) improves; --resume continues from _last.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
from train_sft import _is_better_eval, _sibling
|
||||
|
||||
|
||||
def test_sibling_last_best():
|
||||
assert _sibling("ckpts/k3_sft.pt", "_last") == "ckpts/k3_sft_last.pt"
|
||||
assert _sibling("ckpts/k3_sft.pt", "_best") == "ckpts/k3_sft_best.pt"
|
||||
|
||||
|
||||
def test_best_prefers_success_then_chrf():
|
||||
assert _is_better_eval(1.0, 70.0, 0.95, 90.0)
|
||||
assert not _is_better_eval(0.95, 99.0, 1.0, 70.0)
|
||||
assert _is_better_eval(1.0, 91.0, 1.0, 81.0)
|
||||
assert not _is_better_eval(1.0, 70.0, 1.0, 81.0)
|
||||
Reference in New Issue
Block a user