-
Notifications
You must be signed in to change notification settings - Fork 3k
Webdataset dataset builder #6391
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
Conversation
mariosasko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
A high-level review :)
| ".parquet": ("parquet", {}), | ||
| ".arrow": ("arrow", {}), | ||
| ".txt": ("text", {}), | ||
| ".tar": ("webdataset", {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can make the module inference more robust by inspecting the contents of TAR archives (e.g., consecutive files with the same name (stem) but different extensions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some webdatasets may contain only one field (e.g. only images) so I'm not sure it would make sense.
Also I like the idea of keeping the TAR loading simple and only support webdataset for TAR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this would break some existing repos on the Hub, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TAR has never been supported on the Hub, what would it break ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you mean that some TAR datasets not in webdataset format won't work properly.
Maybe I can add an error message if the first webdataset examples don't have the same type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I thought this could fail on
Lines 449 to 450 in 27d1fe5
| elif ext == ".zip": | |
| return infer_module_for_data_files_list_in_archives(data_files_list, download_config=download_config) |
But this logic only inspects ZIP (and ignores TAR) archives :)
|
The documentation is not available anymore as the PR was closed or merged. |
|
I added an error message if the first examples don't appear to be in webdataset format |
Co-authored-by: Sylvain Lesage <[email protected]>
|
@mariosasko could you review this ? I think it's fine to have webdataset as an optional dependency for now, then depending on usage and user feedbacks see if it makes sense to have our own implementation or not |
| inferred_arrow_schema = pa.Table.from_pylist(first_examples[:1]).schema | ||
| features = datasets.Features.from_arrow_schema(inferred_arrow_schema) | ||
|
|
||
| # Set Image types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also do the same for the Audio feature, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes correct, that's for another PR :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, feel free to add a TO-DO.
|
I just removed the dependency on |
mariosasko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of nits, but looks good other than that
|
took your comments into account, lmk if you see anything else |
mariosasko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, LGTM!
Allow
load_datasetto support the Webdataset format.It allows users to download/stream data from local files or from the Hugging Face Hub.
Moreover it will enable the Dataset Viewer for Webdataset datasets on HF.
Implementation details
webdatasetis used by default, except unsafe ones like picklexopenTODOS