completion : Fix segfault on model load failure (#21049)
This commit is contained in:
parent
d0fa2c9fbb
commit
a308e584ca
|
|
@ -146,13 +146,19 @@ int main(int argc, char ** argv) {
|
||||||
|
|
||||||
ctx = llama_init->context();
|
ctx = llama_init->context();
|
||||||
model = llama_init->model();
|
model = llama_init->model();
|
||||||
smpl = llama_init->sampler(0);
|
|
||||||
|
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
LOG_ERR("%s: error: unable to create context\n", __func__);
|
LOG_ERR("%s: error: unable to create context\n", __func__);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model == NULL) {
|
||||||
|
LOG_ERR("%s: error: unable to load model\n", __func__);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
smpl = llama_init->sampler(0);
|
||||||
|
|
||||||
llama_memory_t mem = llama_get_memory(ctx);
|
llama_memory_t mem = llama_get_memory(ctx);
|
||||||
const llama_vocab * vocab = llama_model_get_vocab(model);
|
const llama_vocab * vocab = llama_model_get_vocab(model);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue