grammars: early exit when no next_candidates to reject
This commit is contained in:
parent
0120f7cc95
commit
09c256594d
1 changed files with 4 additions and 0 deletions
|
@ -12970,6 +12970,10 @@ static std::vector<llama_grammar_candidate> llama_grammar_reject_candidates_for_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (next_candidates.empty()) {
|
||||||
|
return rejects;
|
||||||
|
}
|
||||||
|
|
||||||
const auto * stack_pos_after = llama_grammar_match_char(stack_pos, 0).second;
|
const auto * stack_pos_after = llama_grammar_match_char(stack_pos, 0).second;
|
||||||
|
|
||||||
// update top of stack to next element, if any
|
// update top of stack to next element, if any
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue