| 37 | } |
| 38 | |
| 39 | bool 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 | |
| 50 | static 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)); |
nothing calls this directly
no test coverage detected