Skip to content

Fix BPE training across consecutive line endings - #2370

Open
Alphaxiaoteng wants to merge 1 commit into
huggingface:mainfrom
Alphaxiaoteng:fix/issue-1534-consecutive-line-endings
Open

Fix BPE training across consecutive line endings#2370
Alphaxiaoteng wants to merge 1 commit into
huggingface:mainfrom
Alphaxiaoteng:fix/issue-1534-consecutive-line-endings

Conversation

@Alphaxiaoteng

Copy link
Copy Markdown

Summary

Fixes #1534.

train_from_files previously 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 public LinesWithEnding iterator keeps its existing behavior.

Tests

  • cargo test training_lines --lib
  • cargo test --test training bpe_training_from_files_keeps_consecutive_line_endings_together -- --exact
  • cargo test --lib
  • make lint
  • git diff --check

AI assistance was used for repository analysis and implementation; the change and tests were reviewed manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to allow the merging of consecutive newline tokens \n when training a byte-level bpe tokenizer?

1 participant