Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IterableDataset.shard() #7252

Merged
merged 8 commits into from
Oct 25, 2024
Merged

Add IterableDataset.shard() #7252

merged 8 commits into from
Oct 25, 2024

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Oct 25, 2024

Will be useful to distribute a dataset across workers (other than pytorch) like spark

I also renamed .n_shards -> .num_shards for consistency and kept the old name for backward compatibility. And a few changes in internal functions for consistency as well (rank, world_size -> num_shards, index)

Breaking change: the new default for contiguous in Dataset.shard() is True, but imo not a big deal since I couldn't find any usage of contiguous=False internally (we always do contiguous=True for map-style datasets since its more optimized) or in the wild

@HuggingFaceDocBuilderDev

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.

@lhoestq lhoestq merged commit 65f6eb5 into main Oct 25, 2024
15 checks passed
@lhoestq lhoestq deleted the iterable-shard branch October 25, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants