From 1e0f466920dbd6747852db864118266e6f256700 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Thu, 11 Apr 2024 18:51:19 +0100 Subject: [PATCH] grammars: simpler syntax (no swap) --- llama.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama.cpp b/llama.cpp index 13a6807fc..ad07059c4 100644 --- a/llama.cpp +++ b/llama.cpp @@ -12776,7 +12776,7 @@ void llama_grammar_accept_token(struct llama_context * ctx, struct llama_grammar std::vector> tmp_new_stacks; for (auto it = code_points.begin(), end = code_points.end() - 1; it != end; ++it) { llama_grammar_accept(grammar->rules, grammar->stacks, *it, tmp_new_stacks); - tmp_new_stacks.swap(grammar->stacks); + grammar->stacks = tmp_new_stacks; } grammar->partial_utf8 = decoded.second; GGML_ASSERT(!grammar->stacks.empty());