diff --git a/llama.cpp b/llama.cpp index 99b5c5b392e09..ec4a7f94ccba8 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;