Repository navigation
Studio: train a local dataset folder on its train split, not every file - #17938
Merged
danielhanchen merged 4 commits intoNov 16, 2026
Merged
Conversation
dataset_files_in_dir concatenated every supported file in a folder, so train.jsonl beside val.jsonl leaked validation rows into training, and a sidecar like filter_report.json failed the load with DatasetGenerationCastError. Reuse datasets' own split detection to keep only the train-split files when files are named by split, matching datasets.load_dataset(folder). Folders without split names, or without a train-named file, load every file as before. Fixes unslothai#17937
…w its train split [skip ci]
Member
|
@codex review |
1 similar comment
Member
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
1 of 5 tasks
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 #17937
Summary
A local training dataset folder now trains on the files
datasets.load_dataset(folder)puts in itstrainsplit, instead of concatenating every supported file.Before,
dataset_files_in_dirglobbed every.json/.jsonl/.csv/.parquetfile in the folder. Two failures followed:train.jsonl+val.jsonltrain.jsonlonlytrain.jsonl+filter_report.jsonDatasetGenerationCastError(the local form of #7585)train.jsonlonly, loadstrain-*.parquet+validation-*.parquet+test.parquettrain-*.parquetonlypart1.jsonl+part2.jsonl(no split names)val.jsonl+notes.jsonl(no train-named file)Change
studio/backend/utils/paths/storage_roots.pygains a_train_split_files(directory, files)helper, applied to both the parquet branch and the mixed-format branch ofdataset_files_in_dir:datasets.data_files.get_data_patternsandDataFilesDict.from_patterns, the same split inferenceload_datasetuses, so Studio anddatasetsagree on whattrainmeans instead of keeping a second keyword list.patterns == DEFAULT_PATTERNS_ALLor notrainkey), when the intersection is empty, or ifdatasetsraises. This keepstest_a_dataset_directory_prefers_its_parquet_export(which keeps a non-AppleDouble._mine.parquet) and other unnamed folders working as before.dataset_files_in_dirfeedsUnslothTrainer._resolve_local_files, the equivalent paths incore/training/worker.py, andcore/training/decision_trainer.py, so all of them pick up the fix.Note for review:
_resolve_local_filesis also used forlocal_eval_datasets, so a split-named folder chosen as the eval dataset now resolves to itstrainfiles too. I raised this in #17937. If you'd like eval to take the folder'svalidationfiles, I can add asplitargument in this PR.Tests
New
studio/backend/tests/test_dataset_folder_splits.pywith 5 tests:load_dataseton the result)On
main, the first three fail and the last two pass. With this change, all five pass.Regression check on macOS 27.0 (arm64), Python 3.12.6,
datasets==4.3.0, running everytests/test_*dataset*,*storage_roots*,*appledouble*and*s3*file instudio/backend(56 files): 1707 passed both with and without this change. The same 14 failures and 4 collection errors appear in both runs. They come from optional dependencies not installed locally (torch, video decoding, sandbox), not from this change.