05-default-pretokenizer.diff 1.91 KB
Newer Older
xuxzh1's avatar
init  
xuxzh1 committed
1
2
3
4
5
diff --git a/src/llama.cpp b/src/llama.cpp
index a207451f..2ddf431d 100644
--- a/src/llama.cpp
+++ b/src/llama.cpp
@@ -5347,16 +5347,7 @@ static void llm_load_vocab(
mashun1's avatar
v1  
mashun1 committed
6
         if (vocab.type == LLAMA_VOCAB_TYPE_BPE) {
xuxzh1's avatar
init  
xuxzh1 committed
7
8
             vocab.tokenizer_add_space_prefix = false;
             vocab.tokenizer_clean_spaces = true;
mashun1's avatar
v1  
mashun1 committed
9
10
11
12
13
14
15
16
17
-            if (tokenizer_pre.empty()) {
-                LLAMA_LOG_WARN("%s: missing pre-tokenizer type, using: 'default'\n", __func__);
-                LLAMA_LOG_WARN("%s:                                             \n", __func__);
-                LLAMA_LOG_WARN("%s: ************************************        \n", __func__);
-                LLAMA_LOG_WARN("%s: GENERATION QUALITY WILL BE DEGRADED!        \n", __func__);
-                LLAMA_LOG_WARN("%s: CONSIDER REGENERATING THE MODEL             \n", __func__);
-                LLAMA_LOG_WARN("%s: ************************************        \n", __func__);
-                LLAMA_LOG_WARN("%s:                                             \n", __func__);
-                vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
xuxzh1's avatar
init  
xuxzh1 committed
18
19
-            } else if (tokenizer_pre == "default") {
+            if (tokenizer_pre == "default") {
mashun1's avatar
v1  
mashun1 committed
20
21
                 vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
             } else if (
xuxzh1's avatar
init  
xuxzh1 committed
22
23
24
25
                     tokenizer_pre == "llama3"   ||
@@ -5443,7 +5434,8 @@ static void llm_load_vocab(
                 tokenizer_pre == "codeshell") {
                 vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_CODESHELL;
mashun1's avatar
v1  
mashun1 committed
26
27
28
29
30
             } else {
-                throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
+                LLAMA_LOG_WARN("%s: missing or unrecognized pre-tokenizer type, using: 'default'\n", __func__);
+                vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
             }
xuxzh1's avatar
init  
xuxzh1 committed
31
         } else if (vocab.type == LLAMA_VOCAB_TYPE_SPM) {
mashun1's avatar
v1  
mashun1 committed
32
             vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;