From 3b24d48cf3422271aecc03bd21895713da91519a Mon Sep 17 00:00:00 2001 From: abetlen Date: Mon, 21 Sep 2026 12:43:59 -0700 Subject: [PATCH] feat: update llama.cpp to fb34fc262 --- CHANGELOG.md | 2 +- llama_cpp/llama_cpp.py | 31 ++++++++++++++++++++++++++++--- vendor/llama.cpp | 2 +- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e13a4b5c..be1130f95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- feat: update llama.cpp to ggml-org/llama.cpp@v0.4.0 +- feat: update llama.cpp to ggml-org/llama.cpp@fb34fc262 ## [0.3.35] diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index 4aa9c6ec4..c7af8b9a7 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -213,6 +213,7 @@ def _warn_deprecated(symbol: str, hint: str) -> None: # LLAMA_VOCAB_TYPE_UGM = 4, // T5 tokenizer based on Unigram # LLAMA_VOCAB_TYPE_RWKV = 5, // RWKV tokenizer based on greedy tokenization # LLAMA_VOCAB_TYPE_PLAMO2 = 6, // PLaMo-2 tokenizer based on Aho-Corasick with dynamic programming +# LLAMA_VOCAB_TYPE_TEST = 7, // Dummy tokenizer for testing: rolling hash of fixed-size chunks -> tokens, tokens -> hex # }; LLAMA_VOCAB_TYPE_NONE = 0 """For models without vocab""" @@ -228,6 +229,8 @@ def _warn_deprecated(symbol: str, hint: str) -> None: """RWKV tokenizer based on greedy tokenization""" LLAMA_VOCAB_TYPE_PLAMO2 = 6 """PLaMo-2 tokenizer based on Aho-Corasick with dynamic programming""" +LLAMA_VOCAB_TYPE_TEST = 7 +"""Dummy tokenizer for testing: rolling hash of fixed-size chunks -> tokens, tokens -> hex""" # NOTE: Deprecated and will be removed in the future. (already gone in llama.cpp) @@ -1476,6 +1479,8 @@ def llama_model_load_from_splits( # // Load a model from an open FILE pointer +# // The GGUF is read from the current position, so it can be embedded in a larger file +# // mmap needs the GGUF data section at a file offset to be aligned to the CPU tensor alignment (32 bytes) # LLAMA_API struct llama_model * llama_model_load_from_file_ptr( # FILE * file, # struct llama_model_params params); @@ -1487,7 +1492,11 @@ def llama_model_load_from_splits( def llama_model_load_from_file_ptr( file: ctypes.c_void_p, params: llama_model_params, / ) -> Optional[llama_model_p]: - """Load a model from an open FILE pointer.""" + """Load a model from an open FILE pointer + + The GGUF is read from the current position, so it can be embedded in a larger file + mmap needs the GGUF data section at a file offset to be aligned to the CPU tensor alignment (32 bytes) + """ ... @@ -2115,6 +2124,22 @@ def llama_adapter_lora_init( ) -> Optional[llama_adapter_lora_p]: ... +# // Load a LoRA adapter from an open FILE pointer, reading from its current position +# LLAMA_API struct llama_adapter_lora * llama_adapter_lora_init_from_file_ptr( +# struct llama_model * model, +# FILE * file); +@ctypes_function( + "llama_adapter_lora_init_from_file_ptr", + [llama_model_p_ctypes, ctypes.c_void_p], + llama_adapter_lora_p_ctypes, +) +def llama_adapter_lora_init_from_file_ptr( + model: llama_model_p, file: ctypes.c_void_p, / +) -> Optional[llama_adapter_lora_p]: + """Load a LoRA adapter from an open FILE pointer, reading from its current position""" + ... + + # // Get metadata value as a string by key name # LLAMA_API int32_t llama_adapter_meta_val_str(const struct llama_adapter_lora * adapter, const char * key, char * buf, size_t buf_size); @ctypes_function( @@ -4519,11 +4544,11 @@ def llama_sampler_chain_get( ) -> llama_sampler_p: ... -# LLAMA_API int llama_sampler_chain_n (const struct llama_sampler * chain); +# LLAMA_API int32_t llama_sampler_chain_n (const struct llama_sampler * chain); @ctypes_function( "llama_sampler_chain_n", [llama_sampler_p_ctypes], - ctypes.c_int, + ctypes.c_int32, ) def llama_sampler_chain_n(chain: llama_sampler_p, /) -> int: ... diff --git a/vendor/llama.cpp b/vendor/llama.cpp index 5266f24da..fb34fc262 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit 5266f24da75dc449bd56cbed7addb9c8e4a6a73e +Subproject commit fb34fc262c1b43f1832c7472429fb2247d650493