summaryrefslogtreecommitdiff
path: root/examples/gbnf-validator/gbnf-validator.cpp
diff options
context:
space:
mode:
authorOlivier Chafik <ochafik@users.noreply.github.com>2024-04-11 19:47:34 +0100
committerGitHub <noreply@github.com>2024-04-11 19:47:34 +0100
commitcbaadc92942c50aab599a9e4c163afc1f44f7c26 (patch)
tree0a4b962430740a81a6b1789f1edd9ee50074dde3 /examples/gbnf-validator/gbnf-validator.cpp
parent1bbdaf6ecda6f0a360dfb307b256fcb6838c560b (diff)
grammars: 1.5x faster inference w/ complex grammars (vector reserves / reuses) (#6609)
* grammars: reserve rejects & next candidates * grammars: reuse new_stacks * grammars: fix missing sig change in llama.h * grammars: fix test (api changed) * grammars: update gbnf-validator.cpp * grammars: simpler syntax (no swap)
Diffstat (limited to 'examples/gbnf-validator/gbnf-validator.cpp')
-rw-r--r--examples/gbnf-validator/gbnf-validator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/gbnf-validator/gbnf-validator.cpp b/examples/gbnf-validator/gbnf-validator.cpp
index e4c0c168..091069ff 100644
--- a/examples/gbnf-validator/gbnf-validator.cpp
+++ b/examples/gbnf-validator/gbnf-validator.cpp
@@ -17,7 +17,7 @@ static bool llama_sample_grammar_string(struct llama_grammar * grammar, const st
size_t pos = 0;
for (auto it = code_points.begin(), end = code_points.end() - 1; it != end; ++it) {
auto prev_stacks = grammar->stacks;
- grammar->stacks = llama_grammar_accept(grammar->rules, grammar->stacks, *it);
+ llama_grammar_accept(grammar->rules, prev_stacks, *it, grammar->stacks);
if (grammar->stacks.empty()) {
error_pos = pos;
error_msg = "Unexpected character '" + unicode_cpt_to_utf8(*it) + "'";