Repository navigation
Conversation
This branch has not been deployed
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.
Problem
Directory-backed embedder and reranker training load JSON/JSONL files in the order returned by
os.listdir. That order can differ between hosts even when every host has the same files and the training seed is identical.This changes concatenated row indices and capped per-file sampling. For same-dataset training, ranks can therefore combine examples from different datasets in one global batch and duplicate or omit rows across the epoch.
Change
Sort directory entries in the three training loaders before loading or sampling files. Preserve the caller's
train_dataorder and the existing JSON/JSONL filtering.Validation
PYTHONPATH=. python -m pytest tests/test_finetune_file_order.py tests/test_finetune_trainer_compat.py -q --tb=short: 11 passed.The seven new regression cases fail on unchanged master and pass with this patch. They exercise the real dataset constructors and local JSONL data under reversed directory listings:
The four existing trainer compatibility tests also pass. Ruff check and formatting pass for the new tests, and
git diff --checkpasses.Validation used Python 3.12.14, PyTorch 2.15.0+cpu, Transformers 4.57.1 and Datasets 5.0.1. The rank test exercises dataset partitioning locally; a distributed GPU training job was not run.