support for Poro chat pre-tokenizer
This commit is contained in:
parent
1d8fca72ae
commit
f3534141c9
2 changed files with 11 additions and 1 deletions
11
llama.cpp
11
llama.cpp
|
@ -4596,7 +4596,11 @@ static void llm_load_vocab(
|
||||||
} else if (
|
} else if (
|
||||||
tokenizer_pre == "smaug-bpe") {
|
tokenizer_pre == "smaug-bpe") {
|
||||||
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_SMAUG;
|
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_SMAUG;
|
||||||
} else {
|
} else if (
|
||||||
|
tokenizer_pre == "Poro-34B-chat") {
|
||||||
|
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_PORO;
|
||||||
|
}
|
||||||
|
else {
|
||||||
throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
|
throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -12580,6 +12584,11 @@ struct llm_tokenizer_bpe {
|
||||||
"(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
"(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case LLAMA_VOCAB_PRE_TYPE_PORO:
|
||||||
|
word_collection = unicode_regex_split(text, {
|
||||||
|
" ?[^(\\s|.,!?…。,、।۔،)]+",
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// default regex for BPE tokenization pre-processing
|
// default regex for BPE tokenization pre-processing
|
||||||
word_collection = unicode_regex_split(text, {
|
word_collection = unicode_regex_split(text, {
|
||||||
|
|
1
llama.h
1
llama.h
|
@ -86,6 +86,7 @@ extern "C" {
|
||||||
LLAMA_VOCAB_PRE_TYPE_OLMO = 12,
|
LLAMA_VOCAB_PRE_TYPE_OLMO = 12,
|
||||||
LLAMA_VOCAB_PRE_TYPE_DBRX = 13,
|
LLAMA_VOCAB_PRE_TYPE_DBRX = 13,
|
||||||
LLAMA_VOCAB_PRE_TYPE_SMAUG = 14,
|
LLAMA_VOCAB_PRE_TYPE_SMAUG = 14,
|
||||||
|
LLAMA_VOCAB_PRE_TYPE_PORO = 15,
|
||||||
};
|
};
|
||||||
|
|
||||||
// note: these values should be synchronized with ggml_rope
|
// note: these values should be synchronized with ggml_rope
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue