Image-Text-to-Text
Transformers
Safetensors
qwen2_5_vl
multimodal
vision-language
spatial-reasoning
latent-reasoning
conversational
custom_code
text-generation-inference
Instructions to use array/Qwen2.5-VL-Mull with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use array/Qwen2.5-VL-Mull with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="array/Qwen2.5-VL-Mull", 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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("array/Qwen2.5-VL-Mull", trust_remote_code=True) model = AutoModelForImageTextToText.from_pretrained("array/Qwen2.5-VL-Mull", 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use array/Qwen2.5-VL-Mull with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "array/Qwen2.5-VL-Mull" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "array/Qwen2.5-VL-Mull", "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/array/Qwen2.5-VL-Mull
- SGLang
How to use array/Qwen2.5-VL-Mull 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 "array/Qwen2.5-VL-Mull" \ --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": "array/Qwen2.5-VL-Mull", "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 "array/Qwen2.5-VL-Mull" \ --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": "array/Qwen2.5-VL-Mull", "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 array/Qwen2.5-VL-Mull with Docker Model Runner:
docker model run hf.co/array/Qwen2.5-VL-Mull
| library_name: transformers | |
| license: apache-2.0 | |
| base_model: Qwen/Qwen2.5-VL-7B-Instruct | |
| tags: | |
| - multimodal | |
| - vision-language | |
| - spatial-reasoning | |
| - latent-reasoning | |
| pipeline_tag: image-text-to-text | |
| # Mull-Tokens: Modality-Agnostic Latent Thinking | |
| This is the model for the paper **"Mull-Tokens: Modality-Agnostic Latent Thinking"**. | |
| [[Paper]](https://arxiv.org/abs/2512.10941) | [[Project Page]](https://arijitray1993.github.io/mulltokens/) | [[Code]](https://github.com/arijitray1993/mull) | |
| ## Overview | |
| Mull-Tokens are latent tokens that can be pre-trained to hold intermediate information in either image or text modalities so as to think towards the correct answer. Across four challenging spatial reasoning benchmarks, Mull-Tokens achieve a **+3% average improvement** and up to **+16%** on reasoning-heavy splits compared to the strongest baseline. | |
| ## Available Models | |
| | Model | Description | | |
| |---|---| | |
| | [array/Qwen2.5-VL-Mull](https://huggingface.co/array/Qwen2.5-VL-Mull) | Mull-Tokens with multimodal warm-up | | |
| | [array/Qwen2.5-VL-MullGRPO](https://huggingface.co/array/Qwen2.5-VL-MullGRPO) | Mull-Tokens + GRPO reinforcement learning | | |
| ## Quick Start | |
| ```python | |
| from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor | |
| from qwen_vl_utils import process_vision_info | |
| import torch | |
| # Choose model: "array/Qwen2.5-VL-Mull" or "array/Qwen2.5-VL-MullGRPO" | |
| MODEL_ID = "array/Qwen2.5-VL-Mull" | |
| NUM_LATENTS = 20 | |
| # Load model and processor | |
| model = Qwen2_5_VLForConditionalGeneration.from_pretrained( | |
| MODEL_ID, | |
| torch_dtype=torch.bfloat16, | |
| attn_implementation="flash_attention_2", | |
| device_map="auto", | |
| ) | |
| processor = AutoProcessor.from_pretrained(MODEL_ID) | |
| # Prepare your question | |
| image_path = "path/to/your/image.jpg" | |
| question = "If you stand at the X marked point and turn left, will the table be to your left or right? Please choose between the following answer choices: A. left. B. right. " | |
| question_type = "multiple choice" | |
| QUESTION_TEMPLATE_LATENT = ( | |
| "{Question}\n" | |
| "Please think about this question deeply. " | |
| "It's encouraged to include self-reflection or verification in the reasoning process. " | |
| "Provide your final answer between the <answer> </answer> tags." | |
| ) | |
| TYPE_TEMPLATE = { | |
| "multiple choice": " Please provide only the single option letter (e.g., A, B, C, D, etc.) within the <answer> </answer> tags.", | |
| "numerical": " Please provide the numerical value (e.g., 42 or 3.14) within the <answer> </answer> tags.", | |
| "OCR": " Please transcribe text from the image/video clearly and provide your text answer within the <answer> </answer> tags.", | |
| "free-form": " Please provide your text answer within the <answer> </answer> tags.", | |
| "regression": " Please provide the numerical value (e.g., 42 or 3.14) within the <answer> </answer> tags.", | |
| } | |
| prompt = QUESTION_TEMPLATE_LATENT.format(Question=question) + TYPE_TEMPLATE[question_type] | |
| # Build messages with latent thinking tokens | |
| messages = [ | |
| { | |
| "role": "user", | |
| "content": [ | |
| {"type": "image", "image": image_path}, | |
| {"type": "text", "text": prompt}, | |
| ], | |
| }, | |
| # IMPORTANT: Mull-Tokens requires latent thinking tokens before answer generation | |
| { | |
| "role": "assistant", | |
| "content": [ | |
| { | |
| "type": "text", | |
| "text": "<think>" + "<|latent_pad|>" * NUM_LATENTS + "</think>\n", | |
| } | |
| ], | |
| }, | |
| ] | |
| # Process inputs | |
| text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=False) | |
| text = text.replace("<|im_end|>\n", "") # Remove end token so model continues generating | |
| image_inputs, video_inputs = process_vision_info(messages) | |
| inputs = processor( | |
| text=[text], | |
| images=image_inputs, | |
| videos=video_inputs, | |
| padding=True, | |
| return_tensors="pt", | |
| ).to(model.device) | |
| # Generate response | |
| with torch.no_grad(): | |
| output_ids = model.generate( | |
| **inputs, | |
| max_new_tokens=512, | |
| do_sample=False, | |
| ) | |
| # Decode output (skip input tokens) | |
| generated_ids = output_ids[:, inputs["input_ids"].shape[1]:] | |
| response = processor.batch_decode(generated_ids, skip_special_tokens=True)[0] | |
| print(response) | |
| ``` | |
| ## Citation | |
| ```bibtex | |
| @misc{ray2025mulltokensmodalityagnosticlatentthinking, | |
| title={Mull-Tokens: Modality-Agnostic Latent Thinking}, | |
| author={Arijit Ray and Ahmed Abdelkader and Chengzhi Mao and Bryan A. Plummer and Kate Saenko and Ranjay Krishna and Leonidas Guibas and Wen-Sheng Chu}, | |
| year={2025}, | |
| eprint={2512.10941}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.CV}, | |
| url={https://arxiv.org/abs/2512.10941}, | |
| } | |
| ``` | |