当前位置: 首页 > news >正文

深入解析:【2B篇】阿里通义 Qwen3-VL 新增 2B、32B 两个模型尺寸,手机也能轻松运行

深入解析:【2B篇】阿里通义 Qwen3-VL 新增 2B、32B 两个模型尺寸,手机也能轻松运行

认识Qwen3-VL——通义千问系列迄今为止最强大的视觉语言模型。

这一代实现了全方位升级:更卓越的文本理解与生成、更深度的视觉感知与推理、更长的上下文处理能力、增强的空间与视频动态理解,以及更强大的智能体交互功能。

提供从边缘设备到云端均可扩展的Dense和MoE架构,并配备指令微调版与推理增强的Thinking版本,支持灵活按需部署。

核心升级:
  • 视觉智能体:可操作PC/移动端图形界面——识别元素、理解功能、调用工具、完成任务。

  • 视觉编程增强:根据图像/视频生成Draw.io图表/HTML/CSS/JS代码。

  • 高级空间感知:判断物体位置、视角与遮挡关系,提供更强的2D空间定位能力,并支持3D空间推理与具身智能。

  • 长上下文与视频理解:原生支持256K上下文窗口,可扩展至1M;完整记忆并二级索引处理书籍和数小时长视频内容。

  • 增强多模态推理:擅长STEM/数学领域——因果分析与基于证据的逻辑应答。

  • 升级版视觉识别:经过更广域、更高质量的预训练,实现"万物识别"——名人、动漫、商品、地标、动植物等。

  • 扩展OCR能力:支持32种语言(原19种);在弱光、模糊、倾斜场景下表现稳健;对生僻字/古籍术语识别更优;提升长文档结构解析能力。

  • 媲美纯文本大模型的理解力:文本-视觉无缝融合,实现无损统一理解。

模型架构更新:

在这里插入图片描述

  1. 交错式多维鲁棒位置嵌入(Interleaved-MRoPE):通过鲁棒的位置编码在时间、宽度和高度维度实现全频段分配,从而增强长时视频推理能力。

  2. 深度堆叠(DeepStack):融合多层级视觉Transformer特征,捕捉细粒度细节并锐化图像-文本对齐。

  3. 文本-时间戳对齐:突破T-RoPE限制,实现基于精确时间戳的事件定位,强化视频时序建模能力。

模型性能

Qwen3-VL-2B-Instruct

多模态性能

纯文本表现

Qwen3-VL-2B-Thinking

多模态性能


纯文本性能

快速入门

以下提供简单示例,展示如何使用Qwen3-VL模型配合魔搭社区和Transformers库。

Qwen3-VL的代码已集成至最新版Hugging Face transformers库,建议您通过以下命令从源码安装:

pip install git+https://github.com/huggingface/transformers
# pip install transformers==4.57.0 # currently, V4.57.0 is not released

使用 Transformers 进行聊天

以下代码片段展示了如何使用 transformers 与聊天模型交互:

Qwen3-VL-2B-Instruct

from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
# default: Load the model on the available device(s)
model = Qwen3VLForConditionalGeneration.from_pretrained(
"Qwen/Qwen3-VL-2B-Instruct", dtype="auto", device_map="auto"
)
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
# model = Qwen3VLForConditionalGeneration.from_pretrained(
#     "Qwen/Qwen3-VL-2B-Instruct",
#     dtype=torch.bfloat16,
#     attn_implementation="flash_attention_2",
#     device_map="auto",
# )
processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-2B-Instruct")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "Describe this image."},
],
}
]
# Preparation for inference
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt"
)
inputs = inputs.to(model.device)
# Inference: Generation of the output
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)

Qwen3-VL-2B-Thinking

from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
# default: Load the model on the available device(s)
model = Qwen3VLForConditionalGeneration.from_pretrained(
"Qwen/Qwen3-VL-2B-Thinking", dtype="auto", device_map="auto"
)
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
# model = Qwen3VLForConditionalGeneration.from_pretrained(
#     "Qwen/Qwen3-VL-2B-Thinking",
#     dtype=torch.bfloat16,
#     attn_implementation="flash_attention_2",
#     device_map="auto",
# )
processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-2B-Thinking")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "Describe this image."},
],
}
]
# Preparation for inference
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt"
)
inputs = inputs.to(model.device)
# Inference: Generation of the output
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)

生成超参数

VL
export greedy='false'
export top_p=0.8
export top_k=20
export temperature=0.7
export repetition_penalty=1.0
export presence_penalty=1.5
export out_seq_length=16384
Text
export greedy='false'
export top_p=1.0
export top_k=40
export repetition_penalty=1.0
export presence_penalty=2.0
export temperature=1.0
export out_seq_length=32768
http://www.jsqmd.com/news/45493/

相关文章:

  • 2025北京托福机构TOP5榜单!无老师/新通领衔,提分率90%+机构全解析
  • Why did Sanminism fail?
  • 网络安全产品深度对比:Detectify与Halo Security的技术架构剖析
  • pyppeteer: 连接到已打开的chrome
  • 深入解析:【开题答辩过程】以《重庆市社区养老服务小程序设计与实现》为例,不会开题答辩的可以进来看看
  • 2025年玻璃棉夹芯板直销厂家权威推荐榜单:聚氨酯夹芯板/两面企口夹芯板/金属幕墙夹芯板系统源头厂家精选
  • 使用信号量实现父子父子进程交替运行的学习笔记
  • 基于MATLAB实现图像缺陷检测、清晰度评估及自动对焦功能
  • 托福提分认准这些!2025五大靠谱机构推荐,从基础到冲刺全覆盖
  • 海南州一对一辅导机构靠谱推荐:2026最新教育机构榜! 持证师资精准发力
  • 2025 最新切割工程队推荐!混凝土 / 桥梁 / 支撑梁 / 无损切割等全场景工程队口碑排行榜,专业服务权威推荐
  • 2025年淮南一对一家教机构推荐:五大辅导机构测评排行榜,综合实力全解析!
  • 2025 最新基质生产线厂家权威推荐榜:泥炭育苗栽培专用设备,全球测评优质厂家全解析花卉/营养土/椰糠/白泥炭/黑泥炭/齿轮筛基质生产线公司推荐
  • 2025 最新解压机厂家权威推荐榜:椰糠 / 泥炭 / 基质解压机源头厂家测评优选,聚焦专业服务与市场口碑
  • 从源码编译安装gdal3.6.2库
  • 2025 最新包装盒厂家推荐排行榜:一站式定制解决方案权威测评,涵盖食品、美妆、礼品等多领域优质品牌彩盒印刷/茶叶礼盒/烘焙包装盒订制公司推荐
  • 朝阳市一对一辅导机构推荐,2026年课外家教补习机构权威排行榜
  • 完整教程:ctf.show--web入门--爆破
  • 2025 最新工程造价公司咨询推荐榜:国际权威测评认证的全行业靠谱服务商优选指南上海/工程造价审核/工程造价全过程跟踪审计/工程预算造价/厂房工程造价审核/工程结算造价审核公司推荐
  • element-plus表格相同行合并工具
  • 蚌埠一对一辅导机构权威推荐:2025家教机构排行榜,穿透式测评!
  • html-webpack-plugin与PWA:生成Service Worker兼容HTML - 详解
  • 锦州一对一家教机构推荐:2025年辅导机构权威排行榜,5家机构避坑指南
  • 黄南州一对一补习机构良心推荐:2026最新家教机构榜单!费用透明不花冤枉钱
  • 海东一对一家教机构推荐:2026小初高全学科补习机构靠谱辅导推荐,家长避坑指南!
  • 上海一对一辅导机构怎么选?2025最新权威排行榜揭晓,避坑指南 + 优选名单!
  • 海北一对一家教机构精选推荐:2026 师资 效果双优辅导机构榜单!
  • 长沙一对一课外辅导机构权威推荐榜单:2025年精准避坑,提分有方向
  • 2025年目前做得好的牙齿修复找哪家,牙周治疗/老人牙齿修复/进口牙齿种植/老年人牙齿种植/口腔牙齿种植牙齿修复排行榜推荐排行榜
  • 海西州一对一家教机构推荐,2026年教育机构最新盘点口碑实测榜!