From 3b46e1deba667ad753209f6e23615b97a7c44776 Mon Sep 17 00:00:00 2001 From: caitianchi Date: Fri, 27 Sep 2024 16:21:21 +0800 Subject: [PATCH] fix bug in sp --- examples/llava/minicpmv-cli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/llava/minicpmv-cli.cpp b/examples/llava/minicpmv-cli.cpp index 2813037ee1d89..6cb7905d70d18 100644 --- a/examples/llava/minicpmv-cli.cpp +++ b/examples/llava/minicpmv-cli.cpp @@ -183,11 +183,11 @@ static void process_eval_image_embed_l(struct llava_context * ctx_llava, const s if (sp == 0) { std::memcpy(image_embed, buffer, token_len); - std::memcpy(image_embed + n_patches + 1, buffer+token_len, token_len); + std::memcpy(image_embed + (n_patches + 1) * token_len, buffer+token_len, token_len); } else if (sp == 1) { std::memcpy(image_embed, buffer+token_len*2, token_len); - std::memcpy(image_embed+ n_patches + 1, buffer+token_len*3, token_len); + std::memcpy(image_embed + (n_patches + 1) * token_len, buffer+token_len*3, token_len); } std::memcpy(image_embed+token_len, embeds->embed + idx * clip_n_patches(ctx_llava->ctx_clip) * clip_n_mmproj_embd(ctx_llava->ctx_clip), clip_embd_nbytes(ctx_llava->ctx_clip));