From 2305061e64c4ebaccaade8d31e46da234f984e0c Mon Sep 17 00:00:00 2001 From: abetlen Date: Fri, 15 May 2026 01:40:02 -0700 Subject: [PATCH 1/2] feat: update llama.cpp to 91e84fed6 --- CHANGELOG.md | 1 + llama_cpp/llama_cpp.py | 3 +++ llama_cpp/mtmd_cpp.py | 20 ++++++++++++++++++++ vendor/llama.cpp | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 900176ea1..a0b63061c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- feat: Update llama.cpp to ggerganov/llama.cpp@91e84fed6 and sync Python bindings - fix: Enable unified KV cache for embedding contexts to preserve full per-sequence context in batch embedding calls by @SanjanaB123 in #2217 ## [0.3.23] diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index a5ec5d190..a9c32a15b 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -2837,6 +2837,9 @@ def llama_state_seq_load_file( ) -> int: ... +# define LLAMA_STATE_SEQ_FLAGS_NONE 0 +LLAMA_STATE_SEQ_FLAGS_NONE = 0 + # for backwards-compat # define LLAMA_STATE_SEQ_FLAGS_SWA_ONLY 1 LLAMA_STATE_SEQ_FLAGS_SWA_ONLY = 1 diff --git a/llama_cpp/mtmd_cpp.py b/llama_cpp/mtmd_cpp.py index 485dc5d8c..4c5584223 100644 --- a/llama_cpp/mtmd_cpp.py +++ b/llama_cpp/mtmd_cpp.py @@ -134,6 +134,19 @@ class mtmd_decoder_pos(Structure): ] +class mtmd_caps(Structure): + """Capabilities exposed by an mmproj file.""" + + if TYPE_CHECKING: + inp_vision: bool + inp_audio: bool + + _fields_ = [ + ("inp_vision", c_bool), + ("inp_audio", c_bool), + ] + + ################################################ # mtmd.h functions ################################################ @@ -515,6 +528,13 @@ def mtmd_get_output_embd(ctx: mtmd_context_p, /) -> Optional[CtypesArray[c_float ... +# MTMD_API struct mtmd_caps mtmd_get_cap_from_file(const char * mmproj_fname); +@ctypes_function("mtmd_get_cap_from_file", [c_char_p], mtmd_caps) +def mtmd_get_cap_from_file(mmproj_fname: bytes, /) -> mtmd_caps: + """Get mmproj capabilities without initializing a full MTMD context.""" + ... + + # MTMD_API mtmd_input_chunks * mtmd_test_create_input_chunks(void); @ctypes_function("mtmd_test_create_input_chunks", [], mtmd_input_chunks_p_ctypes) def mtmd_test_create_input_chunks() -> Optional[mtmd_input_chunks_p]: diff --git a/vendor/llama.cpp b/vendor/llama.cpp index 7d442abf5..91e84fed6 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit 7d442abf5c6244117fd5a1dc51a5d19f00792491 +Subproject commit 91e84fed64329cd96202d68220724a1d92f5ec1f From c58751b83e60fa05360d65188fde476eeb58ce5f Mon Sep 17 00:00:00 2001 From: abetlen Date: Fri, 15 May 2026 01:44:18 -0700 Subject: [PATCH 2/2] chore: document mtmd_caps c declaration --- llama_cpp/mtmd_cpp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llama_cpp/mtmd_cpp.py b/llama_cpp/mtmd_cpp.py index 4c5584223..f2b0ed2de 100644 --- a/llama_cpp/mtmd_cpp.py +++ b/llama_cpp/mtmd_cpp.py @@ -134,6 +134,10 @@ class mtmd_decoder_pos(Structure): ] +# struct mtmd_caps { +# bool inp_vision; +# bool inp_audio; +# }; class mtmd_caps(Structure): """Capabilities exposed by an mmproj file."""