@@ -3057,7 +3057,7 @@ def eval_image(self, llama: llama.Llama, image_url: str):
30573057 n_past = ctypes .c_int (llama .n_tokens )
30583058 n_past_p = ctypes .pointer (n_past )
30593059 with suppress_stdout_stderr (disable = self .verbose ):
3060- self ._llava_cpp . llava_eval_image_embed (
3060+ self ._mtmd_cpp . mtmd_cpp_eval_image_embed (
30613061 llama .ctx ,
30623062 embed ,
30633063 llama .n_batch ,
@@ -3639,30 +3639,30 @@ def eval_image(self, llama: llama.Llama, image_url: str):
36393639 )
36403640
36413641 img_bytes = self .load_image (image_url )
3642- img_u8_p = self ._llava_cpp .clip_image_u8_init ()
3643- if not self ._llava_cpp .clip_image_load_from_bytes (
3642+ img_u8_p = self ._mtmd_cpp .clip_image_u8_init ()
3643+ if not self ._mtmd_cpp .clip_image_load_from_bytes (
36443644 ctypes .create_string_buffer (img_bytes , len (img_bytes )),
36453645 ctypes .c_size_t (len (img_bytes )),
36463646 img_u8_p ,
36473647 ):
3648- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3648+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36493649 raise ValueError ("Failed to load image." )
36503650
3651- img_f32_p = self ._llava_cpp .clip_image_f32_batch_init ()
3652- if not self ._llava_cpp .clip_image_preprocess (self .clip_ctx , img_u8_p , img_f32_p ):
3653- self ._llava_cpp .clip_image_f32_batch_free (img_f32_p )
3654- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3651+ img_f32_p = self ._mtmd_cpp .clip_image_f32_batch_init ()
3652+ if not self ._mtmd_cpp .clip_image_preprocess (self .clip_ctx , img_u8_p , img_f32_p ):
3653+ self ._mtmd_cpp .clip_image_f32_batch_free (img_f32_p )
3654+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36553655 raise ValueError ("Failed to preprocess image." )
36563656
36573657 n_embd = llama_cpp .llama_model_n_embd (llama ._model .model )
36583658 embed = (ctypes .c_float * (n_tokens * n_embd ))()
3659- if not self ._llava_cpp .clip_image_batch_encode (self .clip_ctx , llama .n_threads , img_f32_p , embed ):
3660- self ._llava_cpp .clip_image_f32_batch_free (img_f32_p )
3661- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3659+ if not self ._mtmd_cpp .clip_image_batch_encode (self .clip_ctx , llama .n_threads , img_f32_p , embed ):
3660+ self ._mtmd_cpp .clip_image_f32_batch_free (img_f32_p )
3661+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36623662 raise ValueError ("Failed to encode image." )
36633663
3664- self ._llava_cpp .clip_image_f32_batch_free (img_f32_p )
3665- self ._llava_cpp .clip_image_u8_free (img_u8_p )
3664+ self ._mtmd_cpp .clip_image_f32_batch_free (img_f32_p )
3665+ self ._mtmd_cpp .clip_image_u8_free (img_u8_p )
36663666 llama_cpp .llama_set_causal_attn (llama .ctx , False )
36673667
36683668 seq_id_0 = (ctypes .c_int32 * 1 )()
0 commit comments