We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f30ea47 commit 4636283Copy full SHA for 4636283
common/sampling.cpp
@@ -17,6 +17,13 @@ struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_
17
return nullptr;
18
}
19
20
+ // Ensure that there is a "root" node.
21
+ if (result->parsed_grammar.symbol_ids.find("root") == result->parsed_grammar.symbol_ids.end()) {
22
+ fprintf(stderr, "%s: grammar does not contain a 'root' symbol\n", __func__);
23
+ delete result;
24
+ return nullptr;
25
+ }
26
+
27
std::vector<const llama_grammar_element *> grammar_rules(result->parsed_grammar.c_rules());
28
29
result->grammar = llama_grammar_init(
0 commit comments