Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5vl_ca
feature-extraction
conversational
custom_code
Instructions to use kyutai/CASA-Qwen2_5-VL-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kyutai/CASA-Qwen2_5-VL-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="kyutai/CASA-Qwen2_5-VL-3B", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("kyutai/CASA-Qwen2_5-VL-3B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kyutai/CASA-Qwen2_5-VL-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kyutai/CASA-Qwen2_5-VL-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kyutai/CASA-Qwen2_5-VL-3B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/kyutai/CASA-Qwen2_5-VL-3B
- SGLang
How to use kyutai/CASA-Qwen2_5-VL-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kyutai/CASA-Qwen2_5-VL-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kyutai/CASA-Qwen2_5-VL-3B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kyutai/CASA-Qwen2_5-VL-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kyutai/CASA-Qwen2_5-VL-3B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use kyutai/CASA-Qwen2_5-VL-3B with Docker Model Runner:
docker model run hf.co/kyutai/CASA-Qwen2_5-VL-3B
|
Download README.md from kyutai/CASA-Qwen2_5-VL-3B: direct link, hf CLI and curl.
- Browser
- Download file 3.07 kB
-
https://huggingface.co/kyutai/CASA-Qwen2_5-VL-3B/resolve/5f7de59b9176f39e65882ab7f22fbebdcd5dc0a6/README.md
- Command line
-
hf download hf://kyutai/CASA-Qwen2_5-VL-3B@5f7de59b9176f39e65882ab7f22fbebdcd5dc0a6/README.md
-
curl -L -o README.md https://huggingface.co/kyutai/CASA-Qwen2_5-VL-3B/resolve/5f7de59b9176f39e65882ab7f22fbebdcd5dc0a6/README.md
3.07 kB
| base_model: | |
| - Qwen/Qwen2.5-VL-3B-Instruct | |
| datasets: | |
| - HuggingFaceM4/FineVision | |
| - mvp-lab/LLaVA-OneVision-1.5-Instruct-Data | |
| language: | |
| - en | |
| license: cc-by-nc-sa-4.0 | |
| pipeline_tag: image-text-to-text | |
| library_name: transformers | |
| # CASA-Qwen2_5-VL-3B | |
| This repository contains the model weights for **CASA-Qwen2_5-VL-3B**, introduced in the paper [CASA: Cross-Attention over Self-Attention for Efficient Vision-Language Fusion](https://huggingface.co/papers/2512.19535). | |
| This model is a [Qwen-2.5VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct) model adapted from token insertion to a cross-attention-based architecture. | |
| - **Paper:** [CASA: Cross-Attention over Self-Attention for Efficient Vision-Language Fusion](https://arxiv.org/abs/2512.19535) | |
| - **Project Page:** [kyutai.org/casa](https://kyutai.org/casa) | |
| - **Code:** [github.com/kyutai-labs/casa](https://github.com/kyutai-labs/casa) | |
| ## Sample Usage | |
| This model requires `trust_remote_code=True` to load the custom architecture. Below is a snippet to run inference using `transformers`. | |
| ```python | |
| import torch | |
| from transformers.models.auto.modeling_auto import AutoModel | |
| from transformers.models.auto.processing_auto import AutoProcessor | |
| model_id = "kyutai/CASA-Qwen2_5-VL-3B" | |
| model = AutoModel.from_pretrained( | |
| model_id, | |
| torch_dtype=torch.bfloat16, | |
| attn_implementation="flash_attention_2", | |
| trust_remote_code=True, | |
| ).cuda() | |
| processor = AutoProcessor.from_pretrained( | |
| model_id, | |
| trust_remote_code=True, | |
| ) | |
| conversation = [ | |
| { | |
| "role": "user", | |
| "content": [ | |
| { | |
| "type": "image", | |
| "image": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/ai2d-demo.png", | |
| }, | |
| { | |
| "type": "text", | |
| "text": "Describe this image.", | |
| }, | |
| ], | |
| }, | |
| ] | |
| inputs = processor.tokenize_messages(messages=conversation) | |
| inputs = inputs.to(model.device) | |
| input_len = inputs["input_ids"].shape[1] | |
| output_ids = model.generate_from_image( | |
| **inputs, | |
| max_new_tokens=512, | |
| pre_image_tokens=processor.pre_image_tokens, | |
| post_image_tokens=processor.post_image_tokens, | |
| eos_token_id=model.generation_config.eos_token_id, | |
| )[0, input_len:] | |
| response = processor.tokenizer.decode(output_ids, skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ## Citation | |
| ```bibtex | |
| @article{kyutai2025casa, | |
| author = {Moritz B\"ohle and Am\'elie Royer and Juliette Marrie and Edouard Grave and Patrick P\'erez}, | |
| year = {2025}, | |
| title = {CASA: Cross-Attention over Self-Attention for Efficient Vision-Language Fusion}, | |
| journal = {ArXiv}, | |
| url = {https://arxiv.org/abs/2512.19535} | |
| } | |
| ``` | |
| ## License | |
| The code in the official repository is provided under the **MIT license**. The weights for this model are released under the **CC-BY-NC-SA 4.0 license**. Additionally, as this model includes weights from Qwen2.5-VL-3B, it is subject to the [Qwen RESEARCH LICENSE AGREEMENT](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct/blob/main/LICENSE). |