Skip to content

Commit abd8ace

Browse files
committed
optimize code
Signed-off-by: tc-mb <[email protected]>
1 parent 215bb4e commit abd8ace

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tools/mtmd/clip.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,10 +879,8 @@ struct clip_graph {
879879
int n_embd = clip_n_mmproj_embd(ctx);
880880
const int d_head = 128;
881881
int n_head = n_embd/d_head;
882-
883882
// Use actual config value if available, otherwise fall back to hardcoded values
884883
int num_query = ctx->model.hparams.minicpmv_query_num;
885-
886884
ggml_tensor * Q = ggml_add(ctx0,
887885
ggml_mul_mat(ctx0, model.mm_model_attn_q_w, q),
888886
model.mm_model_attn_q_b);
@@ -3970,8 +3968,11 @@ bool clip_image_encode(struct clip_ctx * ctx, const int n_threads, clip_image_f3
39703968
imgs.entries.push_back(std::move(img_copy));
39713969

39723970
#if defined(ENABLE_COREML)
3973-
bool ios_ctx = true;
3974-
if (ios_ctx){
3971+
const bool can_use_coreml =
3972+
!ctx->coreml_model_path.empty() &&
3973+
ctx->model.modality == CLIP_MODALITY_VISION &&
3974+
ctx->proj_type() == PROJECTOR_TYPE_MINICPMV;
3975+
if (can_use_coreml){
39753976
printf("clip use coreml\n");
39763977
return clip_image_batch_encode_coreml(ctx, &imgs, vec);
39773978
}

tools/run/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if (LLAMA_CURL)
99
include_directories(${CURL_INCLUDE_DIRS})
1010
set(LLAMA_RUN_EXTRA_LIBS ${LLAMA_RUN_EXTRA_LIBS} ${CURL_LIBRARIES})
1111
endif ()
12+
1213
if(LLAMA_TOOLS_INSTALL)
1314
install(TARGETS ${TARGET} RUNTIME)
1415
endif()

0 commit comments

Comments
 (0)