From 30699689581f7349aea8a53b1ffbaa4901e176e0 Mon Sep 17 00:00:00 2001 From: Haiyue Wang Date: Tue, 18 Nov 2025 09:16:26 +0800 Subject: [PATCH] vocab : call reserve() for building plamo-2-translate suffix Test 'Q4_K_M' quantization on https://huggingface.co/pfnet/plamo-2-translate The 'suffix_to_score' size is 193510, it needs 19 memory allocation with final capacity 262144 to hold the value, if not preserve the memory. Signed-off-by: Haiyue Wang --- src/llama-vocab.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/llama-vocab.cpp b/src/llama-vocab.cpp index 29e31cecd1565..a73c4c448ba53 100644 --- a/src/llama-vocab.cpp +++ b/src/llama-vocab.cpp @@ -1281,6 +1281,7 @@ struct llm_tokenizer_plamo2 : llm_tokenizer { // Build suffix list in lexicographical order of reversed strings std::vector suffixes; + suffixes.reserve(suffix_to_score.size() + 1); for (const auto & pair : suffix_to_score) { suffixes.push_back(pair.first); }