2024-10-17 18:59:52 +00:00
|
|
|
From 0e531d69786c4a96a3a2bcf7b2d576bd6f7edf25 Mon Sep 17 00:00:00 2001
|
2024-09-16 22:58:55 +00:00
|
|
|
From: Michael Yang <mxyng@pm.me>
|
|
|
|
Date: Mon, 16 Sep 2024 15:53:13 -0700
|
|
|
|
Subject: [PATCH] 05-default-pretokenizer.diff
|
|
|
|
|
|
|
|
---
|
|
|
|
src/llama.cpp | 14 +++-----------
|
|
|
|
1 file changed, 3 insertions(+), 11 deletions(-)
|
|
|
|
|
2024-07-05 17:25:58 +00:00
|
|
|
diff --git a/src/llama.cpp b/src/llama.cpp
|
2024-10-17 18:59:52 +00:00
|
|
|
index 4c0a1bb6..800dfb95 100644
|
2024-07-05 17:25:58 +00:00
|
|
|
--- a/src/llama.cpp
|
|
|
|
+++ b/src/llama.cpp
|
2024-10-17 18:59:52 +00:00
|
|
|
@@ -6287,16 +6287,7 @@ static void llm_load_vocab(
|
2024-05-30 23:20:22 +00:00
|
|
|
if (vocab.type == LLAMA_VOCAB_TYPE_BPE) {
|
2024-07-07 17:03:09 +00:00
|
|
|
vocab.tokenizer_add_space_prefix = false;
|
|
|
|
vocab.tokenizer_clean_spaces = true;
|
2024-05-30 23:20:22 +00:00
|
|
|
- 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__);
|
2024-05-23 21:16:26 +00:00
|
|
|
- vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
2024-06-17 19:56:16 +00:00
|
|
|
- } else if (tokenizer_pre == "default") {
|
|
|
|
+ if (tokenizer_pre == "default") {
|
2024-05-30 23:20:22 +00:00
|
|
|
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
2024-05-23 21:16:26 +00:00
|
|
|
} else if (
|
2024-06-17 19:56:16 +00:00
|
|
|
tokenizer_pre == "llama3" ||
|
2024-10-17 18:59:52 +00:00
|
|
|
@@ -6398,7 +6389,8 @@ static void llm_load_vocab(
|
|
|
|
vocab.tokenizer_add_bos = true;
|
|
|
|
vocab.tokenizer_clean_spaces = false;
|
2024-05-23 21:16:26 +00:00
|
|
|
} else {
|
|
|
|
- throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
|
2024-05-30 23:20:22 +00:00
|
|
|
+ LLAMA_LOG_WARN("%s: missing or unrecognized pre-tokenizer type, using: 'default'\n", __func__);
|
2024-05-23 21:16:26 +00:00
|
|
|
+ vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
|
|
|
}
|
2024-07-05 17:25:58 +00:00
|
|
|
} else if (vocab.type == LLAMA_VOCAB_TYPE_SPM) {
|
2024-05-23 21:16:26 +00:00
|
|
|
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
2024-09-16 22:58:55 +00:00
|
|
|
--
|
2024-10-17 18:59:52 +00:00
|
|
|
2.39.3 (Apple Git-146)
|
2024-09-16 22:58:55 +00:00
|
|
|
|