Image-Text-to-Text
Transformers
Safetensors
minicpmv4_7
minicpm-v
multimodal
On-Device Model
lightweight
conversational
Instructions to use openbmb/MiniCPM-V-4.7-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM-V-4.7-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="openbmb/MiniCPM-V-4.7-1B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("openbmb/MiniCPM-V-4.7-1B") model = AutoModelForMultimodalLM.from_pretrained("openbmb/MiniCPM-V-4.7-1B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM-V-4.7-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/MiniCPM-V-4.7-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-V-4.7-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/openbmb/MiniCPM-V-4.7-1B
- SGLang
How to use openbmb/MiniCPM-V-4.7-1B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "openbmb/MiniCPM-V-4.7-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-V-4.7-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "openbmb/MiniCPM-V-4.7-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-V-4.7-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use openbmb/MiniCPM-V-4.7-1B with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM-V-4.7-1B
add model card
Browse files- .gitattributes +8 -0
- README.md +291 -0
- minicpm_v4dot7_assets/minicpmv4.7/moe_speed_comparison_en.gif +3 -0
- minicpm_v4dot7_assets/minicpmv4.7/overall_performance_1b_instruct.png +3 -0
- minicpm_v4dot7_assets/minicpmv4.7/overall_performance_35ba3b_instruct.png +3 -0
- minicpm_v4dot7_assets/minicpmv4.7/overall_performance_35ba3b_language.png +3 -0
- minicpm_v4dot7_assets/minicpmv4.7/performance_efficiency_frontier.png +3 -0
- minicpm_v4dot7_assets/minicpmv4.7/v47_1b_iphone_en.gif +3 -0
- minicpm_v4dot7_assets/minicpmv4.7/v47_35ba3b_ipad_en.gif +3 -0
- minicpm_v4dot7_assets/minicpmv4.7/v47_35ba3b_iphone_en.gif +3 -0
- minicpm_v4dot7_assets/modelscope_logo.png +0 -0
.gitattributes
CHANGED
|
@@ -34,3 +34,11 @@ saved_model/**/* 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 |
tokenizer.json 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 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
minicpm_v4dot7_assets/minicpmv4.7/moe_speed_comparison_en.gif filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
minicpm_v4dot7_assets/minicpmv4.7/overall_performance_1b_instruct.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
minicpm_v4dot7_assets/minicpmv4.7/overall_performance_35ba3b_instruct.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
minicpm_v4dot7_assets/minicpmv4.7/overall_performance_35ba3b_language.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
minicpm_v4dot7_assets/minicpmv4.7/performance_efficiency_frontier.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
minicpm_v4dot7_assets/minicpmv4.7/v47_1b_iphone_en.gif filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
minicpm_v4dot7_assets/minicpmv4.7/v47_35ba3b_ipad_en.gif fil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V 4.7** is the latest model in the MiniCPM-V series, available in a **1B** variant. It builds on the family's single-image, multi-image, and video understanding capabilities, combining stronger foundation capabilities with efficient visual encoding and on-device inference. Notable features of MiniCPM-V 4.7 include:
|
| 8 |
+
|
| 9 |
+
- 🔥 **A New Pareto Frontier in Performance and Efficiency.**
|
| 10 |
+
As model capabilities continue to advance, inference efficiency has become an important measure of a model's value. On resource-constrained devices, delivering the strongest possible capabilities within a limited resource budget calls for higher capability density. The **1B** variant of MiniCPM-V 4.7 advances the performance–efficiency Pareto frontier for MLLMs. In Instruct mode, the 1B variant continues to improve foundation capabilities over MiniCPM-V 4.6 and **substantially outperforms Qwen3.5 0.8B in both overall score and inference efficiency**.
|
| 11 |
+
- 🚀 **Efficient Architecture.**
|
| 12 |
+
Based on the intra-ViT early compression technique from [LLaVA-UHD v4](https://github.com/THUMAI-Lab/LLaVA-UHD-v4), MiniCPM-V 4.7 compresses visual tokens early within the vision encoder, reducing computation in subsequent encoder layers. It also supports **mixed 4x/16x visual token compression**, allowing developers to balance visual detail and inference cost across tasks.
|
| 13 |
+
- 💻 **Broad Platform and Chip Support.**
|
| 14 |
+
MiniCPM-V 4.7 retains MiniCPM-V 4.6's support for **iOS, Android, and HarmonyOS**, together with open-source on-device deployment support. It also provides **day-0 support for chip platforms from Rockchip, Houmo, Intel, AMD, and Arm**, extending deployment options across mobile and local computing devices.
|
| 15 |
+
- 🛠️ **Developer Friendly.**
|
| 16 |
+
MiniCPM-V 4.7 supports [inference frameworks](./deployment_en.md#supported-inference-and-training-frameworks-and-api) including SGLang, vLLM, llama.cpp, and Ollama, along with [fine-tuning frameworks](./deployment_en.md#supported-inference-and-training-frameworks-and-api) including SWIFT and LLaMA-Factory. It provides GGUF, BNB, AWQ, and GPTQ quantized variants and adds **FP8 quantization support**. We also release **Self-Replay Fine-Tuning**, a fine-tuning approach that helps developers extend model capabilities at low cost while reducing forgetting of existing capabilities, making further customization easier.
|
| 17 |
+
|
| 18 |
+
### Evaluation
|
| 19 |
+
|
| 20 |
+
**Significantly Advancing the Performance–Efficiency Pareto Frontier**
|
| 21 |
+
|
| 22 |
+
The 1B variant of MiniCPM-V 4.7 advances the performance–efficiency Pareto frontier. In Instruct mode, 1B substantially outperforms Qwen3.5 0.8B in both overall score and inference efficiency.
|
| 23 |
+
|
| 24 |
+
<p align="center">
|
| 25 |
+
<a href="./minicpm_v4dot7_assets/minicpmv4.7/performance_efficiency_frontier.png"><img src="./minicpm_v4dot7_assets/minicpmv4.7/performance_efficiency_frontier.png" alt="Performance versus inference time for MiniCPM-V 4.7 1B" width="95%"></a>
|
| 26 |
+
</p>
|
| 27 |
+
|
| 28 |
+
**Overall Performance (1B, Instruct)**
|
| 29 |
+
|
| 30 |
+
<p align="center">
|
| 31 |
+
<a href="./minicpm_v4dot7_assets/minicpmv4.7/overall_performance_1b_instruct.png"><img src="./minicpm_v4dot7_assets/minicpmv4.7/overall_performance_1b_instruct.png" alt="Full performance comparison for MiniCPM-V 4.7 1B in Instruct mode" width="90%"></a>
|
| 32 |
+
</p>
|
| 33 |
+
|
| 34 |
+
### Examples
|
| 35 |
+
|
| 36 |
+
MiniCPM-V 4.7 can run on phones and tablets. The clips below are unedited screen recordings captured directly on the devices.
|
| 37 |
+
|
| 38 |
+
<table align="center">
|
| 39 |
+
<tr>
|
| 40 |
+
<td align="center"><b>1B</b><br><sub>iPhone</sub></td>
|
| 41 |
+
</tr>
|
| 42 |
+
<tr>
|
| 43 |
+
<td align="center"><img src="./minicpm_v4dot7_assets/minicpmv4.7/v47_1b_iphone_en.gif" height="520"/></td>
|
| 44 |
+
</tr>
|
| 45 |
+
</table>
|
| 46 |
+
|
| 47 |
+
### Usages
|
| 48 |
+
|
| 49 |
+
#### Inference with Transformers <!-- omit in toc -->
|
| 50 |
+
<details>
|
| 51 |
+
<summary>Click to expand the Transformers inference examples.</summary>
|
| 52 |
+
|
| 53 |
+
##### Installation <!-- omit in toc -->
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
pip install "transformers[torch]>=5.18.0" torchvision torchcodec
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
> **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:
|
| 60 |
+
>
|
| 61 |
+
> 1. **Replace `torchcodec` with `PyAV`** — supports both image and video inference without CUDA version constraints:
|
| 62 |
+
> ```bash
|
| 63 |
+
> pip install "transformers[torch]>=5.18.0" torchvision av
|
| 64 |
+
> ```
|
| 65 |
+
> 2. **Pin the CUDA version** when installing torch to match your environment (e.g. CUDA 12.8):
|
| 66 |
+
> ```bash
|
| 67 |
+
> pip install "transformers>=5.18.0" torchvision torchcodec --index-url https://download.pytorch.org/whl/cu128
|
| 68 |
+
> ```
|
| 69 |
+
|
| 70 |
+
##### Load the Model <!-- omit in toc -->
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
import torch
|
| 74 |
+
from transformers import AutoModelForImageTextToText, AutoProcessor
|
| 75 |
+
|
| 76 |
+
model_id = "openbmb/MiniCPM-V-4.7-1B"
|
| 77 |
+
|
| 78 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 79 |
+
model = AutoModelForImageTextToText.from_pretrained(
|
| 80 |
+
model_id, torch_dtype="auto", device_map="auto"
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
# Flash Attention 2 is recommended for faster inference and lower GPU memory usage,
|
| 84 |
+
# especially in multi-image and video scenarios.
|
| 85 |
+
# model = AutoModelForImageTextToText.from_pretrained(
|
| 86 |
+
# model_id,
|
| 87 |
+
# torch_dtype=torch.bfloat16,
|
| 88 |
+
# attn_implementation="flash_attention_2",
|
| 89 |
+
# device_map="auto",
|
| 90 |
+
# )
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
##### Image Inference <!-- omit in toc -->
|
| 94 |
+
|
| 95 |
+
```python
|
| 96 |
+
messages = [
|
| 97 |
+
{
|
| 98 |
+
"role": "user",
|
| 99 |
+
"content": [
|
| 100 |
+
{"type": "image", "url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"},
|
| 101 |
+
{"type": "text", "text": "What causes this phenomenon?"},
|
| 102 |
+
],
|
| 103 |
+
}
|
| 104 |
+
]
|
| 105 |
+
|
| 106 |
+
downsample_mode = "16x" # Using `downsample_mode="4x"` for Finer Detail
|
| 107 |
+
|
| 108 |
+
inputs = processor.apply_chat_template(
|
| 109 |
+
messages, tokenize=True, add_generation_prompt=True,
|
| 110 |
+
return_dict=True, return_tensors="pt",
|
| 111 |
+
downsample_mode=downsample_mode,
|
| 112 |
+
max_slice_nums=36,
|
| 113 |
+
enable_thinking=False,
|
| 114 |
+
).to(model.device)
|
| 115 |
+
|
| 116 |
+
generated_ids = model.generate(**inputs, downsample_mode=downsample_mode, max_new_tokens=512)
|
| 117 |
+
generated_ids_trimmed = [
|
| 118 |
+
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 119 |
+
]
|
| 120 |
+
output_text = processor.batch_decode(
|
| 121 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 122 |
+
)
|
| 123 |
+
print(output_text[0])
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
##### Video Inference <!-- omit in toc -->
|
| 127 |
+
|
| 128 |
+
```python
|
| 129 |
+
messages = [
|
| 130 |
+
{
|
| 131 |
+
"role": "user",
|
| 132 |
+
"content": [
|
| 133 |
+
{"type": "video", "url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/football.mp4"},
|
| 134 |
+
{"type": "text", "text": "Describe this video in detail. Follow the timeline and focus on on-screen text, interface changes, main actions, and scene changes."},
|
| 135 |
+
],
|
| 136 |
+
}
|
| 137 |
+
]
|
| 138 |
+
|
| 139 |
+
downsample_mode = "16x" # Using `downsample_mode="4x"` for Finer Detail
|
| 140 |
+
|
| 141 |
+
inputs = processor.apply_chat_template(
|
| 142 |
+
messages, tokenize=True, add_generation_prompt=True,
|
| 143 |
+
return_dict=True, return_tensors="pt",
|
| 144 |
+
downsample_mode=downsample_mode,
|
| 145 |
+
max_num_frames=128,
|
| 146 |
+
stack_frames=1,
|
| 147 |
+
max_slice_nums=1,
|
| 148 |
+
use_image_id=False,
|
| 149 |
+
enable_thinking=False,
|
| 150 |
+
).to(model.device)
|
| 151 |
+
|
| 152 |
+
generated_ids = model.generate(**inputs, downsample_mode=downsample_mode, max_new_tokens=2048)
|
| 153 |
+
generated_ids_trimmed = [
|
| 154 |
+
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 155 |
+
]
|
| 156 |
+
output_text = processor.batch_decode(
|
| 157 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 158 |
+
)
|
| 159 |
+
print(output_text[0])
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
##### Advanced Parameters <!-- omit in toc -->
|
| 163 |
+
|
| 164 |
+
You can customize image/video processing by passing additional parameters to `apply_chat_template`:
|
| 165 |
+
|
| 166 |
+
| Parameter | Default | Applies to | Description |
|
| 167 |
+
|-----------|---------|------------|-------------|
|
| 168 |
+
| `downsample_mode` | `"16x"` | Image & Video | Visual token downsampling. `"16x"` merges tokens for efficiency; `"4x"` keeps four times as many tokens for finer detail. **Must also be passed to `generate()`**. |
|
| 169 |
+
| `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. |
|
| 170 |
+
| `max_num_frames` | `128` | Video only | Maximum number of main frames sampled from the video. |
|
| 171 |
+
| `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: `3` or `5`. |
|
| 172 |
+
| `use_image_id` | `True` | Image & Video | Whether to prepend `<image_id>N</image_id>` tags before each image/frame placeholder. Recommended: `True` for image, `False` for video. |
|
| 173 |
+
|
| 174 |
+
> **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`.
|
| 175 |
+
|
| 176 |
+
##### Serving with `transformers serve` <!-- omit in toc -->
|
| 177 |
+
|
| 178 |
+
Hugging Face Transformers includes a lightweight OpenAI-compatible server for quick testing and moderate-load deployment.
|
| 179 |
+
|
| 180 |
+
```bash
|
| 181 |
+
pip install "transformers[serving]>=5.18.0"
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
Start the server:
|
| 185 |
+
|
| 186 |
+
```bash
|
| 187 |
+
transformers serve openbmb/MiniCPM-V-4.7-1B --port 8000 --host 0.0.0.0
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
Send a request:
|
| 191 |
+
|
| 192 |
+
```bash
|
| 193 |
+
curl -s http://localhost:8000/v1/chat/completions \
|
| 194 |
+
-H 'Content-Type: application/json' \
|
| 195 |
+
-d '{
|
| 196 |
+
"model": "openbmb/MiniCPM-V-4.7-1B",
|
| 197 |
+
"messages": [{
|
| 198 |
+
"role": "user",
|
| 199 |
+
"content": [
|
| 200 |
+
{"type": "image_url", "image_url": {"url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"}},
|
| 201 |
+
{"type": "text", "text": "What causes this phenomenon?"}
|
| 202 |
+
]
|
| 203 |
+
}]
|
| 204 |
+
}'
|
| 205 |
+
```
|
| 206 |
+
|
| 207 |
+
Tool calling example:
|
| 208 |
+
|
| 209 |
+
```bash
|
| 210 |
+
curl -s http://localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
|
| 211 |
+
"model": "openbmb/MiniCPM-V-4.7-1B",
|
| 212 |
+
"messages": [{"role": "user", "content": [
|
| 213 |
+
{"type": "text", "text": "the weather of Beijing"}
|
| 214 |
+
]}],
|
| 215 |
+
"tools": [{
|
| 216 |
+
"type": "function",
|
| 217 |
+
"function": {
|
| 218 |
+
"name": "get_weather",
|
| 219 |
+
"description": "Get the current weather for a given location",
|
| 220 |
+
"parameters": {
|
| 221 |
+
"type": "object",
|
| 222 |
+
"properties": {
|
| 223 |
+
"location": {"type": "string", "description": "City name"}
|
| 224 |
+
},
|
| 225 |
+
"required": ["location"]
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
}]
|
| 229 |
+
}'
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
</details>
|
| 233 |
+
|
| 234 |
+
#### Inference with OpenVINO™
|
| 235 |
+
|
| 236 |
+
[OpenVINO™](https://docs.openvino.ai) is an open-source toolkit for optimizing and deploying AI inference on Intel CPU/GPU/NPU platforms. OpenVINO provides day-0 support for MiniCPM-V-4.7 on Intel platforms with high-performance inference. See the [OpenVINO™ Toolkit](https://github.com/openvinotoolkit) to get started. You can install and run the example with this notebook (link TBD).
|
| 237 |
+
|
| 238 |
+
#### On-Device Deployment
|
| 239 |
+
|
| 240 |
+
MiniCPM-V 4.7 supports deployment on iOS, Android, and HarmonyOS, with day-0 support for Rockchip, Houmo, Intel, AMD, and Arm chip platforms. See the [edge deployment repository](https://github.com/OpenBMB/MiniCPM-V-Apps) for the apps and source code.
|
| 241 |
+
|
| 242 |
+
#### Inference and Fine-Tuning
|
| 243 |
+
|
| 244 |
+
For supported inference and training frameworks, see [Supported Inference and Training Frameworks and API](./deployment_en.md#supported-inference-and-training-frameworks-and-api). The [MiniCPM-V 4.7 Cookbook](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/docs/pages/v4.7/overview.md) covers deployment, fine-tuning, and quantization workflows.
|
| 245 |
+
|
| 246 |
+
**Task guides**
|
| 247 |
+
|
| 248 |
+
- [Single-image chat](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/inference/minicpm-v4_7_single_image.md)
|
| 249 |
+
- [Multi-image chat](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/inference/minicpm-v4_7_multi_images.md)
|
| 250 |
+
- [Video understanding](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/inference/minicpm-v4_7_video_understanding.md)
|
| 251 |
+
- [OCR](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/inference/minicpm-v4_7_ocr.md)
|
| 252 |
+
- [PDF parsing](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/inference/minicpm-v4_7_pdf_parse.md)
|
| 253 |
+
- [Visual grounding](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/inference/minicpm-v4_7_grounding.md)
|
| 254 |
+
|
| 255 |
+
**Quantization**
|
| 256 |
+
|
| 257 |
+
| Method | Guide |
|
| 258 |
+
|:---|:---|
|
| 259 |
+
| GGUF | [Quantization guide](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/quantization/gguf/minicpm-v4_7_gguf_quantize.md) |
|
| 260 |
+
| BNB | [Quantization guide](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/quantization/bnb/minicpm-v4_7_bnb_quantize.md) |
|
| 261 |
+
| AWQ | [Quantization guide](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/quantization/awq/minicpm-v4_7_awq_quantize.md) |
|
| 262 |
+
| GPTQ | [Quantization guide](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/quantization/gptq/minicpm-v4_7_gptq_quantize.md) |
|
| 263 |
+
| FP8 / INT4 | [Quantization guide](https://github.com/OpenSQZ/MiniCPM-V-CookBook/blob/main/quantization/llmcompressor/minicpm-v4_7_llmcompressor_quantize.md) |
|
| 264 |
+
|
| 265 |
+
### Acknowledgements
|
| 266 |
+
|
| 267 |
+
<details>
|
| 268 |
+
<summary>Click to view acknowledgements.</summary>
|
| 269 |
+
|
| 270 |
+
We would like to thank the following projects:
|
| 271 |
+
|
| 272 |
+
* [Qwen3.6](https://huggingface.co/collections/Qwen/qwen36) for providing the language backbone
|
| 273 |
+
* [SigLIP2](https://github.com/google-research/big_vision/blob/main/big_vision/configs/proj/image_text/README_siglip2.md) for providing the vision understanding module
|
| 274 |
+
* [Transformers](https://github.com/huggingface/transformers)
|
| 275 |
+
|
| 276 |
+
</details>
|
| 277 |
+
|
| 278 |
+
## Model Downloads
|
| 279 |
+
|
| 280 |
+
MiniCPM-V 4.7 is available in the following variants:
|
| 281 |
+
|
| 282 |
+
| Model | Description | Download |
|
| 283 |
+
|:---|:---|:---:|
|
| 284 |
+
| MiniCPM-V 4.7 1B | Combines stronger capabilities with extremely high efficiency, advancing the performance–efficiency Pareto frontier for multimodal large language models. | [🤗](https://huggingface.co/openbmb/MiniCPM-V-4.7-1B) [<img src="./minicpm_v4dot7_assets/modelscope_logo.png" width="20px"></img>](https://modelscope.cn/models/OpenBMB/MiniCPM-V-4.7-1B) |
|
| 285 |
+
| MiniCPM-V 4.7 1B int4 | bitsandbytes int4 quantized version with lower GPU memory usage. | [🤗](https://huggingface.co/openbmb/MiniCPM-V-4.7-1B-int4) [<img src="./minicpm_v4dot7_assets/modelscope_logo.png" width="20px"></img>](https://modelscope.cn/models/OpenBMB/MiniCPM-V-4.7-1B-int4) |
|
| 286 |
+
| MiniCPM-V 4.7 1B AWQ | AWQ (W4A16) quantized version with lower GPU memory usage. | [🤗](https://huggingface.co/openbmb/MiniCPM-V-4.7-1B-AWQ) [<img src="./minicpm_v4dot7_assets/modelscope_logo.png" width="20px"></img>](https://modelscope.cn/models/OpenBMB/MiniCPM-V-4.7-1B-AWQ) |
|
| 287 |
+
| MiniCPM-V 4.7 1B GPTQ | GPTQ (W4A16) quantized version with lower GPU memory usage. | [🤗](https://huggingface.co/openbmb/MiniCPM-V-4.7-1B-GPTQ) [<img src="./minicpm_v4dot7_assets/modelscope_logo.png" width="20px"></img>](https://modelscope.cn/models/OpenBMB/MiniCPM-V-4.7-1B-GPTQ) |
|
| 288 |
+
| MiniCPM-V 4.7 1B GGUF | GGUF version with lower memory usage for CPU inference. | [🤗](https://huggingface.co/openbmb/MiniCPM-V-4.7-1B-gguf) [<img src="./minicpm_v4dot7_assets/modelscope_logo.png" width="20px"></img>](https://modelscope.cn/models/OpenBMB/MiniCPM-V-4.7-1B-gguf) |
|
| 289 |
+
| MiniCPM-V 4.7 1B DSpark | DSpark draft model for speculative decoding. | [🤗](https://huggingface.co/openbmb/MiniCPM-V-4.7-1B-DSpark) [<img src="./minicpm_v4dot7_assets/modelscope_logo.png" width="20px"></img>](https://modelscope.cn/models/OpenBMB/MiniCPM-V-4.7-1B-DSpark) |
|
| 290 |
+
|
| 291 |
+
Also available on [Ollama](https://ollama.com/openbmb/minicpm-v4.7).
|
minicpm_v4dot7_assets/minicpmv4.7/moe_speed_comparison_en.gif
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/minicpmv4.7/overall_performance_1b_instruct.png
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/minicpmv4.7/overall_performance_35ba3b_instruct.png
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/minicpmv4.7/overall_performance_35ba3b_language.png
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/minicpmv4.7/performance_efficiency_frontier.png
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/minicpmv4.7/v47_1b_iphone_en.gif
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/minicpmv4.7/v47_35ba3b_ipad_en.gif
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/minicpmv4.7/v47_35ba3b_iphone_en.gif
ADDED
|
Git LFS Details
|
minicpm_v4dot7_assets/modelscope_logo.png
ADDED
|