Skip to content

Fix sampler exhaustion after repeated checkpoint resumes - #198

Merged
francois-drielsma merged 1 commit into
mainfrom
fix/repeated-resume-sampler
Nov 26, 2026
Merged

francois-drielsma merged 1 commit into
mainfrom
fix/repeated-resume-sampler

Conversation

@francois-drielsma

Copy link
Copy Markdown
Member

Repeated checkpoint/resume cycles within one epoch can exhaust the training DataLoader early. A restored sampler holds only the unconsumed suffix, but the next checkpoint sliced that suffix using the absolute epoch cursor again. For example, saving after 40 of 100 samples, resuming for 10 more, and saving again kept indices 90–99 instead of 50–99.

Track the suffix origin and original epoch extent for batch, joint, and distributed samplers. Subsequent checkpoints slice relative to that origin, and fresh epochs reset it. Valid legacy checkpoints remain supported; inconsistent saved suffixes fail at restore with an actionable error. This prevents future truncation but cannot reconstruct indices already lost from older checkpoints.

Validation: 120 sampler, IOManager, and continuation tests pass using PyTorch 2.6.0, including real rank-local DataLoaders for all four ranks across repeated resumes and an epoch boundary. All five sampler-family regression cases fail against the original implementation. Pre-commit checks pass. No GPU training run has been performed for this patch.

Investigated after matching HD/VD NERSC StopIteration failures; their actual checkpoint contents still need examination to confirm this is the cause of those runs.

@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8f1fbc7) to head (a0ee12b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #198   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          445       445           
  Lines        39919     39921    +2     
=========================================
+ Hits         39919     39921    +2     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/spine/io/sample.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@francois-drielsma
francois-drielsma merged commit 04c8de6 into main Nov 26, 2026
19 checks passed
@francois-drielsma
francois-drielsma deleted the fix/repeated-resume-sampler branch November 26, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant