Skip to content

Commit 90f9b88

Browse files
authored
nit: more informative crash when grammar sampler fails (#11593)
1 parent 864a0b6 commit 90f9b88

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/llama-grammar.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,5 +1213,7 @@ void llama_grammar_accept_str(struct llama_grammar & grammar, const std::string
12131213
}
12141214

12151215
grammar.partial_utf8 = decoded.second;
1216-
GGML_ASSERT(!grammar.stacks.empty());
1216+
if (grammar.stacks.empty()) {
1217+
throw std::runtime_error("Unexpected empty grammar stack after accepting piece: " + piece);
1218+
}
12171219
}

0 commit comments

Comments
 (0)