Skip to content

Commit 5d60059

Browse files
author
Olivier Chafik
committed
grammars: early exit from ggml-org#7370
1 parent 31cc6df commit 5d60059

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llama.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13191,6 +13191,10 @@ static std::vector<llama_grammar_candidate> llama_grammar_reject_candidates_for_
1319113191
}
1319213192
}
1319313193

13194+
if (next_candidates.empty()) {
13195+
return rejects;
13196+
}
13197+
1319413198
const auto * stack_pos_after = llama_grammar_match_char(stack_pos, 0).second;
1319513199

1319613200
// update top of stack to next element, if any

0 commit comments

Comments
 (0)