summaryrefslogtreecommitdiff
path: root/examples/llava
diff options
context:
space:
mode:
Diffstat (limited to 'examples/llava')
-rw-r--r--examples/llava/llava-cli.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/llava/llava-cli.cpp b/examples/llava/llava-cli.cpp
index 157a680b..da60ddf2 100644
--- a/examples/llava/llava-cli.cpp
+++ b/examples/llava/llava-cli.cpp
@@ -189,6 +189,11 @@ static void process_prompt(struct llava_context * ctx_llava, struct llava_image_
LOG_TEE("\n");
struct llama_sampling_context * ctx_sampling = llama_sampling_init(params->sparams);
+ if (!ctx_sampling) {
+ fprintf(stderr, "%s: failed to initialize sampling subsystem\n", __func__);
+ exit(1);
+ }
+
std::string response = "";
for (int i = 0; i < max_tgt_len; i++) {
const char * tmp = sample(ctx_sampling, ctx_llava->ctx_llama, &n_past);