Fix BPE training across consecutive line endings - #2370
Open
Alphaxiaoteng wants to merge 1 commit into
Open
Conversation
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.
Summary
Fixes #1534.
train_from_filespreviously fed each physical line to the BPE trainer independently. Consecutive newline-only lines therefore never appeared in one training sequence, so byte-level BPE could not learn merges such as膴膴. Keep ordinary lines unchanged while coalescing consecutive control-only lines in a private training iterator. The publicLinesWithEndingiterator keeps its existing behavior.Tests
cargo test training_lines --libcargo test --test training bpe_training_from_files_keeps_consecutive_line_endings_together -- --exactcargo test --libmake lintgit diff --checkAI assistance was used for repository analysis and implementation; the change and tests were reviewed manually.