Skip to content

Commit 7d78e75

Browse files
committed
feat: update llama.cpp to ggml-org/llama.cpp@f05cf4676
1 parent 65b50ca commit 7d78e75

3 files changed

Lines changed: 57 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
- feat(example): support server video inputs and Gemma text tool calls by @abetlen in #2291
11-
- feat: update llama.cpp to ggml-org/llama.cpp@3e7bd4f39
11+
- feat: update llama.cpp to ggml-org/llama.cpp@f05cf4676
1212
- fix(example): support multi-step Responses tool streaming by @abetlen in #2288
1313
- fix(ci): Repair Linux accelerator wheels for manylinux publishing
1414

llama_cpp/mtmd_cpp.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676
mtmd_input_chunks_p = NewType("mtmd_input_chunks_p", int)
7777
mtmd_input_chunks_p_ctypes = c_void_p
7878

79+
mtmd_batch_p = NewType("mtmd_batch_p", int)
80+
mtmd_batch_p_ctypes = c_void_p
81+
7982
# Enums
8083
MTMD_INPUT_CHUNK_TYPE_TEXT = 0
8184
MTMD_INPUT_CHUNK_TYPE_IMAGE = 1
@@ -102,6 +105,7 @@ class mtmd_context_params(Structure):
102105
image_max_tokens: int
103106
cb_eval: llama_cpp.ggml_backend_sched_eval_callback
104107
cb_eval_user_data: c_void_p
108+
batch_max_tokens: int
105109

106110
_fields_ = [
107111
("use_gpu", c_bool),
@@ -115,6 +119,7 @@ class mtmd_context_params(Structure):
115119
("image_max_tokens", c_int),
116120
("cb_eval", llama_cpp.ggml_backend_sched_eval_callback),
117121
("cb_eval_user_data", c_void_p),
122+
("batch_max_tokens", c_int),
118123
]
119124

120125

@@ -596,7 +601,7 @@ def mtmd_image_tokens_get_decoder_pos(
596601
c_int,
597602
)
598603
def mtmd_encode(ctx: mtmd_context_p, image_tokens: mtmd_image_tokens_p, /) -> int:
599-
"""Run an MTMD encode pass for image tokens."""
604+
"""Run a deprecated MTMD encode pass for image tokens."""
600605
...
601606

602607

@@ -618,6 +623,55 @@ def mtmd_get_output_embd(ctx: mtmd_context_p, /) -> Optional[CtypesArray[c_float
618623
...
619624

620625

626+
# MTMD_API mtmd_batch * mtmd_batch_init(mtmd_context * ctx);
627+
@ctypes_function("mtmd_batch_init", [mtmd_context_p_ctypes], mtmd_batch_p_ctypes)
628+
def mtmd_batch_init(ctx: mtmd_context_p, /) -> Optional[mtmd_batch_p]:
629+
"""Initialize an MTMD media chunk batch for a context."""
630+
...
631+
632+
633+
# MTMD_API void mtmd_batch_free(mtmd_batch * batch);
634+
@ctypes_function("mtmd_batch_free", [mtmd_batch_p_ctypes], None)
635+
def mtmd_batch_free(batch: mtmd_batch_p, /): ...
636+
637+
638+
# MTMD_API int32_t mtmd_batch_add_chunk(mtmd_batch * batch, const mtmd_input_chunk * chunk);
639+
@ctypes_function(
640+
"mtmd_batch_add_chunk",
641+
[mtmd_batch_p_ctypes, mtmd_input_chunk_p_ctypes],
642+
c_int,
643+
)
644+
def mtmd_batch_add_chunk(
645+
batch: mtmd_batch_p,
646+
chunk: mtmd_input_chunk_p,
647+
/,
648+
) -> int:
649+
"""Add a media chunk to an MTMD batch."""
650+
...
651+
652+
653+
# MTMD_API int32_t mtmd_batch_encode(mtmd_batch * batch);
654+
@ctypes_function("mtmd_batch_encode", [mtmd_batch_p_ctypes], c_int)
655+
def mtmd_batch_encode(batch: mtmd_batch_p, /) -> int:
656+
"""Run an MTMD encode pass for all chunks in a batch."""
657+
...
658+
659+
660+
# MTMD_API float * mtmd_batch_get_output_embd(mtmd_batch * batch, const mtmd_input_chunk * chunk);
661+
@ctypes_function(
662+
"mtmd_batch_get_output_embd",
663+
[mtmd_batch_p_ctypes, mtmd_input_chunk_p_ctypes],
664+
POINTER(c_float),
665+
)
666+
def mtmd_batch_get_output_embd(
667+
batch: mtmd_batch_p,
668+
chunk: mtmd_input_chunk_p,
669+
/,
670+
) -> Optional[CtypesArray[c_float]]:
671+
"""Get output embeddings for a chunk from the last batch encode pass."""
672+
...
673+
674+
621675
# MTMD_API struct mtmd_caps mtmd_get_cap_from_file(const char * mmproj_fname);
622676
@ctypes_function("mtmd_get_cap_from_file", [c_char_p], mtmd_caps)
623677
def mtmd_get_cap_from_file(mmproj_fname: bytes, /) -> mtmd_caps:

vendor/llama.cpp

Submodule llama.cpp updated 60 files

0 commit comments

Comments
 (0)