Skip to content

LLM inference in C/C++

C++ ggml

vocab : keep </s> NORMAL in PLaMo-2 and PLaMo-3 (#29580)

Toki Nasina3f84faf49ff
diff --git a/src/llama-vocab.cpp b/src/llama-vocab.cpp
index e038637ce7..9fdfe7372c 100644
--- a/src/llama-vocab.cpp
+++ b/src/llama-vocab.cpp
@@ -2996,9 +2996,9 @@ void llama_vocab::impl::load(llama_model_loader & ml, const LLM_KV & kv) {
}
}
- // workaround for gemma4 and paddleocr: do not include </s> as an eog token
+ // gemma4 and plamo have a normal </s> token, unlike paddleocr
{
- bool has_tool_response = false;
+ bool has_normal_s_marker = false;
bool has_s = false;
llama_token s_id = LLAMA_TOKEN_NULL;
@@ -3008,21 +3008,21 @@ void llama_vocab::impl::load(llama_model_loader & ml, const LLM_KV & kv) {
continue;
}
const auto & text = id_to_token[tid].text;
- if (text == "<|tool_response>") {
- has_tool_response = true;
+ if (text == "<|tool_response>" || text == "<|plamo:eos|>") {
+ has_normal_s_marker = true;
} else if (text == "</s>") {
has_s = true;
s_id = tid;
}
}
- if (has_tool_response && has_s) {
+ if (has_normal_s_marker && has_s) {
special_eog_ids.erase(s_id);
auto & attr = id_to_token[s_id].attr;
attr = LLAMA_TOKEN_ATTR_NORMAL;
- LLAMA_LOG_WARN("%s: special_eog_ids contains '<|tool_response>', removing '</s>' token from EOG list\n", __func__);
+ LLAMA_LOG_WARN("%s: '</s>' is a normal token here, removing it from EOG list\n", __func__);
}
}
}