Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
31 changes: 28 additions & 3 deletions llama_cpp/llama_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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)
"""
...


Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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: ...

Expand Down
2 changes: 1 addition & 1 deletion vendor/llama.cpp
Submodule llama.cpp updated 622 files
Loading