Skip to content

convert: Zyphra Zamba2-VL (text model and mmproj) - #16

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

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

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Converts Zyphra's Zamba2-VL: a text GGUF and an mmproj. It runs through mtmd with no C++ changes.

Zamba2-VL is a Zamba2 language model under language_model., with tensor names identical to Zamba2ForCausalLM's, plus Qwen2.5-VL's vision tower and merger under vision_tower..

Text GGUF

  • The Zamba2 converter on language_model.*, routed by the top-level architecture.
  • The vocab is padded to vocab_size: tokenizer.json has 32,005 tokens and the embedding has 32,064 rows.
  • The GGUF gets a chat template that also takes string content with media markers, which is what llama.cpp passes. It renders exactly the same prompt as Zyphra's template, with images before the user turn. Checked with jinja2 for both forms.

mmproj

  • The Qwen2.5-VL vision converter on vision_tower.*.
  • temporal_patch_size is 1, so the second patch conv (which clip's Qwen2-VL graph adds for a still image) is written as zeros. No runtime change.

Why no C++ changes: mtmd takes positions from the text model's rope type, so Zamba2 gets plain sequential positions. It wraps images in <|vision_start|>/<|vision_end|>, which Zamba2-VL's vocab already has.

Checked on Strix Halo with Zamba2-VL-2.7B (text Q8_0, mmproj F16), llama-server --jinja --mmproj, and a 448×336 test image (red square, blue circle, the text "HELLO 42"):

  • Vision embeddings against transformers' Qwen2_5_VisionTransformerPretrainedModel in FP32, with Zamba2-VL's vision weights and Qwen2VLImageProcessor from its preprocessor config, 192 tokens × 2560:
    • CPU: mean per-token cosine 0.99989 (min 0.9979), relative L2 1.3%
    • Vulkan: mean 0.99944 (min 0.9903), relative L2 3.2%
  • Answers: "A red square and a blue circle with the text "HElo 42" underneath." The shape and colour question is answered correctly. The text is misread the same way on CPU and Vulkan, so the misread is the model's.
  • Decode about 40 tok/s on Vulkan0.

🤖 Generated with Claude Code

Zamba2_VLForConditionalGeneration is a Zamba2 language model under
language_model. (named as in Zamba2ForCausalLM) and Qwen2.5-VL's vision tower
and merger under vision_tower.

- text: the Zamba2 converter on language_model.*, routed by the top-level
  architecture; the vocab is padded to vocab_size (tokenizer.json has 32005
  tokens, the embedding 32064 rows); the GGUF gets a chat template that takes
  string content with media markers as well as Zyphra's list form, and renders
  the same prompt (images before the user turn)
- mmproj: the Qwen2.5-VL vision converter on vision_tower.*; the patch
  embedding has temporal_patch_size 1, so the second patch conv (which clip's
  Qwen2-VL graph adds for a still image) is written as zeros

mtmd takes positions from the text model's rope type, so Zamba2 gets plain
sequential positions, and wraps images in <|vision_start|> <|vision_end|>, which
Zamba2-VL's vocab has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bong-water-water-bong
bong-water-water-bong merged commit 2c9d398 into 1bit/vulkan-upstream Sep 26, 2026
6 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/zamba2-vl branch October 12, 2026 01:31
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