当前位置: 首页 > 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.zskr.cn/news/55118.html

相关文章:

  • 2025北京托福机构TOP5榜单!无老师/新通领衔,提分率90%+机构全解析
  • 网络安全产品深度对比:Detectify与Halo Security的技术架构剖析
  • 托福提分认准这些!2025五大靠谱机构推荐,从基础到冲刺全覆盖
  • 2025年淮南一对一家教机构推荐:五大辅导机构测评排行榜,综合实力全解析!
  • 从源码编译安装gdal3.6.2库
  • 2025 最新工程造价公司咨询推荐榜:国际权威测评认证的全行业靠谱服务商优选指南上海/工程造价审核/工程造价全过程跟踪审计/工程预算造价/厂房工程造价审核/工程结算造价审核公司推荐
  • 完整教程:ctf.show--web入门--爆破
  • element-plus表格相同行合并工具
  • 2026阜新一对一补习机构排行榜:海州、细河等各区县机构测评
  • 海东一对一家教机构推荐:2026小初高全学科补习机构靠谱辅导推荐,家长避坑指南!
  • 海北一对一家教机构精选推荐:2026 师资 效果双优辅导机构榜单!
  • 长沙一对一课外辅导机构权威推荐榜单:2025年精准避坑,提分有方向
  • 2025年目前做得好的牙齿修复找哪家,牙周治疗/老人牙齿修复/进口牙齿种植/老年人牙齿种植/口腔牙齿种植牙齿修复排行榜推荐排行榜
  • 海东一对一家教机构实力推荐,2026 最新课外辅导排名:口碑认证不踩雷
  • 2025年11月国内候车亭/公交站牌厂家哪家强?江苏兰太给你答案
  • 2025年家庭成品泳池厂家权威推荐榜单:亚克力成品泳池/温泉成品泳池/成品户外泳池源头厂家精选
  • 2025年方形无缝钢管优质厂家权威推荐榜单:小口径无缝方管/直角方管/无缝方矩管源头厂家精选
  • 2025 年 11 月热电偶厂家推荐排行榜,热电偶感温线,针式热电偶,扣式热电偶,精准测温与耐用性能深度解析
  • k8s开启双栈后svc ipv6访问不通
  • 15. CoreDNS
  • 在Ubuntu下,通过Docker安装 Pgsql 18
  • 2025年度合肥电销外呼行业商家推荐榜单
  • 基于全变差的压缩感知视频图像重构算法
  • 2025年国内烘干设备实力厂家口碑推荐排行榜:四川蜀冷冷暖设备领跑
  • 2025年评价高的高承重静音阻尼轨道厂家推荐及选购指南
  • 2025年国内烘干设备厂家排行榜:四川蜀冷冷暖设备领跑行业
  • 性能压测 并发用户数 与 吞吐量、错误率之间的关系 - BKY007
  • 2025年房屋安全检测公司推荐排名:内蒙古鑫质检测有限公司领跑行业
  • 第三代半导体半桥上管电压电流测试方案
  • [Vue]性能优化:动态首行与动态列的匹配,表格数据格式处理性能优化