Skip to content

convert: Zamba2-VL template, images as llama.cpp's media markers - #17

Merged
bong-water-water-bong merged 1 commit into
1bit/vulkan-upstreamfrom
1bit/zamba2-vl-template
Sep 26, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/vulkan-upstreamfrom
1bit/zamba2-vl-template

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Follow-up to #16. The Zamba2-VL chat template embedded by the converter put the image inside the user turn; Zyphra's template puts it in front.

Cause: llama-server hands a message with media to the template as a string containing a marker, <__media_<id>__>, whose id is random per server. The template only recognised the literal <__media__>, so the marker stayed inside the user text.

Fix: the template finds markers by their <__media_ prefix and moves them in front of the user turn. Zyphra's own list form (image and text parts) renders as before.

Checked

  • With jinja2, the template renders Zyphra's exact prompt for three inputs: its list form, string content with <__media__>, and string content with a random marker.
  • In llama-server with Zamba2-VL-2.7B and --chat-template-file, the image now starts at prompt index 2 (<s>, <|vision_start|>), as in Zyphra's processor. It used to start at 4.
  • Answers are still correct: a red square, a blue circle, and the text read as "HElo 42".

GGUFs converted with #16 carry the old template. Reconvert them, or serve them with --chat-template-file.

🤖 Generated with Claude Code

llama-server passes a message with media to the template as a string holding
a marker, <__media_<id>__> with an id random per server, where each image
was. The template only knew the literal <__media__>, so the marker stayed in
the user text: the image landed inside the user turn instead of in front of
it, where Zyphra's template puts it. Find markers by their <__media_ prefix,
put them in front of the user turn, and keep Zyphra's list form as it was.

Checked: rendered with jinja2, the template gives Zyphra's prompt for its
list form and for string content with <__media__> or a random marker; in
llama-server (Zamba2-VL-2.7B, --chat-template-file) the image now starts at
prompt index 2 (<s>, <|vision_start|>), as in Zyphra's processor, where it
started at 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bong-water-water-bong
bong-water-water-bong merged commit 4a2c065 into 1bit/vulkan-upstream Sep 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant