From a3f84faf49ffb737227f4dd57d2e98ae5bfdfab7 Mon Sep 17 00:00:00 2001 From: Toki Nasin <141258697+tokinasin@users.noreply.github.com> Date: Wed, 30 Sep 2026 02:30:40 +0900 Subject: [PATCH] vocab : keep NORMAL in PLaMo-2 and PLaMo-3 (#29580) * vocab : keep NORMAL in PLaMo-2 and PLaMo-3 The PLaMo-2 and PLaMo-3 vocabularies mark 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 stays NORMAL and is not treated as EOG. * use <|plamo:eos|> for detection --- src/llama-vocab.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 as an eog token + // gemma4 and plamo have a normal 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 == "") { 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 '' token from EOG list\n", __func__); + LLAMA_LOG_WARN("%s: '' is a normal token here, removing it from EOG list\n", __func__); } } }