HwwwH commited on
Commit
9b50e49
1 Parent(s): 0ec35ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -201
README.md CHANGED
@@ -1,201 +1,3 @@
1
- ---
2
- pipeline_tag: visual-question-answering
3
- language:
4
- - en
5
- - zh
6
- datasets:
7
- - HaoyeZhang/RLHF-V-Dataset
8
- - Yirany/UniMM-Chat
9
- - HuggingFaceM4/VQAv2
10
- - liuhaotian/LLaVA-Instruct-150K
11
- ---
12
-
13
- [GitHub](https://github.com/OpenBMB/MiniCPM-V) | [Demo](https://huggingface.co/spaces/openbmb/MiniCPM-V-2)
14
-
15
- ## News <!-- omit in toc -->
16
- * [2024.05.20] 🔥 The GPT-4V level multimodal model [**MiniCPM-Llama3-V 2.5**](https://huggingface.co/openbmb/MiniCPM-Llama3-V-2_5) is out.
17
- * [2024.04.23] MiniCPM-V 2.0 supports [vLLM](#vllm) now!
18
- * [2024.04.18] We create a HuggingFace Space to host the demo of MiniCPM-V 2.0 at [here](https://huggingface.co/spaces/openbmb/MiniCPM-V-2)!
19
- * [2024.04.17] MiniCPM-V 2.0 supports deploying [WebUI Demo](https://github.com/OpenBMB/MiniCPM-V/blob/8a1f766b85595a8095651eed9a44a83a965b305b/README_en.md#minicpm-v-) now!
20
- * [2024.04.15] MiniCPM-V 2.0 supports [fine-tuning](https://github.com/modelscope/swift/blob/main/docs/source/Multi-Modal/minicpm-v-2最佳实践.md) with the SWIFT framework!
21
- * [2024.04.12] We open-source MiniCPM-V-2.0, which achieves comparable performance with Gemini Pro in understanding scene text and outperforms strong Qwen-VL-Chat 9.6B and Yi-VL 34B on <a href="https://rank.opencompass.org.cn/leaderboard-multimodal">OpenCompass</a>, a comprehensive evaluation over 11 popular benchmarks. Click <a href="https://openbmb.vercel.app/minicpm-v-2">here</a> to view the MiniCPM-V 2.0 technical blog.
22
-
23
- ## MiniCPM-V 2.0
24
-
25
-
26
- **MiniCPM-V 2.8B** is a strong multimodal large language model for efficient end-side deployment. The model is built based on SigLip-400M and [MiniCPM-2.4B](https://github.com/OpenBMB/MiniCPM/), connected by a perceiver resampler. Our latest version, **MiniCPM-V 2.0** has several notable features.
27
-
28
- - 🔥 **State-of-the-art Performance.**
29
-
30
- MiniCPM-V 2.0 achieves **state-of-the-art performance** on multiple benchmarks (including OCRBench, TextVQA, MME, MMB, MathVista, etc) among models under 7B parameters. It even **outperforms strong Qwen-VL-Chat 9.6B, CogVLM-Chat 17.4B, and Yi-VL 34B on OpenCompass, a comprehensive evaluation over 11 popular benchmarks**. Notably, MiniCPM-V 2.0 shows **strong OCR capability**, achieving **comparable performance to Gemini Pro in scene-text understanding**, and **state-of-the-art performance on OCRBench** among open-source models.
31
-
32
- - 🏆 **Trustworthy Behavior.**
33
-
34
- LMMs are known for suffering from hallucination, often generating text not factually grounded in images. MiniCPM-V 2.0 is **the first end-side LMM aligned via multimodal RLHF for trustworthy behavior** (using the recent [RLHF-V](https://rlhf-v.github.io/) [CVPR'24] series technique). This allows the model to **match GPT-4V in preventing hallucinations** on Object HalBench.
35
-
36
- - 🌟 **High-Resolution Images at Any Aspect Raito.**
37
-
38
- MiniCPM-V 2.0 can accept **1.8 million pixels (e.g., 1344x1344) images at any aspect ratio**. This enables better perception of fine-grained visual information such as small objects and optical characters, which is achieved via a recent technique from [LLaVA-UHD](https://arxiv.org/pdf/2403.11703.pdf).
39
-
40
- - ⚡️ **High Efficiency.**
41
-
42
- MiniCPM-V 2.0 can be **efficiently deployed on most GPU cards and personal computers**, and **even on end devices such as mobile phones**. For visual encoding, we compress the image representations into much fewer tokens via a perceiver resampler. This allows MiniCPM-V 2.0 to operate with **favorable memory cost and speed during inference even when dealing with high-resolution images**.
43
-
44
-
45
-
46
- - 🙌 **Bilingual Support.**
47
-
48
- MiniCPM-V 2.0 **supports strong bilingual multimodal capabilities in both English and Chinese**. This is enabled by generalizing multimodal capabilities across languages, a technique from [VisCPM](https://arxiv.org/abs/2308.12038) [ICLR'24].
49
-
50
- ## Evaluation <!-- omit in toc -->
51
-
52
- <div align="center">
53
- <img src=/openbmb/MiniCPM-V-2.0/resolve/main/assets/minicpmv-2-peformance2.png width=100% />
54
- </div>
55
- Results on TextVQA, DocVQA, OCRBench, OpenCompass, MME, MMBench, MMMU, MathVista, LLaVA Bench, Object HalBench.
56
- <div align="center">
57
- <img src=/openbmb/MiniCPM-V-2.0/resolve/main/assets/minicpmv-2-benchmark.png width=140% />
58
- </div>
59
-
60
-
61
- ## Examples <!-- omit in toc -->
62
-
63
- <table align="center">
64
- <p align="center">
65
- <img src="assets/minicpmv2-cases_2.png" width=95%/>
66
- </p>
67
- </table>
68
-
69
- We deploy MiniCPM-V 2.0 on end devices. The demo video is the raw screen recording on a Xiaomi 14 Pro without edition.
70
-
71
- <table align="center">
72
- <p align="center">
73
- <img src="assets/station.gif" width=40% style="display:inline-block;"/>
74
- <img src="assets/london_car.gif" width=40% style="display:inline-block;"/>
75
- </p>
76
- </table>
77
-
78
-
79
-
80
-
81
- ## Demo
82
- Click here to try out the Demo of [MiniCPM-V 2.0](https://huggingface.co/spaces/openbmb/MiniCPM-V-2).
83
-
84
- ## Deployment on Mobile Phone
85
- MiniCPM-V 2.0 can be deployed on mobile phones with Android and Harmony operating systems. 🚀 Try it out [here](https://github.com/OpenBMB/mlc-MiniCPM).
86
-
87
- ## Inference with vLLM<a id="vllm"></a>
88
-
89
- <details>
90
- <summary>Click to see how to inference with vLLM </summary>
91
- Because our pull request to vLLM is still waiting for reviewing, we fork this repository to build and test our vLLM demo. Here are the steps:
92
-
93
- 1. Clone our version of vLLM:
94
- ```shell
95
- git clone https://github.com/OpenBMB/vllm.git
96
- ```
97
- 2. Install vLLM:
98
- ```shell
99
- cd vllm
100
- pip install -e .
101
- ```
102
- 3. Install timm:
103
- ```shell
104
- pip install timm=0.9.10
105
- ```
106
- 4. Run our demo:
107
- ```shell
108
- python examples/minicpmv_example.py
109
- ```
110
- </details>
111
-
112
-
113
- ## Usage
114
- Inference using Huggingface transformers on Nivdia GPUs or Mac with MPS (Apple silicon or AMD GPUs). Requirements tested on python 3.10:
115
- ```
116
- Pillow==10.1.0
117
- timm==0.9.10
118
- torch==2.1.2
119
- torchvision==0.16.2
120
- transformers==4.36.0
121
- sentencepiece==0.1.99
122
- ```
123
-
124
- ```python
125
- # test.py
126
- import torch
127
- from PIL import Image
128
- from transformers import AutoModel, AutoTokenizer
129
-
130
- model = AutoModel.from_pretrained('openbmb/MiniCPM-V-2', trust_remote_code=True, torch_dtype=torch.bfloat16)
131
- # For Nvidia GPUs support BF16 (like A100, H100, RTX3090)
132
- model = model.to(device='cuda', dtype=torch.bfloat16)
133
- # For Nvidia GPUs do NOT support BF16 (like V100, T4, RTX2080)
134
- #model = model.to(device='cuda', dtype=torch.float16)
135
- # For Mac with MPS (Apple silicon or AMD GPUs).
136
- # Run with `PYTORCH_ENABLE_MPS_FALLBACK=1 python test.py`
137
- #model = model.to(device='mps', dtype=torch.float16)
138
-
139
- tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-V-2', trust_remote_code=True)
140
- model.eval()
141
-
142
- image = Image.open('xx.jpg').convert('RGB')
143
- question = 'What is in the image?'
144
- msgs = [{'role': 'user', 'content': question}]
145
-
146
- res, context, _ = model.chat(
147
- image=image,
148
- msgs=msgs,
149
- context=None,
150
- tokenizer=tokenizer,
151
- sampling=True,
152
- temperature=0.7
153
- )
154
- print(res)
155
- ```
156
-
157
- Please look at [GitHub](https://github.com/OpenBMB/MiniCPM-V) for more detail about usage.
158
-
159
-
160
- ## MiniCPM-V 1.0 <!-- omit in toc -->
161
- Please see the info about MiniCPM-V 1.0 [here](https://huggingface.co/openbmb/MiniCPM-V).
162
-
163
- ## License
164
- #### Model License
165
- * The code in this repo is released under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE) License.
166
- * The usage of MiniCPM-V series model weights must strictly follow [MiniCPM Model License.md](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md).
167
- * The models and weights of MiniCPM are completely free for academic research. after filling out a ["questionnaire"](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g) for registration, are also available for free commercial use.
168
-
169
-
170
- #### Statement
171
- * As a LLM, MiniCPM-V 2.0 generates contents by learning a large mount of texts, but it cannot comprehend, express personal opinions or make value judgement. Anything generated by MiniCPM-V 2.0 does not represent the views and positions of the model developers
172
- * We will not be liable for any problems arising from the use of the MinCPM-V open Source model, including but not limited to data security issues, risk of public opinion, or any risks and problems arising from the misdirection, misuse, dissemination or misuse of the model.
173
-
174
- ## Other Multimodal Projects from Our Team
175
-
176
- [VisCPM](https://github.com/OpenBMB/VisCPM/tree/main) | [RLHF-V](https://github.com/RLHF-V/RLHF-V) | [LLaVA-UHD](https://github.com/thunlp/LLaVA-UHD)
177
-
178
- ## Citation
179
-
180
- If you find our work helpful, please consider citing the following papers
181
-
182
- ```bib
183
- @article{yu2023rlhf,
184
- title={Rlhf-v: Towards trustworthy mllms via behavior alignment from fine-grained correctional human feedback},
185
- author={Yu, Tianyu and Yao, Yuan and Zhang, Haoye and He, Taiwen and Han, Yifeng and Cui, Ganqu and Hu, Jinyi and Liu, Zhiyuan and Zheng, Hai-Tao and Sun, Maosong and others},
186
- journal={arXiv preprint arXiv:2312.00849},
187
- year={2023}
188
- }
189
- @article{viscpm,
190
- title={Large Multilingual Models Pivot Zero-Shot Multimodal Learning across Languages},
191
- author={Jinyi Hu and Yuan Yao and Chongyi Wang and Shan Wang and Yinxu Pan and Qianyu Chen and Tianyu Yu and Hanghao Wu and Yue Zhao and Haoye Zhang and Xu Han and Yankai Lin and Jiao Xue and Dahai Li and Zhiyuan Liu and Maosong Sun},
192
- journal={arXiv preprint arXiv:2308.12038},
193
- year={2023}
194
- }
195
- @article{xu2024llava-uhd,
196
- title={{LLaVA-UHD}: an LMM Perceiving Any Aspect Ratio and High-Resolution Images},
197
- author={Xu, Ruyi and Yao, Yuan and Guo, Zonghao and Cui, Junbo and Ni, Zanlin and Ge, Chunjiang and Chua, Tat-Seng and Liu, Zhiyuan and Huang, Gao},
198
- journal={arXiv preprint arXiv:2403.11703},
199
- year={2024}
200
- }
201
- ```
 
1
+ # MiniCPM-V-2
2
+ * Copy of [Openbmb/MiniCPM-V-2](https://huggingface.co/openbmb/MiniCPM-V-2).
3
+ * Update processor and image processor.