【本地摆设教程】Qwen2.5-VL 阿里最新开源最强的开源视觉大模型,支持视频 ...

打印 上一主题 下一主题

主题 857|帖子 857|积分 2571


简介

Qwen2.5-VL,Qwen 模型家族的旗舰视觉语言模型,对比此前发布的 Qwen2-VL 实现了巨大的飞跃。欢迎访问 Qwen Chat 并选择 Qwen2.5-VL-72B-Instruct 进行体验。此外,阿里在 Hugging Face 和 ModelScope 上开源了 Qwen2.5-VL 的 Base 和 Instruct 模型,包罗 3B、7B 和 72B 在内的 3 个模型尺寸。
Qwen2.5-VL 的主要特点如下所示:


  • 感知更丰富的世界:Qwen2.5-VL 不但善于辨认常见物体,如花、鸟、鱼和昆虫,还能够分析图像中的文本、图表、图标、图形和结构。
  • Agent:Qwen2.5-VL 直接作为一个视觉 Agent,可以推理并动态地使用工具,初步具备了使用电脑和使用手机的本领。
  • 明白长视频和捕捉变乱:Qwen2.5-VL 能够明白超过 1 小时的视频,而且这次它具备了通过精准定位相干视频片段来捕捉变乱的新本领。
  • 视觉定位:Qwen2.5-VL 可以通过生成 bounding boxes 或者 points 来准确定位图像中的物体,并能够为坐标和属性提供稳定的 JSON 输出。
  • 结构化输出:对于发票、表单、表格等数据,Qwen2.5-VL 支持其内容的结构化输出,惠及金融、商业等范畴的应用。
模型性能

通过对视觉语言模型进行了全面的评估,比力了 SOTA 模型以及同尺寸规模模型中表现最好的模型。在旗舰模型 Qwen2.5-VL-72B-Instruct 的测试中,它在一系列涵盖多个范畴和任务的基准测试中表现出色,包括大学水平的题目、数学、文档明白、视觉问答、视频明白和视觉 Agent。值得注意的是,Qwen2.5-VL 在明白文档和图表方面具有显著优势,而且能够作为视觉 Agent 进行操作,而无需特定任务的微调。

在较小的模型方面,Qwen2.5-VL-7B-Instruct 在多个任务中逾越了 GPT-4o-mini,而 Qwen2.5-VL-3B 作为端侧 AI 的潜力股,乃至逾越了之前版本 Qwen2-VL 的 7B 模型。


模型本领案例

1. 万物辨认

Qwen2.5-VL 显著加强了其通用图像辨认本领,大幅扩大了可辨认的图像种别量级。不但包括植物、动物、著名山川的地标,还包括影视作品中的 IP,以及各种各样的商品。
  1. 用户:这些景点是什么?请用中文和英文说出他们的名字。
复制代码

  1. Qwen2.5-VL
  2. 这些景点是:
  3. 1. 左上角: The Great Pyramids of Giza (埃及的吉萨大金字塔)
  4. 2. 右上角: The Great Wall of China (中国的长城)
  5. 3. 左下角: The Statue of Liberty (美国的自由女神像)
  6. 4. 右下角: The Terracotta Army (中国的秦始皇兵马俑)
复制代码
2. 精准的视觉定位

Qwen2.5-VL 采用矩形框和点的多样化方式对通用物体定位,可以实现层级化定位和规范的 JSON 格式输出。加强的定位本领为复杂场景中的视觉 Agent 进行明白和推理任务提供了底子。
  1. 用户:检测图像中的所有摩托车手,并以坐标的形式返回他们的位置。输出格式应如{“bbox_2d”:[x1,y1,x2,y2],“标签”:“摩托车手”,“sub_label”:“戴头盔”#或“不戴头盔”}。
复制代码

  1. Qwen2.5-VL
  2. [
  3.         {"bbox_2d": [341, 258, 397, 360], "label": "motorcyclist", "sub_label": "not wearing helmat "},
  4.         {"bbox_2d": [212, 332, 274, 448], "label": "motorcyclist", "sub_label": "not wearing helmat "},
  5.         {"bbox_2d": [66, 124, 112, 198], "label": "motorcyclist", "sub_label": "not wearing helmat "},
  6.         {"bbox_2d": [5, 235, 63, 320], "label": "motorcyclist", "sub_label": "wearing helmat "}
  7. ]
复制代码
3. 全面的文字辨认和明白

Qwen2.5-VL 将 OCR 辨认本领提升至一个新的水平,加强了多场景、多语言和多方向的文本辨认和文本定位本领。同时,在信息抽取本领上进行大幅度加强,以满意日益增长的资质考核、金融商务等数字化、智能化需求。
  1. 阅读图像中的所有文本,以行输出。
复制代码

  1. Qwen2.5-VL
  2. 平安喜樂 八方來財 順風順水順財神 暴富 大吉 諸事皆順 福 時來運轉 發財 如意 有錢有勢有前程 好運來
复制代码
4. Qwen 特色的文档解析

在 Qwen2.5-VL 中,设计了一种更全面的文档解析格式,称为 QwenVL HTML 格式,它既可以将文档中的文本精准地辨认出来,也能够提取文档元素(如图片、表格等)的位置信息,从而准确地将文档中的版面结构进行精准还原。基于经心构建的海量数据,QwenVL HTML 可以对广泛的场景进行鲁棒的文档解析,比如杂志、论文、网页、乃至手机截屏等等。
  1. 用户:QwenVL HTML
复制代码

  1. Qwen2.5-VL
  2. <html>
  3. <body>
  4. <h1 data-bbox="879 283 1605 348">Qwen2.5 Technical Report</h1>
  5. <p data-bbox="1124 406 1360 456"></p>
  6. <address class="author"><p>Qwen Team</p></address>
  7. <div class="image" data-bbox="778 491 850 541"><img data-bbox="778 491 850 541"/></div>
  8. <p data-bbox="885 491 1460 541">https://huggingface.co/Qwen</p>
  9. <div class="image" data-bbox="778 541 850 589"><img data-bbox="778 541 850 589"/></div>
  10. <p data-bbox="885 541 1708 589">https://modelscope.cn/organization/qwen</p>
  11. <div class="image" data-bbox="792 589 850 639"><img data-bbox="792 589 850 639"/></div>
  12. <p data-bbox="885 589 1584 639">https://github.com/QwenLM/Qwen2.5</p>
  13. <h2 data-bbox="1143 681 1344 733">Abstract</h2>
  14. <p data-bbox="434 785 2050 1252">In this report, we introduce Qwen2.5, a comprehensive series of large language models (LLMs) designed to meet diverse needs. Compared to previous iterations, Qwen 2.5 has been significantly improved during both the pre-training and post-training stages. In terms of pre-training, we have scaled the high-quality pre-training datasets from the previous 7 trillion tokens to 18 trillion tokens. This provides a strong foundation for common sense, expert knowledge, and reasoning capabilities. In terms of post-training, we implement intricate supervised finetuning with over 1 million samples, as well as multistage reinforcement learning, including offline learning DPO and online learning GRPO. Post-training techniques significantly enhance human preference, and notably improve long text generation, structural data analysis, and instruction following.</p>
  15. <p data-bbox="434 1262 2050 1587">To handle diverse and varied use cases effectively, we present Qwen2.5 LLM series in rich configurations. The open-weight offerings include base models and instruction-tuned models in sizes of $0.5 \mathrm{~B}, 1.5 \mathrm{~B}, 3 \mathrm{~B}, 7 \mathrm{~B}, 14 \mathrm{~B}, 32 \mathrm{~B}$, and $72 \mathrm{~B}$ parameters. Quantized versions of the instruction-tuned models are also provided. Over 100 models can be accessed from Hugging Face Hub, ModelScope, and Kaggle. In addition, for hosted solutions, the proprietary models currently include two mixture-of-experts (MoE) variants: Qwen2.5-Turbo and Qwen2.5-Plus, both available from Alibaba Cloud Model Studio.</p>
  16. <p data-bbox="434 1587 2050 2052">Qwen2.5 has demonstrated top-tier performance on a wide range of benchmarks evaluating language understanding, reasoning, mathematics, coding, human preference alignment, etc. Specifically, the open-weight flagship Qwen2.5-72B-Instruct outperforms a number of open and proprietary models and demonstrates competitive performance to the state-of-the-art open-weight model, Llama-3-405B-Instruct, which is around 5 times larger. Qwen2.5-Turbo and Qwen2.5-Plus offer superior cost-effectiveness while performing competitively against GPT-4o-mini and GPT-4o respectively. Additionally, as the foundation, Qwen2.5 models have been instrumental in training specialized models such as Qwen2.5-Math (Yang et al., 2024b), Qwen2.5-Coder (Hui et al., 2024), QwQ (Qwen Team, 2024d), and multimodal models.</p>
  17. <div class="image" data-bbox="408 2275 2086 2800"><img data-bbox="408 2275 2086 2800"/></div>
  18. <p data-bbox="289 2864 2202 3058">Figure 1: In the iterative development of the Qwen series, data scaling has played a crucial role. Qwen 2.5, which leverages 18 trillion tokens for pre-training, has demonstrated the most advanced capabilities within the Qwen series, especially in terms of domain expertise, underscoring the importance of scale together with mixture in enhancing the model’s capabilities.</p>
  19. </body>
  20. </html>
复制代码
5. 加强的视频明白

Qwen2.5-VL 的视频明白本领颠末全面升级,在时间处理上,引入了动态帧率(FPS)训练和绝对时间编码技术。如许一来,模型不但能够支持小时级别的超长视频明白,还具备秒级的变乱定位本领。它不但能够准确地明白小时级别的长视频内容,还可以在视频中搜刮具体变乱,并对视频的差别时间段进行要点总结,从而快速、高效地资助用户提取视频中蕴藏的关键信息。
  1. 用户:观看视频,并在表格中列出论文标题。
复制代码

https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/Qwen2.5-VL/video_ocr.mp4
  1. 这是一张表格,列出了视频中的论文标题:
  2. 论文标题
  3. 具有时空嵌入的新顺序预测框架
  4. NeW CRFs:用于单眼深度估计的神经窗口全连接CRF
  5. 异构推荐的深度统一表示
  6. OFA:通过简单的序列到序列学习框架统一架构、任务和模式
  7. KoMen:新兴场景的领域知识引导互动建议 Yiqing Xie
  8. 提升场景文本探测器的视觉语言预训练
复制代码
6. 能够操作电脑和手机的视觉 Agent

通过利用内在的感知、解析和推理本领,Qwen2.5-VL 显现出了不错的装备操作本领。这包括在手机、网络平台和电脑上实行任务,为创建真正的视觉代理提供了有代价的参考点。
  1. 用户:请帮我在预订应用程序中预订一张单程票。起点是重庆江北机场,终点是1月28日的北京首都机场
复制代码

https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/Qwen2.5-VL/agent_booking_with_log.mp4
模型更新

与 Qwen2-VL 相比,Qwen2.5-VL 加强了模型对时间和空间尺度的感知本领,并进一步简化了网络结构以提高模型效率。


  • 时间和图像尺寸的感知
在空间维度上,Qwen2.5-VL 不但能够动态地将差别尺寸的图像转换为差别长度的 token,还直接使用图像的现实尺寸来表现检测框和点等坐标,而不进行传统的坐标归一化。这使得模型能够直接学习图像的尺度。在时间维度上,引入了动态 FPS (每秒帧数) 训练和绝对时间编码,将 mRoPE id 直接与时间流速对齐。这使得模型能够通过时间维度 id 的隔断来学习时间的节奏。



  • 更简洁高效的视觉编码器
视觉编码器在多模态大模型中扮演着至关重要的角色。阿里重新开始训练了一个原生动态分辨率的 ViT,包括 CLIP、视觉 - 语言模型对齐和端到端训练等阶段。为了办理多模态大模型在训练和测试阶段 ViT 负载不平衡的题目,引入了窗口注意力机制,有效减少了 ViT 端的盘算负担。在的 ViT 设置中,只有四层是全注意力层,别的层使用窗口注意力。最大窗口大小为 8x8,小于 8x8 的区域不必要填充,而是保持原始尺度,确保模型保持原生分辨率。此外,为了简化整体网络结构,使 ViT 架构与 LLMs 更加划一,采用了 RMSNorm 和 SwiGLU 结构。
本地摆设

电脑上先安装好 Git 和 Python 环境,没有的可以自行先去安装, 我用的是 Python 3.10.6 版本【点击下载

  • 起首克隆 Qwen2.5-VL GitHub 存储库并导航到项目目次:
  1. git clone https://github.com/QwenLM/Qwen2.5-VL
复制代码
  1. cd Qwen2.5-VL
复制代码

  • 使用以下命令安装 Web 应用程序所需的依赖项:
  1. pip install -r requirements_web_demo.txt
复制代码

  • 为确保与 GPU 兼容,致意装支持 CUDA 的最新版本的 PyTorch、TorchVision 和 TorchAudio。纵然已经安装了 PyTorch,您在运行 Web 应用程序时也大概会遇到题目,因此最好更新:
  1. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
复制代码

  • 更新 Gradio 和 Gradio Client 以避免连接和 UI 相干的错误,因为旧版本大概会导致题目:
  1. pip install -U gradio gradio_client
复制代码
5. 下方是模型的下载安装,总共有 3 个选项:
较小的 3B 模型,建议在 GPU 内存有限的条记本电脑(例如 8GB VRAM)上使用。
  1. python web_demo_mm.py --checkpoint-path "Qwen/Qwen2.5-VL-3B-Instruct"
复制代码
显存高于 8G 的可以选择 7B 模型,性能更强、结果更好!
  1. python web_demo_mm.py --checkpoint-path "Qwen/Qwen2.5-VL-7B-Instruct"
复制代码
如果是土豪,手里有专业级别的 GPU,那么可以直接上 72B 的最大模型,性能直冲天花板!
  1. python web_demo_mm.py --checkpoint-path "Qwen/Qwen2.5-VL-72B-Instruct"
复制代码
实行命令后,起首下载模型,然后加载处理器和模型

安装完成后在浏览器上打开本地链接 http://127.0.0.1:7860 即可正常使用

Qwen2.5-VL 3 个完整开源版本已经托管在 hugging face 上,必要的可以自行去下载
开源模型:【 点击前往 】

固然如果你的电脑硬件不支持,那么可以直接使用官方的免费平台来使用,固然免费平台是共享 GPU,有额度限定。唯一的利益可以直接免费使用 Qwen 2.5 VL 最强的 78B 模型! Qwen 2.5 VL 免费官方平台 【 点击前往
测试结果如下:


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

何小豆儿在此

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表