Commit a3f84faf4 for llama.cpp
commit a3f84faf49ffb737227f4dd57d2e98ae5bfdfab7
Author: Toki Nasin <141258697+tokinasin@users.noreply.github.com>
Date: Wed Sep 30 02:30:40 2026 +0900
vocab : keep </s> NORMAL in PLaMo-2 and PLaMo-3 (#29580)
* vocab : keep </s> NORMAL in PLaMo-2 and PLaMo-3
The PLaMo-2 and PLaMo-3 vocabularies mark </s> as NORMAL. Current
EOG token heuristic matched it by text and added its attribute
to CONTROL.
Skip this heuristic for the PLAMO2 vocab type so </s> stays NORMAL
and is not treated as EOG.
* use <|plamo:eos|> for detection
diff --git a/src/llama-vocab.cpp b/src/llama-vocab.cpp
index e038637ce..9fdfe7372 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__);
}
}
}