TikToken-like tokenizer extension implementation
Make sure you have the correct python dependencies (maturin is one of them)
maturin developpython3 llama_ext.py --text test.txt --vocab_size 128050tokenizer: Tokenizer to extendtext: Training corpuseval_text: Texts to evaluate oneval_steps: Evaluate every N steps, defaults to 1.0 which means evaluate once at the end. A float input represents a fraction of the max_length, while an int input denotes the exact number of steps between each evaluation round.stopping_strategy: Stopping strategy to follow. Defaults tomax_lengthwhich means no stopping. Choices:max_length,fertility_limit,fertility_plateaufertility_limit: Low bound of target fertility, used withfertility_limitstopping strategystopping_sensitivity: Difference over the last N (TBD) eval steps that hasn't been reachedtarget_vocab_size: Maximum vocab size to reachuse_fast: Some tokenizers need to be initialized as a fast tokenizer
python3 extend_hf_tokenizer.py --initial_tokenizer meta-llama/Meta-Llama-3.1-8B-instruct --vocab llama_3_ext.vocab --merges llama_3_ext.merges --save_as krikri_tokenizerinitial_tokenizer: Tokenizer that we extendedvocab: Output vocab from previous scriptmerges: Output merges from previous scriptsave_as: Directory name of new tokenizer