devendradhakad commited on
Commit
d1092ca
·
verified ·
1 Parent(s): 532aa73

Mirror AutoDroid pins from openbmb/MiniCPM-V-4.6-gguf@78e02f066e98

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ MiniCPM-V-4_6-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
37
+ mmproj-model-f16.gguf filter=lfs diff=lfs merge=lfs -text
AUTODROID_MIRROR.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # AutoDroid artifact mirror
2
+
3
+ This repository preserves selected, unmodified files from `openbmb/MiniCPM-V-4.6-gguf` at commit `78e02f066e9819a60573b78a4275df8a0c27f698`.
4
+
5
+ Original authorship, licenses, and notices remain applicable. This is an independent availability mirror and does not imply upstream endorsement.
6
+
7
+ See `AUTODROID_SOURCE.json` for original paths, byte sizes, and SHA-256 digests. Only files required by AutoDroid and upstream documentation are included; this is not a complete training or Transformers checkpoint.
AUTODROID_SOURCE.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "sourceRepository": "openbmb/MiniCPM-V-4.6-gguf",
3
+ "sourceRevision": "78e02f066e9819a60573b78a4275df8a0c27f698",
4
+ "purpose": "Unmodified pinned artifacts used by AutoDroid",
5
+ "licenseReview": {
6
+ "sourceRevision": "78e02f066e9819a60573b78a4275df8a0c27f698",
7
+ "declaredLicense": "apache-2.0",
8
+ "evidence": "https://huggingface.co/openbmb/MiniCPM-V-4.6-gguf/blob/78e02f066e9819a60573b78a4275df8a0c27f698/README.md",
9
+ "status": "approved",
10
+ "reason": "Pinned upstream card permits redistribution. Preserve upstream cards and notices, original authorship, and the applicable license texts; artifact bytes are unmodified.",
11
+ "additionalFiles": [
12
+ {
13
+ "localPath": "tools/hf_mirror/licenses/Apache-2.0.txt",
14
+ "pathInRepo": "licenses/Apache-2.0.txt",
15
+ "source": "https://www.apache.org/licenses/LICENSE-2.0.txt",
16
+ "sha256": "c98068a3b6a564e4c70ab7c2ee2c980725987908909e99915759efa28ac7b533"
17
+ }
18
+ ]
19
+ },
20
+ "artifacts": [
21
+ {
22
+ "repo": "openbmb/MiniCPM-V-4.6-gguf",
23
+ "revision": "78e02f066e9819a60573b78a4275df8a0c27f698",
24
+ "filename": "MiniCPM-V-4_6-Q4_K_M.gguf",
25
+ "sizeBytes": 529101504,
26
+ "sha256": "6b0c74962c44bc6bf4b655b9b02c13eda9d5a0491543ae976d1ac18e4b7892e2",
27
+ "source": "app/src/main/java/com/example/autodroid/data/chat/model/ChatLocalModelCatalog.kt:141"
28
+ },
29
+ {
30
+ "repo": "openbmb/MiniCPM-V-4.6-gguf",
31
+ "revision": "78e02f066e9819a60573b78a4275df8a0c27f698",
32
+ "filename": "mmproj-model-f16.gguf",
33
+ "sizeBytes": 1108746944,
34
+ "sha256": "ca931d861d0801d9003e50697cd764721a334107c0e0415a51168ee1938462de",
35
+ "source": "app/src/main/java/com/example/autodroid/data/chat/model/ChatLocalModelCatalog.kt:149"
36
+ }
37
+ ],
38
+ "preservedDocuments": [
39
+ "README.md"
40
+ ]
41
+ }
MiniCPM-V-4_6-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b0c74962c44bc6bf4b655b9b02c13eda9d5a0491543ae976d1ac18e4b7892e2
3
+ size 529101504
README.md ADDED
@@ -0,0 +1,509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: image-text-to-text
4
+ tags:
5
+ - minicpm-v
6
+ - multimodal
7
+ - On-Device Model
8
+ - lightweight
9
+ library_name: transformers
10
+ base_model: openbmb/MiniCPM-V-4.6
11
+ base_model_relation: quantized
12
+ ---
13
+
14
+ > **This repository hosts the GGUF (llama.cpp) quantized version of [MiniCPM-V 4.6](https://huggingface.co/openbmb/MiniCPM-V-4.6).** For the original BF16 weights and the full model card, please refer to [openbmb/MiniCPM-V-4.6](https://huggingface.co/openbmb/MiniCPM-V-4.6).
15
+
16
+ A Pocket-Sized MLLM for Ultra-Efficient Image and Video Understanding on Your Phone
17
+
18
+ [GitHub](https://github.com/OpenBMB/MiniCPM-o) | [CookBook](https://github.com/OpenSQZ/MiniCPM-V-CookBook) | [Demo](https://huggingface.co/spaces/openbmb/MiniCPM-V-4.6-Demo) |
19
+ [Feishu (Lark)](https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/feishu_qrcode.png)
20
+
21
+ ## News
22
+
23
+ * [2026.05.17] ⭐️⭐️⭐️ We release the API service of MiniCPM-V 4.6, with a **public free API key** together! Try [it](https://github.com/OpenBMB/MiniCPM-V/blob/main/docs/api.md) now.
24
+
25
+
26
+
27
+ ## MiniCPM-V 4.6
28
+
29
+ **MiniCPM-V 4.6** is our most edge-deployment-friendly model to date. The model is built based on SigLIP2-400M and the Qwen3.5-0.8B LLM. It inherits the strong single-image, multi-image, and video understanding capabilities of MiniCPM-V family, while significantly improving computation efficiency. It also introduces mixed 4x/16x visual token compression. Notable features of MiniCPM-V 4.6 include:
30
+
31
+ - 🔥 **Leading Foundation Capability.**
32
+ MiniCPM-V 4.6 scores 13 on the Artificial Analysis Intelligence Index benchmark, outperforming Qwen3.5-0.8B's score of 10 with 19x fewer token cost, and Qwen3.5-0.8B-Thinking's score of 11 with 43x fewer token cost. It also surpasses the larger Ministral 3 3B (score of 11).
33
+
34
+ - 💪 **Strong Multimodal Capability.**
35
+ MiniCPM-V 4.6 outperforms Qwen3.5-0.8B on most vision-language understanding tasks, and reaches Qwen3.5 2B-level capability on many benchmarks including OpenCompass, RefCOCO, HallusionBench, MUIRBench, and OCRBench.
36
+ - 🚀 **Ultra-Efficient Architecture.**
37
+ Based on the latest technique in [LLaVA-UHD v4](https://github.com/THUMAI-Lab/LLaVA-UHD-v4), MiniCPM-V 4.6 reduces the visual encoding computation FLOPs by more than 50%. It enables MiniCPM-V 4.6 to achieve better efficiency to even smaller models, achieving ~1.5x token throughput compared to Qwen3.5-0.8B.
38
+ It also supports mixed 4x/16x visual token compression rate, allowing flexible switching between accuracy and speed.
39
+ - 📱 **Broad Mobile Platform Coverage.**
40
+ MiniCPM-V 4.6 can be deployed across all three mainstream mobile platforms — iOS, Android, and HarmonyOS. With every edge adaptation code open-sourced, developers can reproduce the on-device experience in [just a few steps](#deploy-minicpm-v-46-on-ios-android-and-harmonyos-platforms).
41
+ - 🛠️ **Developer Friendly.**
42
+ MiniCPM-V 4.6 is adapted to [inference frameworks](#inference-and-training) such as vLLM, SGLang, llama.cpp, Ollama, and supports [fine-tuning ecosystems](#inference-and-training) such as SWIFT and LLaMA-Factory. Developers can quickly customize models for new domains and tasks on consumer-grade GPUs. We provide multiple quantized variants across GGUF, BNB, AWQ, and GPTQ formats.
43
+
44
+
45
+ ### Evaluation <!-- omit in toc -->
46
+
47
+ **Overall Performance (Instruct)**
48
+
49
+ <p align="center">
50
+ <img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/instruct.png" width="90%"></img>
51
+ </p>
52
+
53
+
54
+ <details>
55
+ <summary>Click to view MiniCPM-V 4.6-Thinking performance.</summary>
56
+
57
+
58
+ <p align="center">
59
+ <img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/thinking.png" width="90%"></img>
60
+ </p>
61
+
62
+
63
+ </details>
64
+
65
+
66
+ <details>
67
+ <summary>Click to view MiniCPM-V 4.6 inference efficiency results.</summary>
68
+
69
+
70
+ **High-Concurrency Throughput**
71
+
72
+ <p align="center">
73
+ <img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/throughput.png" width="60%"></img>
74
+ </p>
75
+
76
+ **Single Request TTFT (ms)**
77
+
78
+ <p align="center">
79
+ <img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/ttft.png" width="60%"></img>
80
+ </p>
81
+
82
+
83
+ </details>
84
+
85
+
86
+ ### Examples <!-- omit in toc -->
87
+
88
+ #### Overall
89
+
90
+ <div align="center">
91
+ <a href="https://www.youtube.com/watch?v=Ch5UG1FoysM"><img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/video_play.png" width="70%"></a>
92
+ </div>
93
+
94
+ MiniCPM-V 4.6 can be deployed across three mainstream end-side platforms — **iOS, Android and HarmonyOS**. The clips below are raw screen recordings on phone devices without edition.
95
+
96
+ <table align="center">
97
+ <tr>
98
+ <td align="center"><b>iPhone</b><br><sub>iPhone 17 Pro Max</sub></td>
99
+ <td align="center"><b>Android</b><br><sub>Redmi K70</sub></td>
100
+ <td align="center"><b>HarmonyOS</b><br><sub>HUAWEI nova 14</sub></td>
101
+ </tr>
102
+ <tr>
103
+ <td align="center"><img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/v46_iphone_en_handwriting.gif" width="100%"/></td>
104
+ <td align="center"><img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/v46_android_en_refraction.gif" width="100%"/></td>
105
+ <td align="center"><img src="https://raw.githubusercontent.com/openbmb/MiniCPM-V/main/assets/minicpmv4.6/v46_harmonyos_en_ticket.gif" width="100%"/></td>
106
+ </tr>
107
+ </table>
108
+
109
+
110
+ ### Usages
111
+
112
+ #### Inference with Transformers <!-- omit in toc -->
113
+ ##### Installation <!-- omit in toc -->
114
+
115
+ ```bash
116
+ pip install "transformers[torch]>=5.7.0" torchvision torchcodec
117
+ ```
118
+
119
+ > **Note on CUDA compatibility:** `torchcodec` (used for video decoding) may have compatibility issues with certain CUDA versions. For example, `torch>=2.11` bundles CUDA 13.1 by default, while environments with CUDA 12.x may encounter errors such as `RuntimeError: Could not load libtorchcodec`. Two workarounds:
120
+ >
121
+ > 1. **Replace `torchcodec` with `PyAV`** — supports both image and video inference without CUDA version constraints:
122
+ > ```bash
123
+ > pip install "transformers[torch]>=5.7.0" torchvision av
124
+ > ```
125
+ > 2. **Pin the CUDA version** when installing torch to match your environment (e.g. CUDA 12.8):
126
+ > ```bash
127
+ > pip install "transformers>=5.7.0" torchvision torchcodec --index-url https://download.pytorch.org/whl/cu128
128
+ > ```
129
+
130
+ ##### Load Model <!-- omit in toc -->
131
+
132
+ ```python
133
+ from transformers import AutoModelForImageTextToText, AutoProcessor
134
+
135
+ model_id = "openbmb/MiniCPM-V-4.6"
136
+
137
+ processor = AutoProcessor.from_pretrained(model_id)
138
+ model = AutoModelForImageTextToText.from_pretrained(
139
+ model_id, torch_dtype="auto", device_map="auto"
140
+ )
141
+
142
+ # Flash Attention 2 is recommended for better acceleration and memory saving,
143
+ # especially in multi-image and video scenarios.
144
+ # model = AutoModelForImageTextToText.from_pretrained(
145
+ # model_id,
146
+ # torch_dtype=torch.bfloat16,
147
+ # attn_implementation="flash_attention_2",
148
+ # device_map="auto",
149
+ # )
150
+ ```
151
+
152
+ ##### Image Inference <!-- omit in toc -->
153
+
154
+ ```python
155
+ messages = [
156
+ {
157
+ "role": "user",
158
+ "content": [
159
+ {"type": "image", "url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"},
160
+ {"type": "text", "text": "What causes this phenomenon?"},
161
+ ],
162
+ }
163
+ ]
164
+
165
+ downsample_mode = "16x" # Using `downsample_mode="4x"` for Finer Detail
166
+
167
+ inputs = processor.apply_chat_template(
168
+ messages, tokenize=True, add_generation_prompt=True,
169
+ return_dict=True, return_tensors="pt",
170
+ downsample_mode=downsample_mode,
171
+ max_slice_nums=36,
172
+ ).to(model.device)
173
+
174
+ generated_ids = model.generate(**inputs, downsample_mode=downsample_mode, max_new_tokens=512)
175
+ generated_ids_trimmed = [
176
+ out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
177
+ ]
178
+ output_text = processor.batch_decode(
179
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
180
+ )
181
+ print(output_text[0])
182
+ ```
183
+
184
+ ##### Video Inference <!-- omit in toc -->
185
+
186
+ ```python
187
+ messages = [
188
+ {
189
+ "role": "user",
190
+ "content": [
191
+ {"type": "video", "url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/football.mp4"},
192
+ {"type": "text", "text": "Describe this video in detail. Follow the timeline and focus on on-screen text, interface changes, main actions, and scene changes."},
193
+ ],
194
+ }
195
+ ]
196
+
197
+ downsample_mode = "16x" # Using `downsample_mode="4x"` for Finer Detail
198
+
199
+ inputs = processor.apply_chat_template(
200
+ messages, tokenize=True, add_generation_prompt=True,
201
+ return_dict=True, return_tensors="pt",
202
+ downsample_mode=downsample_mode,
203
+ max_num_frames=128,
204
+ stack_frames=1,
205
+ max_slice_nums=1,
206
+ use_image_id=False,
207
+ ).to(model.device)
208
+
209
+ generated_ids = model.generate(**inputs, downsample_mode=downsample_mode, max_new_tokens=2048)
210
+ generated_ids_trimmed = [
211
+ out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
212
+ ]
213
+ output_text = processor.batch_decode(
214
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
215
+ )
216
+ print(output_text[0])
217
+ ```
218
+
219
+ ##### Advanced Parameters <!-- omit in toc -->
220
+
221
+ You can customize image/video processing by passing additional parameters to `apply_chat_template`:
222
+
223
+ | Parameter | Default | Applies to | Description |
224
+ |-----------|---------|------------|-------------|
225
+ | `downsample_mode` | `"16x"` | Image & Video | Visual token downsampling. `"16x"` merges tokens for efficiency; `"4x"` keeps 4× more tokens for finer detail. Must also be passed to `generate()`. |
226
+ | `max_slice_nums` | `9` | Image & Video | Maximum number of slices when splitting a high-resolution image. Higher values preserve more detail for large images. Recommended: `36` for image, `1` for video. |
227
+ | `max_num_frames` | `128` | Video only | The `max_num_frames` parameter dynamically controls the temporal context length and prevents VRAM overflow: <br> **Short Videos** (duration ≤ `max_num_frames` sec): The processor defaults to **1 FPS**, capturing second-by-second details without hitting the upper limit. <br> **Long Videos** (duration > `max_num_frames` sec): The processor automatically switches to **uniform sampling**, selecting exactly `max_num_frames` evenly spaced across the entire timeline. |
228
+ | `stack_frames` | `1` | Video only | Total sample points per second. `1` = main frame only (no stacking). `N` (N>1) = 1 main frame + N−1 sub-frames per second; the sub-frames are composited into a grid image and interleaved with main frames. Recommended setting is `1` for short videos, and `3` or `5` for long videos. |
229
+ | `use_image_id` | `True` | Image & Video | Whether to prepend `<image_id>N</image_id>` tags before each image/frame placeholder. Set `True` for image, `False` for video. |
230
+
231
+ > **Note:** `downsample_mode` must be passed to **both** `apply_chat_template` (for correct placeholder count) and `generate` (for the vision encoder). All other parameters only need to be passed to `apply_chat_template`.
232
+
233
+ ##### Serving with `transformers serve` <!-- omit in toc -->
234
+
235
+ Hugging Face Transformers includes a lightweight OpenAI-compatible server for quick testing and moderate-load deployment.
236
+
237
+ ```bash
238
+ pip install "transformers[serving]>=5.7.0"
239
+ ```
240
+
241
+ Start the server:
242
+
243
+ ```bash
244
+ transformers serve openbmb/MiniCPM-V-4.6 --port 8000 --host 0.0.0.0 --continuous-batching
245
+ ```
246
+
247
+ Send a request:
248
+
249
+ ```bash
250
+ curl -s http://localhost:8000/v1/chat/completions \
251
+ -H 'Content-Type: application/json' \
252
+ -d '{
253
+ "model": "openbmb/MiniCPM-V-4.6",
254
+ "messages": [{
255
+ "role": "user",
256
+ "content": [
257
+ {"type": "image_url", "image_url": {"url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"}},
258
+ {"type": "text", "text": "What causes this phenomenon?"}
259
+ ]
260
+ }]
261
+ }'
262
+ ```
263
+
264
+ Tool calling example:
265
+
266
+ ```bash
267
+ curl -s http://localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
268
+ "model": "openbmb/MiniCPM-V-4.6",
269
+ "messages": [{"role": "user", "content": [
270
+ {"type": "text", "text": "the weather of Beijing"}
271
+ ]}],
272
+ "tools": [{
273
+ "type": "function",
274
+ "function": {
275
+ "name": "get_weather",
276
+ "description": "Get the current weather for a given location",
277
+ "parameters": {
278
+ "type": "object",
279
+ "properties": {
280
+ "location": {"type": "string", "description": "City name"}
281
+ },
282
+ "required": ["location"]
283
+ }
284
+ }
285
+ }]
286
+ }'
287
+ ```
288
+
289
+ The model returns a natural-language explanation followed by a structured <tool_call> block embedded in the content field. Note that a dedicated tool call parser for this format has not yet been added to the transformers library, so the tool calls need to be extracted manually via regex for now.
290
+
291
+ ```
292
+ {
293
+ "id": "f4f09c7d-8045-4cb1-ade9-07aa5dee637d",
294
+ "choices": [
295
+ {
296
+ "finish_reason": "stop",
297
+ "index": 0,
298
+ "message": {
299
+ "content": "I need to check the current weather for Beijing, so I will call the get_weather function.\n\n<tool_call>\n<function=get_weather>\n<parameter=location>\nBeijing\n</parameter>\n</function>\n</tool_call>",
300
+ "role": "assistant"
301
+ }
302
+ }
303
+ ],
304
+ "created": 1778748859,
305
+ "model": "openbmb/MiniCPM-V-4.6@main",
306
+ "object": "chat.completion",
307
+ "usage": {
308
+ "completion_tokens": 47,
309
+ "prompt_tokens": 283,
310
+ "total_tokens": 330
311
+ }
312
+ }
313
+ ```
314
+
315
+ #### Handling Escaped Newlines in Model Outputs <!-- omit in toc -->
316
+
317
+ In some cases, the model might output escaped newline characters `\n` as string literals instead of actual newlines. To render the text correctly, especially in UI layers, you can use the following utility function. This function carefully replaces literal `\n` with real newlines while protecting scenarios where `\n` has specific semantic meaning.
318
+
319
+ **Utility Function:**
320
+
321
+ ```python
322
+ import re
323
+
324
+ _PATTERN = re.compile(
325
+ r'(```[\s\S]*?```' # fenced code blocks
326
+ r'|`[^`]+`' # inline code
327
+ r'|\$\$[\s\S]*?\$\$' # display math
328
+ r'|\$[^$]+\$' # inline math
329
+ r'|\\\([\s\S]*?\\\)' # \(...\)
330
+ r'|\\\[[\s\S]*?\\\]' # \[...\]
331
+ r')'
332
+ r'|(?<!\\)(?:\\r\\n|\\[nr])'
333
+ )
334
+
335
+ def normalize_response_text(text: str) -> str:
336
+ """
337
+ Lightweight post-processing: Converts literal '\\n' to actual newlines,
338
+ while protecting code blocks, inline code, and LaTeX commands.
339
+ """
340
+ if not isinstance(text, str) or "\\" not in text:
341
+ return text
342
+ return _PATTERN.sub(lambda m: m.group(1) or '\n', text)
343
+ ```
344
+
345
+ #### Deploy MiniCPM-V 4.6 on iOS, Android, and HarmonyOS Platforms <!-- omit in toc -->
346
+
347
+ We have adapted MiniCPM-V 4.6 for deployment on **iOS, Android, and HarmonyOS** platforms, with **all edge adaptation code fully open-sourced**. Developers can reproduce the on-device experience in just a few steps. Visit our [edge deployment repository](https://github.com/OpenBMB/MiniCPM-V-edge-demo) for platform-specific build guides, or go to the [download page](https://github.com/OpenBMB/MiniCPM-V-edge-demo/blob/main/DOWNLOAD.md) to try pre-built apps directly.
348
+
349
+ <a id="inference-and-training"></a>
350
+ #### Use MiniCPM-V 4.6 in Other Inference and Training Frameworks <!-- omit in toc -->
351
+
352
+ MiniCPM-V 4.6 supports multiple inference and training frameworks. Below are quick-start commands for each. For full details, see our [Cookbook](https://github.com/OpenSQZ/MiniCPM-V-CookBook).
353
+
354
+ <details>
355
+ <summary><b>vLLM</b> — <a href="https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/deployment/vllm/minicpm-v4_6_vllm.md">Full Guide</a></summary>
356
+
357
+ ```bash
358
+ vllm serve openbmb/MiniCPM-V-4.6 \
359
+ --port 8000 \
360
+ --enable-auto-tool-choice \
361
+ --tool-call-parser qwen3_coder \
362
+ --default-chat-template-kwargs '{"enable_thinking": false}'
363
+ ```
364
+
365
+ > **Note:** `--enable-auto-tool-choice` and `--tool-call-parser qwen3_coder` enable tool/function calling support. If you don't need tool use, you can omit these flags and simply run `vllm serve openbmb/MiniCPM-V-4.6`.
366
+
367
+ ```bash
368
+ curl -s http://localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
369
+ "model": "openbmb/MiniCPM-V-4.6",
370
+ "messages": [{"role": "user", "content": [
371
+ {"type": "image_url", "image_url": {"url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"}},
372
+ {"type": "text", "text": "What causes this phenomenon?"}
373
+ ]}]
374
+ }'
375
+ ```
376
+
377
+
378
+ Tool calling example:
379
+
380
+ ```bash
381
+ curl -s http://localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
382
+ "model": "openbmb/MiniCPM-V-4.6",
383
+ "messages": [{"role": "user", "content": [
384
+ {"type": "text", "text": "北京的天气"}
385
+ ]}],
386
+ "tools": [{
387
+ "type": "function",
388
+ "function": {
389
+ "name": "get_weather",
390
+ "description": "Get the current weather for a given location",
391
+ "parameters": {
392
+ "type": "object",
393
+ "properties": {
394
+ "location": {"type": "string", "description": "City name"}
395
+ },
396
+ "required": ["location"]
397
+ }
398
+ }
399
+ }]
400
+ }'
401
+ ```
402
+
403
+ </details>
404
+
405
+ <details>
406
+ <summary><b>SGLang</b> — <a href="https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/deployment/sglang/minicpm-v4_6_sglang.md">Full Guide</a></summary>
407
+
408
+ ```bash
409
+ python -m sglang.launch_server --model openbmb/MiniCPM-V-4.6 --port 30000
410
+ ```
411
+
412
+ ```bash
413
+ curl -s http://localhost:30000/v1/chat/completions -H 'Content-Type: application/json' -d '{
414
+ "model": "openbmb/MiniCPM-V-4.6",
415
+ "messages": [{"role": "user", "content": [
416
+ {"type": "image_url", "image_url": {"url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"}},
417
+ {"type": "text", "text": "What causes this phenomenon?"}
418
+ ]}]
419
+ }'
420
+ ```
421
+
422
+ </details>
423
+
424
+ <details>
425
+ <summary><b>llama.cpp</b> — <a href="https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/deployment/llama.cpp/minicpm-v4_6_llamacpp.md">Full Guide</a></summary>
426
+
427
+ ```bash
428
+ llama-server -m MiniCPM-V-4.6-Q4_K_M.gguf --port 8080
429
+ ```
430
+
431
+ ```bash
432
+ curl -s http://localhost:8080/v1/chat/completions -H 'Content-Type: application/json' -d '{
433
+ "model": "MiniCPM-V-4.6",
434
+ "messages": [{"role": "user", "content": [
435
+ {"type": "image_url", "image_url": {"url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"}},
436
+ {"type": "text", "text": "What causes this phenomenon?"}
437
+ ]}]
438
+ }'
439
+ ```
440
+
441
+ </details>
442
+
443
+ <details>
444
+ <summary><b>Ollama</b> — <a href="https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/deployment/ollama/minicpm-v4_6_ollama.md">Full Guide</a></summary>
445
+
446
+ ```bash
447
+ ollama run minicpm-v-4.6
448
+ ```
449
+
450
+ In the interactive session, paste an image path or URL directly to chat with the model.
451
+
452
+ </details>
453
+
454
+ <details>
455
+ <summary><b>LLaMA-Factory</b> (Fine-tuning) — <a href="https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/finetune/llamafactory_minicpmv46.md">Full Guide</a></summary>
456
+
457
+ ```bash
458
+ llamafactory-cli train examples/train_lora/minicpmv4_6_lora_sft.yaml
459
+ ```
460
+
461
+ </details>
462
+
463
+ <details>
464
+ <summary><b>ms-swift</b> (Fine-tuning) — <a href="https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/finetune/swift_minicpmv46.md">Full Guide</a></summary>
465
+
466
+ ```bash
467
+ swift sft --model_type minicpm-v-4_6 --dataset <your-dataset>
468
+ ```
469
+
470
+ </details>
471
+
472
+ ## License
473
+
474
+ #### Model License
475
+ * The MiniCPM-o/V model weights and code are open-sourced under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM-V/blob/main/LICENSE) license.
476
+
477
+ #### Statement
478
+ * As MLLMs, MiniCPM-o/V models generate content by learning a large number of multimodal corpora, but they cannot comprehend, express personal opinions, or make value judgements. Anything generated by MiniCPM-o/V models does not represent the views and positions of the model developers
479
+ * We will not be liable for any problems arising from the use of MiniCPM-o/V models, 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.
480
+
481
+
482
+ ## Technical Reports and Key Techniques Papers
483
+
484
+ 👏 Welcome to explore key techniques of MiniCPM-o/V and other multimodal projects of our team:
485
+
486
+ **Technical Reports:** [MiniCPM-o 4.5](https://huggingface.co/papers/2604.27393) | [MiniCPM-V 4.5](https://arxiv.org/abs/2509.18154) | [MiniCPM-o 2.6](https://openbmb.notion.site/MiniCPM-o-2-6-A-GPT-4o-Level-MLLM-for-Vision-Speech-and-Multimodal-Live-Streaming-on-Your-Phone-185ede1b7a558042b5d5e45e6b237da9) | [MiniCPM-Llama3-V 2.5](https://arxiv.org/abs/2408.01800) | [MiniCPM-V 2.0](https://openbmb.vercel.app/minicpm-v-2)
487
+
488
+ **Other Multimodal Projects:** [VisCPM](https://github.com/OpenBMB/VisCPM/tree/main) | [RLPR](https://github.com/OpenBMB/RLPR) | [RLHF-V](https://github.com/RLHF-V/RLHF-V) | [LLaVA-UHD](https://github.com/thunlp/LLaVA-UHD) | [RLAIF-V](https://github.com/RLHF-V/RLAIF-V) | [LLaVA-UHD-v4](https://arxiv.org/abs/2605.08985 )
489
+
490
+
491
+ ## Citation <!-- omit in toc -->
492
+
493
+ If you find our model/code/paper helpful, please consider citing our papers 📝 and staring us ⭐️!
494
+
495
+ ```bib
496
+ @proceedings{yu2025minicpmv45cookingefficient,
497
+ title={MiniCPM-V 4.5: Cooking Efficient MLLMs via Architecture, Data, and Training Recipe},
498
+ author={Tianyu Yu and Zefan Wang and Chongyi Wang and Fuwei Huang and Wenshuo Ma and Zhihui He and Tianchi Cai and Weize Chen and Yuxiang Huang and Yuanqian Zhao and others},
499
+ year={2025},
500
+ url={https://arxiv.org/abs/2509.18154},
501
+ }
502
+
503
+ @article{yao2024minicpm,
504
+ title={MiniCPM-V: A GPT-4V Level MLLM on Your Phone},
505
+ author={Yao, Yuan and Yu, Tianyu and Zhang, Ao and Wang, Chongyi and Cui, Junbo and Zhu, Hongji and Cai, Tianchi and Li, Haoyu and Zhao, Weilin and He, Zhihui and others},
506
+ journal={arXiv preprint arXiv:2408.01800},
507
+ year={2024}
508
+ }
509
+ ```
licenses/Apache-2.0.txt ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work.
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form,
39
+ that is based on (or derived from) the Work and for which the editorial
40
+ revisions, annotations, elaborations, or other modifications represent, as a
41
+ whole, an original work of authorship. Derivative Works shall not include
42
+ works that remain separable from, or merely link (or bind by name) to the
43
+ interfaces of, the Work and Derivative Works thereof.
44
+
45
+ "Contribution" shall mean any work of authorship, including the original
46
+ version of the Work and any modifications or additions to that Work or
47
+ Derivative Works thereof, that is intentionally submitted to Licensor for
48
+ inclusion in the Work by the copyright owner or by an individual or Legal
49
+ Entity authorized to submit on behalf of the copyright owner. "Submitted"
50
+ means any form of electronic, verbal, or written communication sent to the
51
+ Licensor or its representatives, excluding communication conspicuously marked
52
+ or otherwise designated in writing by the copyright owner as "Not a
53
+ Contribution."
54
+
55
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
56
+ behalf of whom a Contribution has been received by Licensor and subsequently
57
+ incorporated within the Work.
58
+
59
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
60
+ License, each Contributor hereby grants to You a perpetual, worldwide,
61
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
62
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
63
+ sublicense, and distribute the Work and such Derivative Works in Source or
64
+ Object form.
65
+
66
+ 3. Grant of Patent License. Subject to the terms and conditions of this
67
+ License, each Contributor hereby grants to You a perpetual, worldwide,
68
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
69
+ section) patent license to make, have made, use, offer to sell, sell, import,
70
+ and otherwise transfer the Work, where such license applies only to those
71
+ patent claims licensable by such Contributor that are necessarily infringed
72
+ by their Contribution(s) alone or by combination of their Contribution(s)
73
+ with the Work to which such Contribution(s) was submitted. If You institute
74
+ patent litigation against any entity alleging that the Work or a Contribution
75
+ incorporated within the Work constitutes direct or contributory patent
76
+ infringement, then any patent licenses granted to You under this License for
77
+ that Work shall terminate as of the date such litigation is filed.
78
+
79
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
80
+ Derivative Works thereof in any medium, with or without modifications, and in
81
+ Source or Object form, provided that You meet the following conditions:
82
+
83
+ (a) You must give any other recipients of the Work or Derivative Works a copy
84
+ of this License; and
85
+
86
+ (b) You must cause any modified files to carry prominent notices stating that
87
+ You changed the files; and
88
+
89
+ (c) You must retain, in the Source form of any Derivative Works that You
90
+ distribute, all copyright, patent, trademark, and attribution notices from the
91
+ Source form of the Work, excluding those notices that do not pertain to any
92
+ part of the Derivative Works; and
93
+
94
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
95
+ then any Derivative Works that You distribute must include a readable copy of
96
+ the attribution notices contained within such NOTICE file, excluding those
97
+ notices that do not pertain to any part of the Derivative Works, in at least
98
+ one of the following places: within a NOTICE text file distributed as part of
99
+ the Derivative Works; within the Source form or documentation, if provided;
100
+ or, within a display generated by the Derivative Works, if and wherever such
101
+ third-party notices normally appear. The contents of the NOTICE file are for
102
+ informational purposes only and do not modify the License.
103
+
104
+ You may add Your own copyright statement to Your modifications and may
105
+ provide additional or different license terms and conditions for use,
106
+ reproduction, or distribution of Your modifications, provided that Your use,
107
+ reproduction, and distribution of the Work otherwise complies with the
108
+ conditions stated in this License.
109
+
110
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
111
+ Contribution intentionally submitted for inclusion in the Work by You to the
112
+ Licensor shall be under the terms and conditions of this License, without any
113
+ additional terms or conditions.
114
+
115
+ 6. Trademarks. This License does not grant permission to use the trade names,
116
+ trademarks, service marks, or product names of the Licensor, except as
117
+ required for reasonable and customary use in describing the origin of the
118
+ Work and reproducing the content of the NOTICE file.
119
+
120
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
121
+ writing, Licensor provides the Work (and each Contributor provides its
122
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
123
+ KIND, either express or implied, including, without limitation, any warranties
124
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
125
+ PARTICULAR PURPOSE. You are solely responsible for determining the
126
+ appropriateness of using or redistributing the Work and assume any risks
127
+ associated with Your exercise of permissions under this License.
128
+
129
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
130
+ tort (including negligence), contract, or otherwise, unless required by
131
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
132
+ writing, shall any Contributor be liable to You for damages, including any
133
+ direct, indirect, special, incidental, or consequential damages arising as a
134
+ result of this License or out of the use or inability to use the Work, even if
135
+ such Contributor has been advised of the possibility of such damages.
136
+
137
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work
138
+ or Derivative Works thereof, You may choose to offer, and charge a fee for,
139
+ acceptance of support, warranty, indemnity, or other liability obligations
140
+ and/or rights consistent with this License. However, in accepting such
141
+ obligations, You may act only on Your own behalf and on Your sole
142
+ responsibility, not on behalf of any other Contributor, and only if You agree
143
+ to indemnify, defend, and hold each Contributor harmless for any liability
144
+ incurred by, or claims asserted against, such Contributor by reason of your
145
+ accepting any such warranty or additional liability.
146
+
147
+ END OF TERMS AND CONDITIONS
148
+
149
+ APPENDIX: How to apply the Apache License to your work.
150
+
151
+ To apply the Apache License to your work, attach the following boilerplate
152
+ notice, with the fields enclosed by brackets "[]" replaced with your own
153
+ identifying information. (Don't include the brackets!) The text should be
154
+ enclosed in the appropriate comment syntax for the file format. We also
155
+ recommend that a file or class name and description of purpose be included on
156
+ the same "printed page" as the copyright notice for easier identification
157
+ within third-party archives.
158
+
159
+ Copyright [yyyy] [name of copyright owner]
160
+
161
+ Licensed under the Apache License, Version 2.0 (the "License");
162
+ you may not use this file except in compliance with the License.
163
+ You may obtain a copy of the License at
164
+
165
+ http://www.apache.org/licenses/LICENSE-2.0
166
+
167
+ Unless required by applicable law or agreed to in writing, software
168
+ distributed under the License is distributed on an "AS IS" BASIS,
169
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
170
+ See the License for the specific language governing permissions and
171
+ limitations under the License.
mmproj-model-f16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca931d861d0801d9003e50697cd764721a334107c0e0415a51168ee1938462de
3
+ size 1108746944