Add tokenizer training pipeline and extract src/tokenizer.py#6
Closed
ncylich wants to merge 2 commits into
Closed
Conversation
- Extract all tokenizer code from data.py into src/tokenizer.py:
token ID constants, NeedleTokenizer, pre_tokenize(), train_tokenizer(),
get_tokenizer(), and SP training config (_SP_TRAIN_KWARGS)
- Re-export everything from data.py so existing callers are unaffected
- Add src/tokenizer_train.py: standalone GCS corpus pipeline with
prepare/train/validate subcommands
- pre_tokenize() isolates ( ) { } [ ] " , so BPE never merges them
- user_defined_symbols hardcodes tool_call=4, transcribe=5, and all
8 structural chars at fixed IDs 6-13
- Trained tokenizer: 8192 vocab, 4.63 chars/token compression,
0 isolated-char violations (model/vocab gitignored, on GCS)
- Add docs/tokenization_plan.md with full design rationale
- Extract all tokenizer code from data.py into src/tokenizer.py:
token ID constants, NeedleTokenizer, pre_tokenize(), train_tokenizer(),
get_tokenizer(), and SP training config (_SP_TRAIN_KWARGS)
- Re-export everything from data.py so existing callers are unaffected
- Add src/tokenizer_train.py: standalone GCS corpus pipeline with
prepare/train/validate subcommands
- pre_tokenize() isolates ( ) { } [ ] " , so BPE never merges them
- user_defined_symbols hardcodes tool_call=4, transcribe=5, and all
8 structural chars at fixed IDs 6-13
- Trained tokenizer: 8192 vocab, 4.63 chars/token compression,
0 isolated-char violations (model/vocab gitignored, on GCS)
- Gitignore docs/tokenization_plan.md
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
src/tokenizer.pyfromsrc/data.py: all tokenizer code (constants,NeedleTokenizer,pre_tokenize(),train_tokenizer(),get_tokenizer(), SP config) now lives in its own module.data.pyre-exports everything so existing callers are unaffected.src/tokenizer_train.py: standalone GCS corpus pipeline withprepare,train, andvalidatesubcommands for running on a GCP VM.pre_tokenize()isolates( ) { } [ ] " ,with spaces so BPE never merges them into multi-char tokens.user_defined_symbolshardcodes<tool_call>=4,<transcribe>=5, and all 8 structural chars at fixed IDs 6–13.docs/tokenization_plan.md(internal design doc).Test plan
src.tokenizer,src.datare-exports,src.tokenizer_trainpre_tokenize()correctly isolates all 8 charsneedle train --toystill works end-to-end with new tokenizer