Repository navigation
Count examples in structured DataAnalyzer batches - #8505
Open
vineethsaivs wants to merge 2 commits into
Open
vineethsaivs wants to merge 2 commits into
vineethsaivs wants to merge 2 commits into
Conversation
vineethsaivs
requested review from
loadams,
tjruwase and
tohtana
as code owners
September 13, 2026 19:20
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The equivalent DistributedDataAnalyzer path retains the same structured-batch corruption bug.
Review effort: Balanced
Findings: 1
What changed in this PR
Fixes incorrect sample-ID advancement for structured DataAnalyzer batches.
Changes:
- Advances offsets using sampler batch size, capped for partial batches.
- Adds tensor, dictionary, tuple, partition, and remapping regressions.
| File | Description |
|---|---|
data_analyzer.py |
Corrects file-backed analyzer offsets. |
test_data_efficiency.py |
Adds output-based regression coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+185
to
+186
| # The batch sampler counts examples; len(data) can count dict keys or tuple fields. | ||
| processed_sample += min(self.batch_size, total_sample - processed_sample) |
Contributor
Author
There was a problem hiding this comment.
Same bug, fixed in 72bb53e with the same step and a single-process test for DistributedDataAnalyzer.run_map_helper.
banxingmjj
pushed a commit
to openanolis/DeepSpeed
that referenced
this pull request
Oct 9, 2026
…peedai#8758) `DataAnalyzer.run_map` fills the process list in the order of `threads_to_run` but starts and joins with `p[thread]`, so `specific_threads` only works when it is `[0, 1, ..., k]`. Anything else, like `[2, 3]` to rerun two failed threads, raises `IndexError: list index out of range`. Fix: start the process that was just appended (`p[-1]`) and join over `p` directly. Two lines. Test: `test_data_analyzer_runs_only_the_specific_threads` runs `run_map` with `num_threads=4, specific_threads=[2, 3]` and checks that only `worker0_thread2` and `worker0_thread3` are written, holding samples 10 to 14 and 15 to 19. It fails on master with the IndexError and passes with the fix. `pytest tests/unit/runtime/test_data_efficiency.py`: 15 passed, 2 skipped (the two-GPU curriculum tests). Run on an M-series Mac, CPU only, torch 2.14.0. pre-commit passes on both changed files. This doesn't touch the `len(data)` sample counting in the same file, which deepspeedai#8505 already covers. Fixes deepspeedai#8757 Signed-off-by: rakshit-gen <sisodiarakshit456@gmail.com> Co-authored-by: Olatunji Ruwase <tunji.ruwase@snowflake.com>
Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
run_map_helper advanced batch_start_idx by len(data), which counts dict keys or tuple fields. Advance by the sampler batch size instead, capped at the thread end, like the file-backed analyzer. Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
vineethsaivs
force-pushed
the
fix-data-analyzer-batch-count
branch
from
November 29, 2026 08:08
72bb53e to
d4e63c8
Compare
This branch has not been deployed
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.

DataAnalyzer writes incorrect sample IDs after the first dictionary or tuple batch, corrupting the metric-to-sample mapping used by curriculum learning.
Cause: len(data) counts batch fields instead of examples.
Fix: Advance by the fixed batch sampler size, capped by the remaining samples.
Test: Four regressions fail before; all six pass afterward through real run_map output files. Covers tensor/dict/tuple batches, two worker partitions, a partial batch and remapped IDs. Related data-efficiency tests: 20 passed, 2 skipped. Apple M2 Pro CPU, torch 2.11.0. Changed-file pre-commit passes; distributed training was not run.