MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / llava_validate_embed_size

Function llava_validate_embed_size

examples/llava/llava.cpp:39–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39bool llava_validate_embed_size(const llama_context * ctx_llama, const clip_ctx * ctx_clip) {
40 // make sure that the correct mmproj was used, i.e., compare apples to apples
41 int n_llama_embd = llama_n_embd(llama_get_model(ctx_llama));
42 auto n_image_embd = clip_n_mmproj_embd(ctx_clip);
43 if (n_image_embd != n_llama_embd) {
44 printf("%s: embedding dim of the multimodal projector (%d) is not equal to that of LLaMA (%d). Make sure that you use the correct mmproj file.\n", __func__, n_image_embd, n_llama_embd);
45 return false;
46 }
47 return true;
48}
49
50static bool llava_image_embed_make_with_clip_img(clip_ctx * ctx_clip, int n_threads, const clip_image_u8 * img, float ** image_embd_out, int * n_img_pos_out) {
51 float * image_embd = (float *)malloc(clip_embd_nbytes(ctx_clip));

Callers

nothing calls this directly

Calls 4

printfFunction · 0.85
clip_n_mmproj_embdFunction · 0.70
llama_n_embdFunction · 0.50
llama_get_modelFunction · 0.50

Tested by

no test coverage detected