diff options
author | DAN™ <dranger003@gmail.com> | 2024-05-05 01:19:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-05 08:19:30 +0300 |
commit | 889bdd76866ea31a7625ec2dcea63ff469f3e981 (patch) | |
tree | bcfaea83b66f89181980b64dba57a8c8f8f31a49 /llama.cpp | |
parent | 6fbd43221167bf96112f899daf22c127b282cbcf (diff) |
command-r : add BPE pre-tokenization (#7063)
* Add BPE pre-tokenization for Command-R/R+.
* Bump transformers convert requirement.
* command-r : add individual digits regex
---------
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'llama.cpp')
-rw-r--r-- | llama.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -4386,6 +4386,9 @@ static void llm_load_vocab( } else if ( tokenizer_pre == "refact") { vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_REFACT; + } else if ( + tokenizer_pre == "command-r") { + vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_COMMAND_R; } else { throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str())); } @@ -12238,6 +12241,7 @@ struct llm_tokenizer_bpe { break; case LLAMA_VOCAB_PRE_TYPE_STARCODER: case LLAMA_VOCAB_PRE_TYPE_REFACT: + case LLAMA_VOCAB_PRE_TYPE_COMMAND_R: word_collection = unicode_regex_split(text, { "\\p{N}", "'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)", |