多模态开源视觉视频理解 多模态模型

Qwen2.5-VL(开源视觉模型) 2.5

Qwen2.5系列 · 阿里巴巴通义千问 · 2025-01发布

开源支持本地部署多模态国内可直连有免费额度

模型介绍

通义千问开源视觉语言模型,支持图像理解、视频理解与视觉定位,72B 版本能力对标闭源多模态旗舰,Apache-2.0 可商用。

模型基础信息

模型系列Qwen2.5系列
开发机构阿里巴巴通义千问
发布时间2025-01
参数规模3B / 7B / 72B
上下文窗口128K
模型类型多模态(视觉 + 文本)
中文能力优秀
使用方式网页体验 / API调用 / 本地部署

免费额度与收费政策

开源免费 云端按量付费

免费规则详情

权重开源免费商用;阿里云百炼托管按量计费,无固定免费额度。

收费标准简介

阿里云百炼(DashScope)按 token 计费;本地部署零成本。

模型能力介绍

✅ 核心优势

  • 支持图像 / 视频 / 图文混合多模态理解
  • 在 OCR
  • 文档分析
  • 图表解读上表现突出
  • 与 Qwen 系列文本能力同源,中文优�
  • 提供 3B / 7B / 72B 多个尺寸

⚠️ 短板与局限

  • 端侧小尺寸视觉能力有限
  • 视频理解需一定显存
  • 对流式视频的支持仍在完善

🎯 适用场景

  • 图片内容理解与安全审核
  • 文档 OCR 与版面分析
  • 视频内容总结与检索
  • 多模态对话应用

模型使用教程

本章节整理 Qwen2.5-VL(开源视觉模型) 的在线体验、API调用、本地部署全套入门教程,快速上手使用该模型。

  • 72B:最强视觉理解,适合复杂图像/视频分析,需多卡部署。
  • 7B:均衡,单卡 16GB 可运行,支持图片问答、OCR、视觉定位。
  • 3B:轻量,适合端侧。
  • 能力:图像/视频理解、文档 OCR、图表解读、目标定位(bbox)。

体验:可访问 Qwen Chat 上传图片测试。

HF_ENDPOINT=https://hf-mirror.com huggingface-cli download Qwen/Qwen2.5-VL-7B-Instruct --local-dir ./qwen2.5-vl-7b

云端 API:阿里云百炼提供 qwen-vl-plus / qwen-vl-max

from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer
from transformers import Qwen2VLProcessor
import torch

model = Qwen2VLForConditionalGeneration.from_pretrained("./qwen2.5-vl-7b", device_map="auto")
processor = Qwen2VLProcessor.from_pretrained("./qwen2.5-vl-7b")

from PIL import Image
img = Image.open("cat.jpg")
prompt = "<image>\n这张图片里有什么?"
inputs = processor(text=prompt, images=img, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=128)
print(processor.decode(out[0], skip_special_tokens=True))

Ollama 一条命令:

ollama pull qwen2.5vl
ollama run qwen2.5vl

Transformers 推理:

from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from PIL import Image

model = Qwen2_5_VLForConditionalGeneration.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct", device_map="auto")
processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct")
img = Image.open("demo.png").convert("RGB")
msgs = [{"role": "user", "content": [
    {"type": "image"},
    {"type": "text", "text": "这张图里有什么?"},
]}]
text = processor.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[img], return_tensors="pt")
out = model.generate(**processor.to_hf_device_map(inputs), max_new_tokens=128)
print(processor.batch_decode(out[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0])

💡 使用小技巧

本地部署推荐 7B 版本:ollama pull qwen2.5vl

文档密集场景优先用 72B 或云 API 版本。

❓ 常见问题 FAQ

Q1:Qwen2.5-VL 能读视频吗?

A1:能,支持多帧视频理解与事件定位。

Q2:和 Qwen 文本版什么关系?

A2:在 Qwen2.5 基础上加入视觉编码器,共享文本能力。

访问备注与注意事项