data
data copied to clipboard
[DataPipe] shard expander
This PR adds a ShardExpander filter, a filter that will take shard specs of the form "prefix-{000..999}.tar" and expand them into the 1000 corresponding file names, like the shell brace expansion. This only implements numerical range expansion (rather than full shell-style brace expansion).
Specifying collections of files in terms of numerical shard specs (instead of using classes like FileLister) has a number of advantages: (1) it does not require the ability to list files on the target (not possible in general for, for example, HTTP), (2) it documents and makes specifying a collection of files reproducible and independent of the state of the storage system, (3) it makes it easy to choose different dataset sizes by specifying different numerical subranges.
ShardExpander is frequently used with WebDataset to specify collections of training shards.
@tmbdev Do you still plan to work on this (and related) PRs?
Yes, I'm planning on working on the handful of PRs we have been discussing and addressing the issues raised.
I've update the PR and I believe I have addressed all the comments.
@VitalyFedyunin Mind taking a look at this PR?
@VitalyFedyunin Mind taking a look at this PR?
We'll have a look tomorrow or Wednesday. Thanks!
LGTM for me with @NivekT suggestions applied
@NivekT has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.