Fix double sharding in ShuffleBuffer#9014
Conversation
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
monai/data/iterable_dataset.py (1)
127-128: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd Google-style docstrings to the changed definitions.
monai/data/iterable_dataset.py#L127-L128: document the yielded item with aYields:section.tests/data/test_shuffle_buffer.py#L42-L42: add a concise docstring describing the regression scenario and assertions.As per path instructions, every definition must have an appropriate Google-style docstring.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@monai/data/iterable_dataset.py` around lines 127 - 128, Document the changed definition in monai/data/iterable_dataset.py at lines 127-128 with a Google-style docstring that includes a Yields: section describing the yielded item. Also add a concise Google-style docstring to the regression test definition in tests/data/test_shuffle_buffer.py at line 42 describing the scenario and assertions.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@monai/data/iterable_dataset.py`:
- Around line 127-128: Document the changed definition in
monai/data/iterable_dataset.py at lines 127-128 with a Google-style docstring
that includes a Yields: section describing the yielded item. Also add a concise
Google-style docstring to the regression test definition in
tests/data/test_shuffle_buffer.py at line 42 describing the scenario and
assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2540d5b4-e2cd-4ba1-b2d5-c7952b78608e
📒 Files selected for processing (2)
monai/data/iterable_dataset.pytests/data/test_shuffle_buffer.py
52ce061 to
5eb2edd
Compare
Signed-off-by: kyinhub <kevinpyin@gmail.com>
5eb2edd to
4000d9a
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Closes #7986.
Description
ShuffleBufferno longer applies worker partitioning twice when its source is already a PyTorch/MONAIIterableDataset.A MONAI
IterableDatasetshards its source in its own iterator.ShuffleBufferthen wrapped that already-sharded generator in anotherIterableDataset, which sharded it again. With two workers this reduced 40 unique source items to 20 outputs. Ordinary iterable sources retain the existing shuffle-then-partition path, and transforms remain exactly-once.Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.Validation
upstream/devdue to double sharding;python -m pytest tests/data/test_shuffle_buffer.py tests/data/test_iterable_dataset.py -q: 5 passed;ruff checkon both touched files;git diff --check.