Repository navigation
datasets/huggingface.py: concurrent workers for TransformAndMapHuggingFaceDatasetJob + HF Hub transient-drop retries - #664
Open
robin-p-schmitt wants to merge 5 commits into
Open
robin-p-schmitt wants to merge 5 commits into
robin-p-schmitt wants to merge 5 commits into
Conversation
…eDatasetJob work over concurrent workers
michelwi
reviewed
Sep 17, 2026
Comment on lines
+366
to
+372
| # `features` (a datasets.Features/Audio/Value/... object) can't be stored directly as a | ||
| # job attribute: sisyphus's generic object-state reflection (used e.g. to find tk.Path | ||
| # inputs, regardless of whether the containing dict is hashed) walks the whole job | ||
| # __dict__ and fails on the underlying pyarrow DataType objects. So `features` may instead | ||
| # be a plain top-level function that builds and returns the Features object -- exactly | ||
| # like `map_func`/`transform`, which are already handled this way -- called here instead | ||
| # of being stored anywhere. |
Contributor
There was a problem hiding this comment.
Please check (or have your LLM do it) if some comments/docstrings can be shortened or omitted. (e.g. I don't think we need 7 lines of explanation on why we would call this if it is callable.)
michelwi
approved these changes
Sep 23, 2026
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.
Two changes for downloading/processing very large HF datasets (e.g. People's Speech, ~5000 WebDataset tar shards, several TB):
Splits load_dataset_opts["data_files"] round-robin into N buckets, each run as its own task array index writing to its own out_dirs[i] instead of a single out_dir. Buckets are independently resumable and progress-trackable, and double as shards for training. sis_hash_exclude = {"concurrent": None} keeps existing instances' hashes.
Along with it:
huggingface_hub (1.16.1) does not survive a CDN closing the connection mid-body (httpx.RemoteProtocolError), which loses a whole multi-hour shard: _DEFAULT_RETRY_ON_EXCEPTIONS doesn't cover it, and HfFileSystemStreamFile.read retries exactly once. The patch adds the exception to the retry tuple (also in the kwdefaults of _http_backoff_base/http_backoff/http_stream_backoff, since defaults bind at def time) and wraps the stream read in a capped exponential backoff that clears self.response, so _open_connection() re-requests with a Range header and the read resumes at self.loc. Best-effort and idempotent: every step is individually guarded and falls back to the original
behaviour.