Repository navigation
Fix module inference for compound extensions and tie-break order (#9099) - #9109
Open
zhengdaodeguL wants to merge 1 commit into
Open
zhengdaodeguL wants to merge 1 commit into
zhengdaodeguL wants to merge 1 commit into
Conversation
…gingface#9099) Only infer WebDataset from a final .tar suffix, preserving known data suffixes inside compound extensions. Resolve format ties by preferring parquet and then alphabetical order while retaining count and metadata precedence. Thanks to PCTEJA for reporting both issues in huggingface#9099.
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.
Fixes #9099
infer_module_for_data_files_listhad two bugs:Compound extensions miscounted: it counted every component after the first dot, so
data.tar.gzcontributed.tarand was inferred as thewebdatasetmodule — even though the tarball's contents are never inspected and may be parquet/CSV/JSON. Now.taronly counts when it is the final suffix, sodata.tar.gzyields no inferred module whiledata.csv.gzstill correctly inferscsv(anddata.tarstill inferswebdataset).Reversed tie-break: the docstring promises that in a draw ".parquet is the favorite, and then alphabetical order", but the sort used
reverse=True, so the alphabetical tie-break ran backwards (a.csv+b.jsonpickedjson). The sort key is now ascending with parquet as the explicit favorite, matching the docstring. Count precedence (most common extension wins) and metadata-file exclusion are unchanged.Thanks to PCTEJA for reporting both issues with a precise root-cause analysis.
Verification
tests/test_load.pycovering compound extensions (data.tar.gz→ None,train.csv.gz→ csv,data.parquet.tar.xz→ parquet,zip://URLs), tie-breaks (csv/json → csv, arrow/lance → arrow, json/parquet → parquet), count precedence (2×json beats parquet), and metadata exclusion. All 46 inference tests pass; the 9 behavior-changing cases fail on base (verified with a source-only base control).rufflint/format clean.