Repository navigation
Conversation
This was referenced Sep 19, 2026
Contributor
Author
This was referenced Sep 19, 2026
Closed
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
from
September 20, 2026 19:09
2ae6b54 to
af92a04
Compare
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
September 20, 2026 19:09
f50f94c to
c9c284f
Compare
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
from
September 21, 2026 18:45
af92a04 to
a5c1dcb
Compare
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
September 21, 2026 18:45
c9c284f to
72d026d
Compare
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
from
September 22, 2026 13:18
a5c1dcb to
ac3ee5d
Compare
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
September 22, 2026 13:18
72d026d to
bbac4a0
Compare
This was referenced Sep 22, 2026
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
October 12, 2026 20:26
bfcf288 to
9a70f91
Compare
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
from
October 12, 2026 21:50
a7e6042 to
286b8e8
Compare
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
October 12, 2026 21:50
9a70f91 to
05f1e3e
Compare
This was referenced Oct 12, 2026
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
October 12, 2026 23:19
05f1e3e to
bbbf371
Compare
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
from
October 12, 2026 23:19
286b8e8 to
1215a37
Compare
Open
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
October 19, 2026 19:47
bbbf371 to
8ac8f46
Compare
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
2 times, most recently
from
October 19, 2026 20:22
feea4f0 to
7f6c8c3
Compare
This was referenced Oct 19, 2026
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
from
October 30, 2026 18:27
7f6c8c3 to
e38fa26
Compare
RyanPCo
commented
Oct 30, 2026
RyanPCo
left a comment
Contributor
Author
There was a problem hiding this comment.
Automated adversarial review (read-only; findings were checked by a second skeptical pass before posting): 1 nit.
| "restore the target or relink last.ckpt to an existing checkpoint." | ||
| ) | ||
| ckpt_dir = os.path.dirname(requeue) | ||
| existing = [ |
Contributor
Author
There was a problem hiding this comment.
nit (simplification): existing = glob.glob(os.path.join(ckpt_dir, "*.ckpt")) replaces the listdir/isdir/endswith comprehension and already returns [] for a missing directory.
ModelCheckpoint with `save_last: true` calls _save_checkpoint a second time for last.ckpt, so every checkpoint event writes the same tensors twice -- ~21 GB a time on Pi 0.5 (the size tests/integration/test_train_step_gpu.py records). It was measured at 9 GB and ~1.3 min on the now-retired ABC-DiT-L, inside an event that blocked the run for 2.7-3.4 min of a 42.3-min 1000-step cycle. "link" writes a relative symlink to the epoch checkpoint just saved instead. Safe here because save_top_k is -1, so the target is never collected, and _should_remove_checkpoint returns False when previous == current, which is always the case for last.ckpt. Resume is unaffected: _requeue_resume_path gates on os.path.isfile, which follows symlinks. A link can dangle where a file could not: the target deleted by hand, last.ckpt dropped by an rsync without -l, or a preemption between Lightning's unlink and relink. isfile is False in all three, and the requeue path used to warn and silently restart the run from scratch. It now raises when last.ckpt dangles or is missing next to other checkpoints; only an empty checkpoint dir falls back. One behaviour difference worth knowing: with "link" the callback relinks on EVERY train epoch once any checkpoint exists, not only on checkpoint epochs, so there is an extra os.remove + os.symlink + strategy.barrier per epoch. The test drives a real two-epoch fit and asserts both halves: "link" leaves a relative symlink to the newest epoch checkpoint, and `true` leaves a regular file the same size as it -- the copy this removes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01M5dTGNydAZbRP1EsXgbp4W
RyanPCo
force-pushed
the
ryanco/opscale-ladder
branch
from
October 30, 2026 23:05
256238b to
f8a8ff4
Compare
RyanPCo
force-pushed
the
ryanco/ckpt-save-last-link
branch
from
October 30, 2026 23:05
e38fa26 to
4869a7f
Compare
Contributor
Author
|
Review findings: status after the fixup pass. The fixes are squashed into this PR's commits, and the whole stack was force-pushed. Fixed
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Writes
last.ckptas a relative symlink to the epoch checkpoint just saved (save_last: link), not a second full copy. Withsave_last: true,ModelCheckpointcalls_save_checkpointtwice per checkpoint event and writes the same tensors twice, ~21 GB each time on Pi 0.5.Behaviour changes
last.ckptis now a symlink incallbacks/checkpoints.yaml. Anything that copies checkpoint dirs must preserve links (rsync -l), orlast.ckptis lost.last.ckptnow raises. A link can dangle where a file could not: the target deleted by hand,last.ckptdropped by anrsyncwithout-l, or a preemption between Lightning's unlink and relink. The requeue path used to warn and silently restart the run from scratch. It now raisesFileNotFoundErrorwhenlast.ckptdangles, or is missing while the dir holds other.ckptfiles, and names theln -sfix. Only an empty checkpoint dir still falls back to the launch-timeckpt_path.os.remove+os.symlink+strategy.barrierper epoch.Why it is safe
save_top_kis -1, so the target is never collected._should_remove_checkpointreturns False when previous == current, which is always the case forlast.ckpt._requeue_resume_pathgates onos.path.isfile, which follows symlinks.Cost removed
On the now-retired ABC-DiT-L the second copy measured 9 GB and ~1.3 min, inside a checkpoint event that blocked the run for 2.7–3.4 min of a 42.3-min 1000-step cycle. Pi 0.5 checkpoints are ~21 GB.
Tests
New in
tests/unit/test_checkpoint_resume.py:test_save_last_link_writes_a_symlink_not_a_second_copydrives a real two-epoch fit.linkleaves a relative symlink to the newest epoch checkpoint;trueleaves a regular file the same size as it, which is the copy this removes.test_checkpoint_callback_links_last_instead_of_copyingchecks the composed config.test_requeue_resumes_through_a_symlinked_last_ckpt,test_requeue_with_a_dangling_last_ckpt_raises,test_requeue_with_checkpoints_but_no_last_ckpt_raises.🤖 Generated with Claude Code
https://claude.ai/code/session_01HjCQBqQCr2igFEMR7yUovw