From a99fd214dd0b7b97f2cd5d22ae4c7c91236aec6c Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Tue, 15 Jul 2025 07:35:40 -0400 Subject: [PATCH 1/3] feat: Update llama.cpp --- llama_cpp/llama_cpp.py | 1 + vendor/llama.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/llama_cpp/llama_cpp.py b/llama_cpp/llama_cpp.py index d13d60458..bd8e36b79 100644 --- a/llama_cpp/llama_cpp.py +++ b/llama_cpp/llama_cpp.py @@ -200,6 +200,7 @@ """RWKV tokenizer based on greedy tokenization""" +# NOTE: Deprecated and will be removed in the future. (already gone in llama.cpp) # // pre-tokenization types # enum llama_vocab_pre_type { # LLAMA_VOCAB_PRE_TYPE_DEFAULT = 0, diff --git a/vendor/llama.cpp b/vendor/llama.cpp index a0374a67e..bdca38376 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit a0374a67e2924f2e845cdc59dd67d9a44065a89c +Subproject commit bdca38376f7e8dd928defe01ce6a16218a64b040 From c8579d767aa53c48221f409c49df03e4019ed771 Mon Sep 17 00:00:00 2001 From: Alcoft <101468238+alcoftTAO@users.noreply.github.com> Date: Tue, 15 Jul 2025 11:37:45 +0000 Subject: [PATCH 2/3] fix: Better chat format for Qwen2.5-VL (#2040) --- llama_cpp/llama_chat_format.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/llama_cpp/llama_chat_format.py b/llama_cpp/llama_chat_format.py index a288db7b0..2a7d575ce 100644 --- a/llama_cpp/llama_chat_format.py +++ b/llama_cpp/llama_chat_format.py @@ -3459,26 +3459,29 @@ class Qwen25VLChatHandler(Llava15ChatHandler): DEFAULT_SYSTEM_MESSAGE = "You are a helpful assistant." CHAT_FORMAT = ( - "<|im_start|>system\n" - "You are a helpful assistant.<|im_end|>\n" + #"{% set image_count = namespace(value=0) %}" + #"{% set video_count = namespace(value=0) %}" "{% for message in messages %}" - "{% if message['role'] == 'user' %}" - "<|im_start|>user\n" + "{% if loop.first and message['role'] != 'system' %}" + "<|im_start|>system\n" + "{{ self.DEFAULT_SYSTEM_MESSAGE }}<|im_end|>\n" + "{% endif %}" + "<|im_start|>{{ message['role'] }}\n" "{% if message['content'] is string %}" - "{{ message['content'] }}" + "{{ message['content'] }}<|im_end|>\n" "{% else %}" "{% for content in message['content'] %}" - "{% if content['type'] == 'text' %}" - "{{ content['text'] }}" - "{% elif content['type'] == 'image_url' %}" + "{% if content['type'] == 'image_url' %}" "{% if content.image_url is string %}" "{{ content.image_url }}" "{% else %}" "{{ content.image_url.url }}" "{% endif %}" + #"{% set image_count.value = image_count.value + 1 %}" + "{% elif content['type'] == 'text' %}" + "{{ content['text'] }}" "{% endif %}" "{% endfor %}" - "{% endif %}" "<|im_end|>\n" "{% endif %}" "{% endfor %}" From d9749cb9678d3ceb93b9ee63f4d723e3f01eb5c6 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Tue, 15 Jul 2025 07:39:46 -0400 Subject: [PATCH 3/3] chore: Bump version --- CHANGELOG.md | 5 +++++ llama_cpp/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6017812bb..88b9a1b45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.13] + +- feat: Update llama.cpp to ggerganov/llama.cpp@ +- fix: Better chat format for Qwen2.5-VL by @alcoftTAO in #2040 + ## [0.3.12] - feat: Update llama.cpp to ggerganov/llama.cpp@a0374a67e2924f2e845cdc59dd67d9a44065a89c diff --git a/llama_cpp/__init__.py b/llama_cpp/__init__.py index b16bb7dc9..0c869dcae 100644 --- a/llama_cpp/__init__.py +++ b/llama_cpp/__init__.py @@ -1,4 +1,4 @@ from .llama_cpp import * from .llama import * -__version__ = "0.3.12" +__version__ = "0.3.13"