Răsfoiți Sursa

vocab : call reserve() for building plamo-2-translate suffix (#17343)

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 <haiyuewa@163.com>
Haiyue Wang 1 lună în urmă
părinte
comite
a045492088
1 a modificat fișierele cu 1 adăugiri și 0 ștergeri
  1. 1 0
      src/llama-vocab.cpp

+ 1 - 0
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<std::string> suffixes;
+        suffixes.reserve(suffix_to_score.size() + 1);
         for (const auto & pair : suffix_to_score) {
             suffixes.push_back(pair.first);
         }