@@ -3063,7 +3063,7 @@ def eval_image(self, llama: llama.Llama, image_url: str):
30633063 n_past = ctypes .c_int (llama .n_tokens )
30643064 n_past_p = ctypes .pointer (n_past )
30653065 with suppress_stdout_stderr (disable = self .verbose ):
3066- self ._llava_cpp . llava_eval_image_embed (
3066+ self ._mtmd_cpp . mtmd_cpp_eval_image_embed (
30673067 llama .ctx ,
30683068 embed ,
30693069 llama .n_batch ,
@@ -3648,30 +3648,30 @@ def eval_image(self, llama: llama.Llama, image_url: str):
36483648 )
36493649
36503650 img_bytes = self .load_image (image_url )
3651- img_u8_p = self ._llava_cpp .clip_image_u8_init ()
3652- if not self ._llava_cpp .clip_image_load_from_bytes (
3651+ img_u8_p = self ._mtmd_cpp .clip_image_u8_init ()
3652+ if not self ._mtmd_cpp .clip_image_load_from_bytes (
36533653 ctypes .create_string_buffer (img_bytes , len (img_bytes )),
36543654 ctypes .c_size_t (len (img_bytes )),
36553655 img_u8_p ,
36563656 ):
3657- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3657+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36583658 raise ValueError ("Failed to load image." )
36593659
3660- img_f32_p = self ._llava_cpp .clip_image_f32_batch_init ()
3661- if not self ._llava_cpp .clip_image_preprocess (self .clip_ctx , img_u8_p , img_f32_p ):
3662- self ._llava_cpp .clip_image_f32_batch_free (img_f32_p )
3663- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3660+ img_f32_p = self ._mtmd_cpp .clip_image_f32_batch_init ()
3661+ if not self ._mtmd_cpp .clip_image_preprocess (self .clip_ctx , img_u8_p , img_f32_p ):
3662+ self ._mtmd_cpp .clip_image_f32_batch_free (img_f32_p )
3663+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36643664 raise ValueError ("Failed to preprocess image." )
36653665
36663666 n_embd = llama_cpp .llama_model_n_embd (llama ._model .model )
36673667 embed = (ctypes .c_float * (n_tokens * n_embd ))()
3668- if not self ._llava_cpp .clip_image_batch_encode (self .clip_ctx , llama .n_threads , img_f32_p , embed ):
3669- self ._llava_cpp .clip_image_f32_batch_free (img_f32_p )
3670- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3668+ if not self ._mtmd_cpp .clip_image_batch_encode (self .clip_ctx , llama .n_threads , img_f32_p , embed ):
3669+ self ._mtmd_cpp .clip_image_f32_batch_free (img_f32_p )
3670+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36713671 raise ValueError ("Failed to encode image." )
36723672
3673- self ._llava_cpp .clip_image_f32_batch_free (img_f32_p )
3674- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3673+ self ._mtmd_cpp .clip_image_f32_batch_free (img_f32_p )
3674+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36753675 llama_cpp .llama_set_causal_attn (llama .ctx , False )
36763676
36773677 seq_id_0 = (ctypes .c_int32 * 1 )()
0 commit comments