unsubscribe commited on
Commit
54d4e76
β€’
1 Parent(s): 7761440

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +223 -3
README.md CHANGED
@@ -1,3 +1,223 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: qwen
4
+ license_link: https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/main/LICENSE
5
+ pipeline_tag: image-text-to-text
6
+ library_name: transformers
7
+ base_model:
8
+ - OpenGVLab/InternViT-6B-448px-V2_5
9
+ - Qwen/Qwen2.5-72B-Instruct
10
+ base_model_relation: merge
11
+ language:
12
+ - multilingual
13
+ tags:
14
+ - internvl
15
+ - custom_code
16
+ ---
17
+
18
+ # InternVL2_5-26B-AWQ
19
+
20
+ [\[πŸ“‚ GitHub\]](https://github.com/OpenGVLab/InternVL) [\[πŸ“œ InternVL 1.0\]](https://huggingface.co/papers/2312.14238) [\[πŸ“œ InternVL 1.5\]](https://huggingface.co/papers/2404.16821) [\[πŸ“œ Mini-InternVL\]](https://arxiv.org/abs/2410.16261) [\[πŸ“œ InternVL 2.5\]](https://huggingface.co/papers/2412.05271)
21
+
22
+ [\[πŸ†• Blog\]](https://internvl.github.io/blog/) [\[πŸ—¨οΈ Chat Demo\]](https://internvl.opengvlab.com/) [\[πŸ€— HF Demo\]](https://huggingface.co/spaces/OpenGVLab/InternVL) [\[πŸš€ Quick Start\]](#quick-start) [\[πŸ“– Documents\]](https://internvl.readthedocs.io/en/latest/)
23
+
24
+ <div align="center">
25
+ <img width="500" alt="image" src="https://cdn-uploads.huggingface.co/production/uploads/64006c09330a45b03605bba3/zJsd2hqd3EevgXo6fNgC-.png">
26
+ </div>
27
+
28
+ ## Introduction
29
+
30
+ We are excited to introduce **InternVL 2.5**, an advanced multimodal large language model (MLLM) series that builds upon InternVL 2.0, maintaining its core model architecture while introducing significant enhancements in training and testing strategies as well as data quality.
31
+
32
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64119264f0f81eb569e0d569/5HDAGOQOZvS1EtI107Ac-.png)
33
+
34
+ ## InternVL 2.5 Family
35
+
36
+ In the following table, we provide an overview of the InternVL 2.5 series.
37
+
38
+ | Model Name | Vision Part | Language Part | HF Link |
39
+ | :-------------: | :-------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------: | :---------------------------------------------------------: |
40
+ | InternVL2_5-1B | [InternViT-300M-448px-V2_5](https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5) | [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) | [πŸ€— link](https://huggingface.co/OpenGVLab/InternVL2_5-1B) |
41
+ | InternVL2_5-2B | [InternViT-300M-448px-V2_5](https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5) | [internlm2_5-1_8b-chat](https://huggingface.co/internlm/internlm2_5-1_8b-chat) | [πŸ€— link](https://huggingface.co/OpenGVLab/InternVL2_5-2B) |
42
+ | InternVL2_5-4B | [InternViT-300M-448px-V2_5](https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5) | [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) | [πŸ€— link](https://huggingface.co/OpenGVLab/InternVL2_5-4B) |
43
+ | InternVL2_5-8B | [InternViT-300M-448px-V2_5](https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5) | [internlm2_5-7b-chat](https://huggingface.co/internlm/internlm2_5-7b-chat) | [πŸ€— link](https://huggingface.co/OpenGVLab/InternVL2_5-8B) |
44
+ | InternVL2_5-26B | [InternViT-6B-448px-V2_5](https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5) | [internlm2_5-20b-chat](https://huggingface.co/internlm/internlm2_5-20b-chat) | [πŸ€— link](https://huggingface.co/OpenGVLab/InternVL2_5-26B) |
45
+ | InternVL2_5-38B | [InternViT-6B-448px-V2_5](https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5) | [Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) | [πŸ€— link](https://huggingface.co/OpenGVLab/InternVL2_5-38B) |
46
+ | InternVL2_5-78B | [InternViT-6B-448px-V2_5](https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5) | [Qwen2.5-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct) | [πŸ€— link](https://huggingface.co/OpenGVLab/InternVL2_5-78B) |
47
+
48
+ ## Model Architecture
49
+
50
+ As shown in the following figure, InternVL 2.5 retains the same model architecture as its predecessors, InternVL 1.5 and 2.0, following the "ViT-MLP-LLM" paradigm. In this new version, we integrate a newly incrementally pre-trained InternViT with various pre-trained LLMs, including InternLM 2.5 and Qwen 2.5, using a randomly initialized MLP projector.
51
+
52
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64119264f0f81eb569e0d569/BiiyXN6NOk0p-3rl3ueyL.png)
53
+
54
+ As in the previous version, we applied a pixel unshuffle operation, reducing the number of visual tokens to one-quarter of the original. Besides, we adopted a similar dynamic resolution strategy as InternVL 1.5, dividing images into tiles of 448Γ—448 pixels. The key difference, starting from InternVL 2.0, is that we additionally introduced support for multi-image and video data.
55
+
56
+ ## Deployment
57
+
58
+ ### LMDeploy
59
+
60
+ LMDeploy is a toolkit for compressing, deploying, and serving LLMs & VLMs.
61
+
62
+ ```sh
63
+ pip install lmdeploy>=0.6.4
64
+ ```
65
+
66
+ LMDeploy abstracts the complex inference process of multi-modal Vision-Language Models (VLM) into an easy-to-use pipeline, similar to the Large Language Model (LLM) inference pipeline.
67
+
68
+ #### A 'Hello, world' Example
69
+
70
+ ```python
71
+ from lmdeploy import pipeline, TurbomindEngineConfig
72
+ from lmdeploy.vl import load_image
73
+
74
+ model = 'OpenGVLab/InternVL2_5-26B-AWQ'
75
+ image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg')
76
+ pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=8192, tp=2))
77
+ response = pipe(('describe this image', image))
78
+ print(response.text)
79
+ ```
80
+
81
+ If `ImportError` occurs while executing this case, please install the required dependency packages as prompted.
82
+
83
+ #### Multi-images Inference
84
+
85
+ When dealing with multiple images, you can put them all in one list. Keep in mind that multiple images will lead to a higher number of input tokens, and as a result, the size of the context window typically needs to be increased.
86
+
87
+ question = 'Describe this video in detail.'
88
+
89
+ ```python
90
+ from lmdeploy import pipeline, TurbomindEngineConfig
91
+ from lmdeploy.vl import load_image
92
+ from lmdeploy.vl.constants import IMAGE_TOKEN
93
+
94
+ model = 'OpenGVLab/InternVL2_5-26B-AWQ'
95
+ pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=8192, tp=2))
96
+
97
+ image_urls=[
98
+ 'https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg',
99
+ 'https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/det.jpg'
100
+ ]
101
+
102
+ images = [load_image(img_url) for img_url in image_urls]
103
+ # Numbering images improves multi-image conversations
104
+ response = pipe((f'Image-1: {IMAGE_TOKEN}\nImage-2: {IMAGE_TOKEN}\ndescribe these two images', images))
105
+ print(response.text)
106
+ ```
107
+
108
+ #### Batch Prompts Inference
109
+
110
+ Conducting inference with batch prompts is quite straightforward; just place them within a list structure:
111
+
112
+ ```python
113
+ from lmdeploy import pipeline, TurbomindEngineConfig
114
+ from lmdeploy.vl import load_image
115
+
116
+ model = 'OpenGVLab/InternVL2_5-26B-AWQ'
117
+ pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=8192, tp=2))
118
+
119
+ image_urls=[
120
+ "https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg",
121
+ "https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/det.jpg"
122
+ ]
123
+ prompts = [('describe this image', load_image(img_url)) for img_url in image_urls]
124
+ response = pipe(prompts)
125
+ print(response)
126
+ ```
127
+
128
+ #### Multi-turn Conversation
129
+
130
+ There are two ways to do the multi-turn conversations with the pipeline. One is to construct messages according to the format of OpenAI and use above introduced method, the other is to use the `pipeline.chat` interface.
131
+
132
+ ```python
133
+ from lmdeploy import pipeline, TurbomindEngineConfig, GenerationConfig
134
+ from lmdeploy.vl import load_image
135
+
136
+ model = 'OpenGVLab/InternVL2_5-26B-AWQ'
137
+ pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=8192, tp=2))
138
+
139
+ image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg')
140
+ gen_config = GenerationConfig(top_k=40, top_p=0.8, temperature=0.8)
141
+ sess = pipe.chat(('describe this image', image), gen_config=gen_config)
142
+ print(sess.response.text)
143
+ sess = pipe.chat('What is the woman doing?', session=sess, gen_config=gen_config)
144
+ print(sess.response.text)
145
+ ```
146
+
147
+ #### Service
148
+
149
+ LMDeploy's `api_server` enables models to be easily packed into services with a single command. The provided RESTful APIs are compatible with OpenAI's interfaces. Below are an example of service startup:
150
+
151
+ ```shell
152
+ lmdeploy serve api_server OpenGVLab/InternVL2_5-26B-AWQ --backend turbomind --server-port 23333 --tp 2
153
+ ```
154
+
155
+ To use the OpenAI-style interface, you need to install OpenAI:
156
+
157
+ ```shell
158
+ pip install openai
159
+ ```
160
+
161
+ Then, use the code below to make the API call:
162
+
163
+ ```python
164
+ from openai import OpenAI
165
+
166
+ client = OpenAI(api_key='YOUR_API_KEY', base_url='http://0.0.0.0:23333/v1')
167
+ model_name = client.models.list().data[0].id
168
+ response = client.chat.completions.create(
169
+ model=model_name,
170
+ messages=[{
171
+ 'role':
172
+ 'user',
173
+ 'content': [{
174
+ 'type': 'text',
175
+ 'text': 'describe this image',
176
+ }, {
177
+ 'type': 'image_url',
178
+ 'image_url': {
179
+ 'url':
180
+ 'https://modelscope.oss-cn-beijing.aliyuncs.com/resource/tiger.jpeg',
181
+ },
182
+ }],
183
+ }],
184
+ temperature=0.8,
185
+ top_p=0.8)
186
+ print(response)
187
+ ```
188
+
189
+ ## License
190
+
191
+ This project is released under the MIT License. This project uses the pre-trained Qwen2.5-72B-Instruct as a component, which is licensed under the Qwen License.
192
+
193
+ ## Citation
194
+
195
+ If you find this project useful in your research, please consider citing:
196
+
197
+ ```BibTeX
198
+ @article{chen2024expanding,
199
+ title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},
200
+ 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},
201
+ journal={arXiv preprint arXiv:2412.05271},
202
+ year={2024}
203
+ }
204
+ @article{gao2024mini,
205
+ title={Mini-internvl: A flexible-transfer pocket multimodal model with 5\% parameters and 90\% performance},
206
+ author={Gao, Zhangwei and Chen, Zhe and Cui, Erfei and Ren, Yiming and Wang, Weiyun and Zhu, Jinguo and Tian, Hao and Ye, Shenglong and He, Junjun and Zhu, Xizhou and others},
207
+ journal={arXiv preprint arXiv:2410.16261},
208
+ year={2024}
209
+ }
210
+ @article{chen2024far,
211
+ title={How Far Are We to GPT-4V? Closing the Gap to Commercial Multimodal Models with Open-Source Suites},
212
+ 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},
213
+ journal={arXiv preprint arXiv:2404.16821},
214
+ year={2024}
215
+ }
216
+ @inproceedings{chen2024internvl,
217
+ title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},
218
+ 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},
219
+ booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
220
+ pages={24185--24198},
221
+ year={2024}
222
+ }
223
+ ```