Fix probabilistic interleave of empty sources without replacement - #8627
Open
HaokaiDing wants to merge 1 commit into
Open
HaokaiDing wants to merge 1 commit into
HaokaiDing wants to merge 1 commit into
Conversation
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.
Fixes #8626.
When probabilistic
interleave_datasetsusesall_exhausted_without_replacement, an empty source starts as not exhausted. Its first draw appends an invalid source offset, producing a duplicate row from the next dataset or anIndexErrorwhen the empty source is last.Mark empty sources exhausted initially for this strategy, so the existing skip-exhausted-source logic handles them. The other stopping strategies are unchanged.
This is separate from #8399 (no-probabilities
all_exhausted) and #8318 (vectorized probabilisticfirst_exhausted/all_exhausted); the latter retains the without-replacement loop with the all-False initialization.Validation:
HF_HUB_OFFLINE=1 .venv/bin/pytest tests/test_arrow_dataset.py -k 'probabilities_without_replacement_empty_source or probabilities_without_replacement_all_empty' -q: 14 passed.git diff --checkpass.Prepared with OpenAI Codex; tests were executed locally and the diff received an independent review by another Codex agent.