Views
No views yet

| Eval | Zamba2-VL-1.2B | PerceptionLM-1B | InternVL3.5-1B | Qwen3-VL-2B |
|---|---|---|---|---|
| AI2D (test) | 81.5 | 85.7 | 81.2 | 86.2 |
| ChartQA (test) | 77.6 | 79.2 | 78.0 | 78.7 |
| DocVQA (test) | 87.4 | 90.7 | 85.6 | 93.3 |
| InfoVQA (test) | 60.7 | 63.0 | 60.5 | 72.4 |
| TextVQA (val) | 71.9 | 78.2 | 71.1 | 79.9 |
| OCRBench | 71.4 | 79.0 | 79.2 | 84.1 |
| VQA v2.0 (val) | 78.0 | 80.0 | 69.6 | 78.8 |
| MathVista (mini) | 48.7 | 51.9 | 52.9 | 51.8 |
| MMMU (val) | 32.4 | 35.0 | 40.1 | 40.9 |
| SEED (image) | 71.1 | 76.3 | 72.5 | 74.8 |
| BLINK (val) | 43.2 | 45.6 | 43.4 | 53.2 |
| RealWorldQA | 65.9 | 68.6 | 56.9 | 66.0 |
| CountBenchQA | 56.9 | 62.2 | 58.3 | 87.9 |
| PixMoCount (test) | 62.5 | 17.7 | 32.8 | 55.7 |
zamba2-vl branch from our fork of transformers library, which is based on the v4.57.1 of transformers:1pip install "transformers @ git+https://github.com/Zyphra/transformers.git@zamba2-vl"
2pip install qwen-vl-utils==0.0.2
3pip install flash_attntransformers v4.57.1 being installed in your environment. If you're installing in a fresh Python environment, you might want to specify a specific extra, like [dev-torch], to install all the dependencies:pip install "transformers[dev-torch] @ git+https://github.com/Zyphra/transformers.git@zamba2-vl"mamba-ssm from source (due to compatibility issues with PyTorch) as well as causal-conv1d:1pip install --no-build-isolation "causal-conv1d @ git+https://github.com/Zyphra/z-causal-conv1d.git@zamba2-vl"
2pip install --no-build-isolation "mamba-ssm @ git+https://github.com/Zyphra/mamba.git@zamba2-vl"1from transformers import Zamba2_VLForConditionalGeneration, Zamba2_VLProcessor
2import torch
3from PIL import Image
4from qwen_vl_utils import process_vision_info
5import requests
6
7device = "cuda"
8processor = Zamba2_VLProcessor.from_pretrained("Zyphra/Zamba2-VL-1.2B", temporal_patch_size=1)
9model = Zamba2_VLForConditionalGeneration.from_pretrained("Zyphra/Zamba2-VL-1.2B", device_map=device, torch_dtype=torch.bfloat16, attn_implementation="flash_attention_2")
10
11url = "http://images.cocodataset.org/val2017/000000039769.jpg"
12image = Image.open(requests.get(url, stream=True).raw)
13question = "What do you see in the image? Give us some detail."
14num_img_tokens = 3400
15
16conversation = [
17 {"role": "user", "content": [
18 {"type": "image", "image": image, "max_pixels" : num_img_tokens * 28 * 28, "min_pixels" : 10 * 28 * 28},
19 {"type": "text", "text": question},
20 ]
21 },
22]
23prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
24images, _ = process_vision_info(conversation)
25inputs = processor(text=prompt, images=images, add_special_tokens=True, return_tensors="pt")
26inputs = {key: value.to(device) for key, value in inputs.items()}
27
28outputs = model.generate(**inputs, max_new_tokens=100)
29print(processor.tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))