[python][torch] Support distributed iterable dataset sharding - #9429
Conversation
fb7c936 to
7dcf4cf
Compare
49b5d04 to
3334cd9
Compare
JingsongLi
left a comment
There was a problem hiding this comment.
Found two issues in the distributed Torch sharding path; please see the inline comments.
|
I compared this design with the current PyTorch, Lance, Hugging Face Datasets, WebDataset, and Ray Data implementations. Overall, the direction in this PR looks sound, and I do not see an architectural blocker. The main reasons are:
One useful comparison is Lance. Lance flattens distributed rank and DataLoader worker id into a global rank and supports fragment- and batch-level sharding. However, based on the current source, its distributed helper only observes a process group initialized in the current process. A spawned DataLoader worker does not retain the parent's initialized process group, while the deprecated explicit I would keep the current exact-coverage policy as well: assign every split once, allow uneven rank lengths, and require DDP uneven-input handling. This is preferable to silently duplicating or dropping data. A few non-blocking follow-ups may still be worthwhile:
So my recommendation is to keep the current API boundary and rank -> worker -> reader hierarchy. The comparison with other implementations reinforces this design rather than suggesting that Paimon should copy Lance's defaults. |
Agreed, I also went back and forth on Lance’s sharding model before settling on this design. |
JingsongLi
left a comment
There was a problem hiding this comment.
Reviewed the final head 05cbebc. The previously identified spawn-safety and DDP subgroup sharding issues are fixed, all required checks pass, and the cross-implementation comparison found no remaining architectural blocker.
What changed
auto_detect_rank=True.to_torchaccepts caller-planned splits.torch.distributed, then torchrun environment variables, and preserve it in spawned workers.DistributedDataParallel.join().Reference
The API is inspired by LanceDataset. Unlike Lance, this low-level API accepts external splits, so automatic sharding is opt-in.
Validation
git diff --checkpassed.