🚀 InternVL3-2B预训练模型
InternVL3-2B预训练模型是一个先进的多模态大语言模型,它整合了图像和文本处理能力,在多模态感知、推理和语言理解等方面表现出色。该模型采用了创新的训练策略,能够处理多种类型的视觉和语言任务,为多模态领域的研究和应用提供了强大的支持。
项目链接
✨ 主要特性
- 多模态能力:支持图像、文本和视频等多种模态的输入,能够处理多模态推理、数学、OCR、图表理解等任务。
- 语言能力:在语言理解和生成方面表现出色,与Qwen2.5系列相比,具有更好的整体文本性能。
- 创新架构:采用“ViT-MLP-LLM”范式,集成了新的增量预训练的InternViT和各种预训练的LLM。
- 高效训练策略:提出了原生多模态预训练方法,结合监督微调、混合偏好优化和测试时缩放等策略,提高了模型的性能和推理能力。
📦 安装指南
依赖安装
pip install transformers>=4.37.2
pip install lmdeploy>=0.7.3
pip install openai
💻 使用示例
基础用法
import torch
from transformers import AutoTokenizer, AutoModel
path = "OpenGVLab/InternVL3-2B"
model = AutoModel.from_pretrained(
path,
torch_dtype=torch.bfloat16,
low_cpu_mem_usage=True,
use_flash_attn=True,
trust_remote_code=True).eval().cuda()
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True, use_fast=False)
question = 'Hello, who are you?'
response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
print(f'User: {question}\nAssistant: {response}')
高级用法
from lmdeploy.vl import load_image
model = 'OpenGVLab/InternVL3-2B'
image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg')
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=1), chat_template_config=ChatTemplateConfig(model_name='internvl2_5'))
response = pipe(('describe this image', image))
print(response.text)
📚 详细文档
模型概述
InternVL3-2B预训练模型是InternVL系列的最新版本,它结合了视觉和语言能力,能够处理多种多模态任务。该模型基于OpenGVLab/InternViT-300M-448px-V2_5和Qwen/Qwen2.5-1.5B两个基础模型进行合并,支持多语言输入。
模型架构
InternVL3保留了与InternVL 2.5及其前身相同的模型架构,采用“ViT-MLP-LLM”范式。在新版本中,通过随机初始化的MLP投影仪,将新的增量预训练的InternViT与各种预训练的LLM(如InternLM 3和Qwen 2.5)集成在一起。
训练策略
- 原生多模态预训练:将语言和视觉学习整合到一个预训练阶段,同时学习语言和多模态表示,提高模型处理视觉语言任务的能力。
- 监督微调:采用随机JPEG压缩、平方损失重新加权和多模态数据打包等技术,使用更高质量和更多样化的训练数据,进一步提升模型性能。
- 混合偏好优化:引入正负样本的额外监督,使模型响应分布与真实分布对齐,提高推理性能。
- 测试时缩放:使用Best-of-N评估策略和VisualPRM-8B作为评判模型,选择最佳响应进行推理和数学评估。
评估结果
- 多模态能力评估:在多模态推理、数学、OCR、图表理解、多图像和视频理解等任务上表现出色。
- 语言能力评估:与Qwen2.5系列相比,具有更好的整体文本性能。
消融研究
- 原生多模态预训练:实验表明,原生多模态预训练能够赋予模型强大的多模态能力,提高模型在多模态任务上的性能。
- 混合偏好优化:使用MPO进行微调的模型在多模态推理基准测试中表现更优,性能提升主要源于训练算法而非训练数据。
- 可变视觉位置编码:引入V2PE显著提高了模型在大多数评估指标上的性能,为未来改进MLLM中视觉令牌的位置编码策略提供了重要见解。
🔧 技术细节
模型架构

训练策略
原生多模态预训练

混合偏好优化

可变视觉位置编码

评估结果
多模态能力评估

语言能力评估

📄 许可证
本项目采用MIT许可证发布。本项目使用了预训练的Qwen2.5作为组件,该组件遵循Apache-2.0许可证。
引用
如果您在研究中发现本项目有用,请考虑引用以下文献:
@article{chen2024expanding,
title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},
author={Chen, Zhe and Wang, Weiyun and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Cui, Erfei and Zhu, Jinguo and Ye, Shenglong and Tian, Hao and Liu, Zhaoyang and others},
journal={arXiv preprint arXiv:2412.05271},
year={2024}
}
@article{wang2024mpo,
title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},
author={Wang, Weiyun and Chen, Zhe and Wang, Wenhai and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Zhu, Jinguo and Zhu, Xizhou and Lu, Lewei and Qiao, Yu and Dai, Jifeng},
journal={arXiv preprint arXiv:2411.10442},
year={2024}
}
@article{chen2024far,
title={How Far Are We to GPT-4V? Closing the Gap to Commercial Multimodal Models with Open-Source Suites},
author={Chen, Zhe and Wang, Weiyun and Tian, Hao and Ye, Shenglong and Gao, Zhangwei and Cui, Erfei and Tong, Wenwen and Hu, Kongzhi and Luo, Jiapeng and Ma, Zheng and others},
journal={arXiv preprint arXiv:2404.16821},
year={2024}
}
@inproceedings{chen2024internvl,
title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},
author={Chen, Zhe and Wu, Jiannan and Wang, Wenhai and Su, Weijie and Chen, Guo and Xing, Sen and Zhong, Muyan and Zhang, Qinglong and Zhu, Xizhou and Lu, Lewei and others},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={24185--24198},
year={2024}
}
信息表格
属性 |
详情 |
模型类型 |
图像文本到文本 |
训练数据 |
多语言,结合图像、文本和视频等多模态数据 |
基础模型 |
OpenGVLab/InternViT-300M-448px-V2_5、Qwen/Qwen2.5-1.5B |
基础模型关系 |
合并 |
常用提示信息
⚠️ 重要提示
请使用transformers>=4.37.2以确保模型正常工作。
💡 使用建议
在进行多GPU推理时,确保大语言模型(LLM)的第一层和最后一层在同一设备上,以避免错误。