Qwen2.5-VL-7B - a powerful new multimodal model
2 min readupdated
The development team has introduced Qwen2.5-VL-7B, an advanced vision-language model (a model capable of working with both text and images) with 7 billion parameters. The new release excels at object recognition, analyzing complex charts, tables, and interfaces, and acts as a visual agent (a program capable of independently operating interfaces and tools) supporting computer and phone use. The model features an improved architecture with dynamic resolution, long video support, and structured data generation, making it indispensable for automation and multimodal content analysis.
Key features
- Advanced visual analysis: object recognition and detailed breakdown of text, icons, diagrams, and layouts in images.
- Agent capabilities: reasoning and dynamic tool management for interacting with computers and smartphones.
- Long video processing: understanding video recordings over an hour long with precise identification of key moments and events.
- Precise localization: determining object coordinates in an image with stable JSON output.
What you can do
- Document processing: automatic data extraction from scanned invoices, tables, and forms for financial and commercial tasks.
- Agent creation: developing autonomous assistants for managing applications on PCs or mobile devices.
- Video material analysis: searching for specific events and clips in long video recordings using a text prompt.
- Chart interpretation: automatic breakdown of complex diagrams, infographics, and interface layouts.
Example
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"Qwen/Qwen2.5-VL-7B-Instruct", torch_dtype="auto", device_map="auto"
)
processor = AutoProcessor.from_pretrained(
"Qwen/Qwen2.5-VL-7B-Instruct"
)
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "[https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg](https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg)",
},
{"type": "text", "text": "Describe this image."},
],
}
]
text = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt"
)
inputs = inputs.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
Read more
DetailsBenchmarks: 95.7 on DocVQA, 82.6 on InfoVQA, 68.2 on MathVista
Requirements: transformers compatibility, flash_attention_2 recommended
Training features: dynamic resolution and temporal sampling frequency (dynamic FPS) in ViT










Comments