ggml-ci
This commit is contained in:
Georgi Gerganov 2024-07-19 14:21:33 +03:00
parent b4b242e6bd
commit 689d377916
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
3 changed files with 5 additions and 11 deletions

View file

@ -49,13 +49,13 @@ static bool match_string(const std::string & input, llama_grammar * grammar) {
const auto & code_points = decoded.first;
const llama_grammar_rules & prev_rules = llama_grammar_get_rules (grammar);
const llama_grammar_rules & rules = llama_grammar_get_rules (grammar);
llama_grammar_stacks & cur_stacks = llama_grammar_get_stacks(grammar);
for (auto it = code_points.begin(), end = code_points.end() - 1; it != end; ++it) {
const llama_grammar_stacks prev_stacks = llama_grammar_get_stacks(grammar); // copy
llama_grammar_accept(prev_rules, prev_stacks, *it, cur_stacks);
llama_grammar_accept(rules, prev_stacks, *it, cur_stacks);
if (cur_stacks.empty()) {
// no stacks means that the grammar failed to match at this point