Fixed segfault on invalid grammar.
This commit is contained in:
parent
05490fad7f
commit
8c9d953f2c
1 changed files with 8 additions and 0 deletions
|
@ -932,6 +932,14 @@ struct llama_server_context
|
|||
llama_sampling_free(slot->ctx_sampling);
|
||||
}
|
||||
slot->ctx_sampling = llama_sampling_init(slot->sparams);
|
||||
|
||||
// If we failed to parse grammar and we continue it's a SEGFAULT.
|
||||
if (slot->ctx_sampling == nullptr)
|
||||
{
|
||||
LOG_TEE("unable to continue without context (is your grammar valid or blank?)\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
llama_set_rng_seed(ctx, slot->params.seed);
|
||||
slot->command = LOAD_PROMPT;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue