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

【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.dtcms.com/a/519456.html

相关文章:

  • 目标检测YOLO实战应用案例100讲-基于多模态和多模型融合 的三维目标检测
  • 【成长纪实】从“Hello World”到分布式实战的进阶之路
  • 图论理论基础(1)
  • 开源 Linux 服务器与中间件(十)Mqtt协议和Emqx服务器安装测试
  • 网站建设实践鉴定手机网站建设讯息
  • 网站管理文档怎么写晚上睡不着看点害羞的东西app
  • uni-app 广告弹窗最佳实践:不扰民、可控制频次、含完整源码
  • 使用eNSP模拟器搭建网络拓扑结构(笔记2):从 0 到 1 掌握华为网络仿真
  • UniApp 多页面编译优化:编译时间从10分钟到1分钟
  • C++变量与函数命名规范技术指南 (基于华为编码规范与现代C++最佳实践)
  • ELK1——elasticsearch
  • 【图像卷积基础】卷积过程卷积实现通道扩充与压缩池化Pooling原理和可视化
  • 杭州公司网站设计外贸手工做兼职的网站
  • 深入浅出Langchain4j——构建Java大语言模型应用的新范式
  • Babylon.js学习之路《添加自定义摇杆控制相机》
  • 【JAVA 进阶】SpringBoot集成Sa-Token权限校验框架深度解析
  • 【CMakeLists.txt】Qt6 依赖配置详解
  • 用js做网站登录网页成品
  • 数据库安全网关:从“看得见访问”到“控得住风险”的关键一层
  • 对泊松过程的理解
  • 【数论】质数筛(埃氏筛、欧拉筛)
  • 扩展名网站兰州做网站一咨询兰州做网站公司
  • 华为OD-Java面经-21届考研
  • Excel拆分和合并优化版本
  • 智能网联汽车:当汽车遇上“智慧网络”
  • 常规点光源在工业视觉检测上的应用
  • C++新特性——正则表达式
  • 基于卷积神经网络的汽车类型识别系统,resnet50,vgg16,resnet34【pytorch框架,python代码】
  • 设计 企业网站电脑系统网站建设
  • 做网站业务的怎么找资源网站推广名片