Add force_sample_level to split_dataset_by_node#8268
Open
muyihao wants to merge 1 commit into
Open
Conversation
Allow users to explicitly request sample-level sharding for streaming
`IterableDataset` even when `num_shards % world_size == 0`. Default behavior
is unchanged.
When `num_physical_files < world_size`, or when shards divide evenly but are
too few or too imbalanced for shard-level sharding, applying sample-level
sharding before expensive `map`/`filter` avoids duplicating those
transformations across nodes:
ds = split_dataset_by_node(ds, rank, world_size, force_sample_level=True)
ds = ds.map(tokenize_fn) # only the examples this rank consumes
Map-style datasets ignore the flag.
Closes huggingface#8253
Author
|
@lhoestq , hi, could you please help review this PR? Thanks! |
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.
Allow users to explicitly request sample-level sharding for streaming
IterableDataseteven whennum_shards % world_size == 0. Default behavior is unchanged.When
num_physical_files < world_size, or when shards divide evenly but are too few or too imbalanced for shard-level sharding, applying sample-level sharding before expensivemap/filteravoids duplicating those transformations across nodes:Map-style datasets ignore the flag.
Closes #8253