From eb9d1fcd7dbef531a14783a0ff2fabbe4a2812ee Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 4 Dec 2023 14:10:11 -0800 Subject: [PATCH] reserve canidates_grammar --- llama.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llama.cpp b/llama.cpp index 99b5c5b39..ec4a7f94c 100644 --- a/llama.cpp +++ b/llama.cpp @@ -7359,6 +7359,7 @@ void llama_sample_grammar(struct llama_context * ctx, llama_token_data_array * c std::vector, llama_partial_utf8>> candidates_decoded; candidates_decoded.reserve(candidates->size); std::vector candidates_grammar; + candidates_grammar.reserve(candidates->size); for (size_t i = 0; i < candidates->size; ++i) { const llama_token id = candidates->data[i].id;