Repository navigation
Fix async map checkpoint accounting across repeated resumes - #8575
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Resuming an iterable dataset with an asynchronous map function works once, but a checkpoint captured during the resumed iteration can skip additional examples on the next resume. A deterministic identity coroutine over IDs 0–9, checkpointed after two outputs and again after one more output, produces
[0, 1, 2, 5, 6, 7, 8, 9]on main at19f69de53015525126e6d3f96859acb90498e364.The asynchronous output iterator restores the source snapshot without clearing
num_examples_since_previous_state. Replayed outputs, including the ones skipped for the current resume, are counted again on top of the loaded value. Reset this counter when establishing the asynchronous snapshot, keeping the separately captured skip count intact.The regression test covers repeated serialized checkpoints with synchronous and asynchronous callbacks, Arrow and Python sources, batched and unbatched maps, indices, and concurrency limits of 2 and 1000. Six of its sixteen cases fail before the change; all pass after it.
Validation on macOS ARM64 / Python 3.14.7 / PyArrow 25.0.1:
tests/test_iterable_dataset.py -m unit -k 'not test_interleave_dataset_with_sharding': 461 passed, 45 skipped, 6 deselected. Optional frameworks such as torch are not installed; this is not full cross-platform or distributed validation.git diff --check: pass.This appears distinct from #8295, which repaired stale state references after loading, and from #8408, which addresses shuffle buffers. Open PR #7656 also concerns map checkpointing, but its current diff delegates state methods to the source rather than fixing this asynchronous replay counter. The original #7630 reproduction already returns the expected continuation on this main revision. This patch addresses checkpoints taken after an async resume. Please advise if coordination with that work is needed.
AI assistance: I used Codex to help investigate the issue and prepare the fix and regression tests. I have reviewed the code, tests, and investigation results. The validation reported above was executed locally.