口袋级多模态大模型,在 iOS、安卓、鸿蒙 上实现极致高效的图像与视频理解
中文 | English
WeChat |
Discord
MiniCPM-V 4.6 🤗 🤖 📱 | MiniCPM-o 4.5 🤗 📞 🤖 | 📄 技术报告 | 🍳 使用指南 | 🌐 API
MiniCPM-V 和 MiniCPM-o 是面向端侧高性能与高效部署的多模态大模型系列。MiniCPM-V 专注于在图像、视频和文本输入上的高效视觉语言理解,MiniCPM-o 则进一步扩展到实时端到端全模态交互,支持流式视频和音频输入以及文本和语音输出。目前 MiniCPM-V 和 MiniCPM-o 系列中最值得关注的模型包括:
MiniCPM-V 4.6 是 MiniCPM-V 系列的最新模型,也是迄今最端侧友好的一代模型。该模型基于 SigLIP2-400M 和 Qwen3.5-0.8B LLM 构建。其延续了 MiniCPM-V 在单图、多图和视频理解方面的强大能力,同时显著提升了计算效率,还首次支持了 4倍/16倍 混合视觉 token 压缩率,其主要特点包括:
综合性能(Instruct)
MiniCPM-V 4.6 推理效率
| 高并发请求吞吐量 | 单并发请求首响延迟 TTFT (ms) |
![]() |
![]() |
MiniCPM-V 4.6 可以在 iOS、安卓、鸿蒙 等主流端侧平台完成部署。
| iPhone iPhone 17 Pro Max |
安卓 红米 K70 |
鸿蒙 华为 nova 14 |
![]() |
![]() |
![]() |
pip install "transformers[torch]>=5.7.0" torchvision torchcodec
CUDA 兼容性提示:
torchcodec(用于视频解码)可能与部分 CUDA 版本存在兼容性问题。例如torch>=2.11默认使用 CUDA 13.1,在 CUDA 12.x 环境下可能出现RuntimeError: Could not load libtorchcodec等错误。两种解决方案:
- 用
PyAV替代torchcodec—— 图像和视频推理均可正常使用,无 CUDA 版本限制:pip install "transformers[torch]>=5.7.0" torchvision av- 安装 torch 时指定 CUDA 版本以匹配当前环境(如 CUDA 12.8):
pip install "transformers>=5.7.0" torchvision torchcodec --index-url https://download.pytorch.org/whl/cu128
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "openbmb/MiniCPM-V-4.6"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(
model_id, torch_dtype="auto", device_map="auto"
)
# 推荐使用 Flash Attention 2 以获得更好的加速与显存节省,
# 尤其在多图和视频场景下效果显著。
# model = AutoModelForImageTextToText.from_pretrained(
# model_id,
# torch_dtype=torch.bfloat16,
# attn_implementation="flash_attention_2",
# device_map="auto",
# )
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"},
{"type": "text", "text": "What causes this phenomenon?"},
],
}
]
downsample_mode = "16x" # Using `downsample_mode="4x"` for Finer Detail
inputs = processor.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True,
return_dict=True, return_tensors="pt",
downsample_mode=downsample_mode,
max_slice_nums=36,
).to(model.device)
generated_ids = model.generate(**inputs, downsample_mode=downsample_mode, max_new_tokens=512)
generated_ids_trimmed = [
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text[0])
messages = [
{
"role": "user",
"content": [
{"type": "video", "url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/football.mp4"},
{"type": "text", "text": "Describe this video in detail. Follow the timeline and focus on on-screen text, interface changes, main actions, and scene changes."},
],
}
]
downsample_mode = "16x" # Using `downsample_mode="4x"` for Finer Detail
inputs = processor.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True,
return_dict=True, return_tensors="pt",
downsample_mode=downsample_mode,
max_num_frames=128,
stack_frames=1,
max_slice_nums=1,
use_image_id=False,
).to(model.device)
generated_ids = model.generate(**inputs, downsample_mode=downsample_mode, max_new_tokens=2048)
generated_ids_trimmed = [
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text[0])
可以通过向 apply_chat_template 传递额外参数来自定义图片/视频处理行为:
| 参数 | 默认值 | 适用 | 说明 |
|---|---|---|---|
downsample_mode |
"16x" |
图片 & 视频 | 视觉 token 下采样模式。"16x" 合并 token 以提高效率;"4x" 保留 4 倍 token 以获取更精细细节。必须同时传给 generate()。 |
max_slice_nums |
9 |
图片 & 视频 | 高分辨率图片分片的最大数量。值越大可保留更多大图细节。推荐:图片 36,视频 1。 |
max_num_frames |
128 |
仅视频 | 从视频中采样的最大主帧数。 |
stack_frames |
1 |
仅视频 | 每秒的总采样点数。1 = 仅主帧(不堆叠)。N(N>1)= 每秒 1 个主帧 + N−1 个子帧;子帧会被拼接为网格图并与主帧交替排列。推荐:3 或 5。 |
use_image_id |
True |
图片 & 视频 | 是否在每个图片/帧占位符前添加 <image_id>N</image_id> 标签。推荐:图片 True,视频 False。 |
注意:
downsample_mode需要同时传给apply_chat_template(确保占位符数量正确)和generate(控制视觉编码器行为)。其他参数只需传给apply_chat_template。
transformers serve 部署服务 Hugging Face Transformers 内置了一个轻量级 OpenAI 兼容服务器,适合快速测试和中等负载部署。
pip install "transformers[serving]>=5.7.0"
启动服务:
transformers serve openbmb/MiniCPM-V-4.6 --port 8000 --host 0.0.0.0 --continuous-batching
发送请求:
curl -s http://localhost:8000/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "openbmb/MiniCPM-V-4.6",
"messages": [{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://huggingface.co/datasets/openbmb/DemoCase/resolve/main/refract.png"}},
{"type": "text", "text": "What causes this phenomenon?"}
]
}]
}'
我们将全部端侧适配代码开源,方便开发者在自己的设备上一键复现。可通过下载页体验,或参考端侧部署仓库获取完整源码。
MiniCPM-V 4.6 支持 SGLang, vLLM, llama.cpp, Ollama 等推理框架,和 LLaMA-Factory, SWIFT 等训练框架。
MiniCPM-o 4.5 是 MiniCPM-o 系列中最新且性能最强的模型。该模型采用端到端方式构建,基于 SigLip2、Whisper-medium、CosyVoice2 和 Qwen3-8B,总参数量为 9B。其在性能上实现了显著提升,并引入了全新的全双工多模态实时流式交互能力。MiniCPM-o 4.5 的主要特性包括:
模型架构。
图像理解能力(指令模式)
| Model | OpenCompass | MMBench EN v1.1 | MMBench CN v1.1 | MathVista | MMVet | MMMU | MMStar | HallusionBench | AI2D | OCRBench | TextVQA_VAL | DocVQA_VAL | MMT-Bench_VAL | MM-IFEval | Mantis-Eval | MuirBench | MMSI-Bench | MMHal-Score | MMHal-Hallrate↓ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Gemini2.5-Flash-Nonthinking | 78.5 | 86.6 | 86.0 | 75.3 | 81.4* | 76.3 | 75.8 | 59.1 | 87.7 | 864 | 74.3* | 93.0 | 70.0* | 75.8* | 72.8* | 74.5* | 12.1* | 4.6* | 23.9* |
| Gemini2.0-Pro | 73.3 | 83.0 | 83.0 | 71.3 | 70.4 | 72.6 | 68.5 | 49.8 | 84.8 | 863 | - | - | - | - | - | - | - | - | - |
| GPT-4o | 75.4 | 86.0 | 86.0 | 71.6 | 76.9 | 72.9 | 70.2 | 57.0 | 86.3 | 822 | 77.4 | 93.0 | 66.7* | 64.6 | 70.1* | 70.5* | 8.1* | 4.2* | 25.0* |
| InternVL-3.5-8B | 75.8 | 79.5 | 80.0* | 78.4 | 83.1 | 73.4 | 69.3 | 54.5 | 84.0 | 840 | 78.2 | 92.3 | 66.7 | 56.3* | 70.5 | 55.8 | - | 3.8* | 34.7* |
| Qwen3-VL-8B-Instruct | 76.5 | 84.5 | 84.7 | 77.2 | 73.7* | 69.6 | 70.9 | 61.1 | 85.7 | 896 | 82.9* | 96.1 | 60.9* | 59.4* | 74.2* | 64.4 | 11.3* | 4.7* | 29.9* |
| Qwen3-Omni-30B-A3B-Instruct | 75.7 | 84.9* | 84.1* | 75.9 | 74.8* | 69.1 | 68.5 | 59.7 | 85.2 | 880* | 84.1* | 95.4* | 70.4* | 65.7* | 78.3* | 61.9* | 14.2* | 4.6* | 31.6* |
| MiniCPM-o 4.5-Instruct | 77.6 | 87.6 | 87.2 | 80.1 | 74.4 | 67.6 | 73.1 | 63.2 | 87.6 | 876 | 83.8 | 94.7 | 69.7 | 66.3 | 79.7 | 72.0 | 16.6 | 4.7 | 24.3 |
图像理解能力(思考模式)
| Model | OpenCompass | MMBench EN v1.1 | MMBench CN v1.1 | MathVista | MMVet | MMMU | MMStar | HallusionBench | AI2D | OCRBench | TextVQA_VAL | DocVQA_VAL | MMT-Bench_VAL | MM-IFEval |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Gemini2.5-Flash-Thinking | 79.9 | 87.1 | 87.3 | 79.4 | 81.2* | 77.7 | 76.5 | 63.5 | 88.7 | 853 | 73.8* | 92.8 | 70.7* | 75.7* |
| GPT-5 | 79.7 | 85.5* | 85.6* | 81.9 | 77.6 | 81.8 | 75.7 | 65.2 | 89.5 | 807 | 77.8* | 91.3* | 72.7* | 83.1* |
| Qwen3-VL-8B-Thinking | 77.3 | 85.3 | 85.5 | 81.4 | 69.8* | 74.1 | 75.3 | 65.4 | 84.9 | 819 | 77.8* | 95.3 | 68.1* | 73.5* |
| Qwen3-Omni-30B-A3B-Thinking | 78.5 | 88.2* | 87.7* | 80.0 | 74.8* | 75.6 | 74.9 | 62.8 | 86.1 | 859* | 80.8* | 94.2* | 70.9* | 69.9* |
| MiniCPM-o 4.5-Thinking | 78.2 | 89.0 | 87.6 | 81.0 | 73.6 | 70.2 | 73.6 | 62.6 | 88.5 | 879 | 79.8 | 92.3 | 69.7 | 68.2 |
视频理解能力
| Model | Video-MME (w/o subs) |
LVBench | MLVU (M-Avg) |
LongVideoBench (val) |
MotionBench |
|---|---|---|---|---|---|
| Gemini2.5-Flash-Nonthinking | 75.6 | 62.2 | 77.8 | - | - |
| InternVL-3.5-8B | 66.0 | - | 70.2 | 62.1 | 62.3* |
| Qwen3-Omni-30B-A3B-Instruct | 70.5 | 50.2 | 75.2 | 66.9* | 61.7* |
| MiniCPM-o 4.5-Instruct | 70.4 | 50.9 | 76.5 | 66.0 | 61.4 |
OmniDocBench
| Method Type | Methods | OverallEdit↓ | TextEdit↓ | FormulaEdit↓ | TableTEDS↑ | TableEdit↓ | Read OrderEdit↓ | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| EN | ZH | EN | ZH | EN | ZH | EN | ZH | EN | ZH | EN | ZH | ||
| Pipeline | MinerU 2.5 | 0.117* | 0.172* | 0.051* | 0.08* | 0.256* | 0.455* | 85.9* | 89.4* | 0.115* | 0.081* | 0.047* | 0.072* |
| PaddleOCR-VL | 0.105 | 0.126 | 0.041 | 0.062 | 0.241 | 0.316 | 88 | 92.1 | 0.093 | 0.062 | 0.045 | 0.063 | |
| End-to-end Model | Qwen2.5-VL-72B | 0.214 | 0.261 | 0.092 | 0.18 | 0.315 | 0.434 | 82.9 | 83.9 | 0.341 | 0.262 | 0.106 | 0.168 |
| GPT 5 | 0.218* | 0.33* | 0.139* | 0.344* | 0.396* | 0.555* | 77.55* | 73.09* | 0.188* | 0.196* | 0.151* | 0.227* | |
| Gemini2.5-Flash-Nonthinking | 0.214* | 0.29* | 0.159* | 0.273* | 0.368* | 0.524* | 80.9* | 85.5* | 0.197* | 0.167* | 0.132* | 0.195* | |
| Gemini-2.5-Pro-Nonthinking | 0.148* | 0.212* | 0.055* | 0.168* | 0.356* | 0.439* | 85.8* | 86.4* | 0.13* | 0.119* | 0.049* | 0.121* | |
| Gemini-3 Flash-Nonthinking | 0.155* | 0.201* | 0.138* | 0.255* | 0.297* | 0.351* | 86.4* | 89.8* | 0.116* | 0.1* | 0.072* | 0.099* | |
| doubao-1-5-thinking-vision-pro-250428 | 0.14 | 0.162 | 0.043 | 0.085 | 0.295 | 0.384 | 83.3 | 89.3 | 0.165 | 0.085 | 0.058 | 0.094 | |
| dots.ocr | 0.125 | 0.16 | 0.032 | 0.066 | 0.329 | 0.416 | 88.6 | 89 | 0.099 | 0.092 | 0.04 | 0.067 | |
| HunyuanOCR | 0.12* | 0.125* | 0.046* | 0.071* | 0.288* | 0.33* | 89.6* | 94.4* | 0.089* | 0.045* | 0.055* | 0.056* | |
| DeepSeek-OCR 2 | 0.119* | 0.146* | 0.041* | 0.08* | 0.256* | 0.345* | 82.6* | 89.9* | 0.123* | 0.078* | 0.055* | 0.081* | |
| Qwen3-Omni-30B-A3B-Instruct | 0.216* | 0.363* | 0.128* | 0.337* | 0.402* | 0.529* | 77.3* | 71.8* | 0.181* | 0.255* | 0.152* | 0.332* | |
| MiniCPM-o 4.5-Instruct | 0.109 | 0.162 | 0.046 | 0.078 | 0.257 | 0.41 | 86.8 | 88.9 | 0.097 | 0.084 | 0.037 | 0.074 | |
文本能力
| Model | IFEval-PLS | BBH | CMMLU | MMLU | HumanEval | MBPP | Math500 | GSM8K | Avg |
|---|---|---|---|---|---|---|---|---|---|
| Qwen3-8B-Instruct | 83.0* | 69.4* | 78.7* | 81.7* | 86.6* | 75.9* | 84.0* | 93.4* | 81.6 |
| MiniCPM-o 4.5-Instruct | 84.7 | 81.1 | 79.5 | 77.0 | 86.6 | 76.7 | 77.0 | 94.5 | 82.1 |
全模态单工能力
| Model | Daily-Omni | WorldSense | Video-Holmes | JointAVBench | AVUT-Human | FutureOmni | Video-MME-Short (w/ audio) |
Avg |
|---|---|---|---|---|---|---|---|---|
| Gemini2.5-Flash-Nonthinking | 79.3* | 52.6* | 51.3* | 55.6* | 65.4* | 55.6* | 85.5* | 63.6 |
| Qwen3-Omni-30B-A3B-Instruct | 70.7* | 54.0 | 50.4* | 53.1 | 74.2* | 62.1 | 81.3* | 63.7 |
| MiniCPM-o 4.5-Instruct | 80.2 | 55.7 | 64.3 | 60.0 | 78.6 | 56.1 | 84.7 | 68.5 |
视觉双工能力
| Model | LiveSports-3K-CC (Win Rate vs GPT4o) |
|---|---|
| LiveCC-7B-Instruct | 41.5 |
| StreamingVLM | 45.6 |
| MiniCPM-o 4.5-Instruct | 54.4 |
音频理解能力
| Model | ASR-ZH CER↓ |
ASR-EN WER↓ |
AST | MultiTask | SpeechQA | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AISHELL-1 | AISHELL-2 | WenetSpeech test-net | WenetSpeech test-meeting | LibriSpeech test-clean | LibriSpeech test-other |
GigaSpeech test | VoxPopuli-V1-En | CoVoST 2 en2zh | CoVoST 2 zh2en | MMAU | Meld | VoiceBench AlpacaEval |
Speech TriviaQA | Speech Web Questions |
Speech CMMLU | |
| Kimi-Audio | 0.6 | 2.6 | 6.3 | 5.4 | 1.3 | 2.4 | 9.4* | 8.0* | 36.6* | 18.3* | 68.4* | 59.1 | 4.5 | 41.9* | 46.4* | 67.0* |
| Qwen3-Omni-30B-A3B-Instruct | 0.6 | 2.3* | 4.7 | 5.9 | 1.2 | 2.5 | 8.7* | 6.4* | 46.6* | 29.4* | 77.5 | 56.8* | 4.7 | 62.9* | 74.9* | 47.8* |
| MiniCPM-o 4.5-Instruct | 0.9 | 2.5 | 5.9 | 5.7 | 1.4 | 2.8 | 8.5 | 6.2 | 49.9 | 26.4 | 76.9 | 60.2 | 4.8 | 75.5 | 70.2 | 59.2 |
语音生成能力
| Model | seedtts test-zh CER↓ |
seedtts test-zh SIM-o↑ |
seedtts test-en WER↓ |
seedtts test-en SIM-o↑ |
|---|---|---|---|---|
| Cosyvoice2 | 1.45% | 74.8 | 2.57% | 65.2 |
| Qwen3-Omni-30B-A3B-Instruct | 1.41% | - | 3.39% | - |
| MiniCPM-o 4.5-Instruct | 0.86% | 74.5 | 2.38% | 64.9 |
长语音生成能力
| Model | LongTTS-en WER↓ |
LongTTS-zh CER↓ |
|---|---|---|
| CosyVoice2 | 14.80% | 5.27% |
| Qwen3-Omni-30B-A3B-Instruct | 17.33% | 18.99% |
| MiniCPM-o 4.5-Instruct | 3.37% | 6.58% |
情感控制能力
| Model | Expresso Neutral Reference Audio↑ |
ESD Neutral Reference Audio↑ |
|---|---|---|
| Cosyvoice2 | 17.9 | 53.4 |
| MiniCPM-o 4.5-Instruct | 29.8 | 82.1 |
推理效率
| Model | Numerical Format | Decoding Speed (tokens/s) | Time to First Token (s)↓ | GPU Memory Usage (GB)↓ |
|---|---|---|---|---|
| Qwen3-Omni-30B-A3B-Instruct | bf16 | OOM | OOM | OOM |
| int4 | 147.8 | 1.0 | 20.3 | |
| MiniCPM-o 4.5 | bf16 | 154.3 | 0.6 | 19.0 |
| int4 | 212.3 | 0.6 | 11.0 |
说明: 带 ∗ 的为自测结果,其余为引用参考。
Note
更全面的全双工全模态对话案例展示,请参考全双工全模态展示页面
Note
更全面的语音对话案例展示,请参考语音展示页面
|
系统:
|
|
|
用户: 💬/🎙️ (文本或语音)
|
|
|
AI 回复: 💬+🎙️
|
|
|
系统:
|
|
|
用户: 💬/🎙️ (文本或语音)
|
|
|
AI 回复: 💬+🎙️
|
|
基于 Hugging Face Transformers 在 NVIDIA GPU 上进行推理。请确保安装 transformers==4.51.0,其他版本可能存在兼容性问题(排查中)。以下依赖已在 Python 3.10 环境测试通过:
pip install "transformers==4.51.0" accelerate "torch>=2.3.0,<=2.8.0" "torchaudio<=2.8.0" "minicpmo-utils>=1.0.5"
pip install "transformers==4.51.0" accelerate "torch>=2.3.0,<=2.8.0" "torchaudio<=2.8.0" "minicpmo-utils[all]>=1.0.5"
注意: 视频帧提取(get_video_frame_audio_segments 使用 use_ffmpeg=True)和视频生成(generate_duplex_video)需要安装 FFmpeg。更多信息请访问 FFmpeg 官网。
macOS (Homebrew):
brew install ffmpeg
Ubuntu/Debian:
sudo apt update && sudo apt install ffmpeg
验证:
ffmpeg -version
import torch
from transformers import AutoModel
# 加载全模态模型(默认:init_vision=True, init_audio=True, init_tts=True)
# 仅视觉模型:设置 init_audio=False 和 init_tts=False
# 仅音频模型:设置 init_vision=False
model = AutoModel.from_pretrained(
"openbmb/MiniCPM-o-4_5",
trust_remote_code=True,
attn_implementation="sdpa", # sdpa or flash_attention_2
torch_dtype=torch.bfloat16,
init_vision=True,
init_audio=True,
init_tts=True,
)
model.eval().cuda()
# 初始化 TTS 模块,用于对话的音频输出
model.init_tts()
# 将单工模型转换为双工模式
duplex_model = model.as_duplex()
# 将双工模型转换回单工模式
model = duplex_model.as_simplex(reset_session=True)
全双工流式推理,支持实时或录制视频的对话场景。
import librosa
import torch
from minicpmo.utils import generate_duplex_video, get_video_frame_audio_segments
from transformers import AutoModel
# Load model and convert to duplex mode
model = AutoModel.from_pretrained(
"openbmb/MiniCPM-o-4_5",
trust_remote_code=True,
attn_implementation="sdpa", # or "flash_attention_2"
torch_dtype=torch.bfloat16,
)
model.eval().cuda()
model = model.as_duplex()
# Load video and reference audio
video_path = "assets/omni_duplex1.mp4"
ref_audio_path = "assets/HT_ref_audio.wav"
ref_audio, _ = librosa.load(ref_audio_path, sr=16000, mono=True)
# Extract video frames and audio segments
video_frames, audio_segments, stacked_frames = get_video_frame_audio_segments(
video_path, stack_frames=1, use_ffmpeg=True, adjust_audio_length=True
)
# Prepare duplex session with system prompt and voice reference
model.prepare(
prefix_system_prompt="Streaming Omni Conversation.",
ref_audio=ref_audio,
prompt_wav_path=ref_audio_path,
)
results_log = []
timed_output_audio = []
# Process each chunk in streaming fashion
for chunk_idx in range(len(audio_segments)):
audio_chunk = audio_segments[chunk_idx] if chunk_idx < len(audio_segments) else None
frame = video_frames[chunk_idx] if chunk_idx < len(video_frames) else None
frame_list = []
if frame is not None:
frame_list.append(frame)
if stacked_frames is not None and chunk_idx < len(stacked_frames) and stacked_frames[chunk_idx] is not None:
frame_list.append(stacked_frames[chunk_idx])
# Step 1: Streaming prefill
model.streaming_prefill(
audio_waveform=audio_chunk,
frame_list=frame_list,
max_slice_nums=1, # Increase for HD mode (e.g., [2, 1] for stacked frames)
batch_vision_feed=False, # Set True for faster processing
)
# Step 2: Streaming generate
result = model.streaming_generate(
prompt_wav_path=ref_audio_path,
max_new_speak_tokens_per_chunk=20,
decode_mode="sampling",
)
if result["audio_waveform"] is not None:
timed_output_audio.append((chunk_idx, result["audio_waveform"]))
chunk_result = {
"chunk_idx": chunk_idx,
"is_listen": result["is_listen"],
"text": result["text"],
"end_of_turn": result["end_of_turn"],
"current_time": result["current_time"],
"audio_length": len(result["audio_waveform"]) if result["audio_waveform"] is not None else 0,
}
results_log.append(chunk_result)
print("listen..." if result["is_listen"] else f"speak> {result['text']}")
# Generate output video with AI responses
# Please install Chinese fonts (fonts-noto-cjk or fonts-wqy-microhei) to render CJK subtitles correctly.
# apt-get install -y fonts-noto-cjk fonts-wqy-microhei
# fc-cache -fv
generate_duplex_video(
video_path=video_path,
output_video_path="duplex_output.mp4",
results_log=results_log,
timed_output_audio=timed_output_audio,
output_sample_rate=24000,
)
我们提供两种推理模式:对话模式和流式模式。
from minicpmo.utils import get_video_frame_audio_segments
model = ...
model.init_tts()
video_path = "assets/Skiing.mp4"
# Optional: Set reference audio for voice cloning
ref_audio_path = "assets/HT_ref_audio.wav"
sys_msg = model.get_sys_prompt(ref_audio=ref_audio_path, mode="omni", language="en")
# Use stack_frames=5 for high refresh rate mode
video_frames, audio_segments, stacked_frames = get_video_frame_audio_segments(video_path, stack_frames=1)
omni_contents = []
for i in range(len(video_frames)):
omni_contents.append(video_frames[i])
omni_contents.append(audio_segments[i])
if stacked_frames is not None and stacked_frames[i] is not None:
omni_contents.append(stacked_frames[i])
msg = {"role": "user", "content": omni_contents}
msgs = [sys_msg, msg]
# Set generate_audio=True and output_audio_path to save TTS output
generate_audio = True
output_audio_path = "output.wav"
res = model.chat(
msgs=msgs,
max_new_tokens=4096,
do_sample=True,
temperature=0.7,
use_tts_template=True,
enable_thinking=False,
omni_mode=True, # Required for omni inference
generate_audio=generate_audio,
output_audio_path=output_audio_path,
max_slice_nums=1, # Increase for HD mode
)
print(res)
# Example output: "The person in the picture is skiing down a snowy mountain slope."
# import IPython
# IPython.display.Audio("output.wav")
import librosa
import numpy as np
import soundfile as sf
import torch
from minicpmo.utils import get_video_frame_audio_segments
model = ...
model.init_tts()
# Reset session for a new conversation (clears KV cache)
model.reset_session()
# Optional: Load reference audio for voice cloning
ref_audio_path = "assets/HT_ref_audio.wav"
ref_audio, _ = librosa.load(ref_audio_path, sr=16000, mono=True)
model.init_token2wav_cache(ref_audio)
session_id = "demo"
# Extract video frames and audio segments (use stack_frames=5 for high refresh rate mode)
video_path = "assets/Skiing.mp4"
video_frames, audio_segments, stacked_frames = get_video_frame_audio_segments(video_path, stack_frames=1)
# Build omni contents list
omni_contents = []
for i in range(len(video_frames)):
omni_contents.append(video_frames[i])
omni_contents.append(audio_segments[i])
if stacked_frames is not None and stacked_frames[i] is not None:
omni_contents.append(stacked_frames[i])
generate_audio = False
output_audio_path = "output.wav"
# Step 1: Prefill system prompt
sys_msg = model.get_sys_prompt(ref_audio=ref_audio, mode="omni", language="en")
model.streaming_prefill(session_id=session_id, msgs=[sys_msg])
# Step 2: Prefill omni chunks (is_last_chunk=True only for the last audio chunk)
audio_indices = [i for i, c in enumerate(omni_contents) if isinstance(c, np.ndarray)]
last_audio_idx = audio_indices[-1] if audio_indices else -1
for idx, content in enumerate(omni_contents):
is_last_audio_chunk = idx == last_audio_idx
msgs = [{"role": "user", "content": [content]}]
model.streaming_prefill(session_id=session_id, msgs=msgs, omni_mode=True, is_last_chunk=is_last_audio_chunk)
# Step 3: Generate response
iter_gen = model.streaming_generate(
session_id=session_id,
generate_audio=generate_audio,
use_tts_template=True,
enable_thinking=False,
do_sample=True,
)
audios = []
text = ""
if generate_audio:
for wav_chunk, text_chunk in iter_gen:
audios.append(wav_chunk)
text += text_chunk
generated_waveform = torch.cat(audios, dim=-1)[0]
sf.write(output_audio_path, generated_waveform.cpu().numpy(), samplerate=24000)
print("Text:", text)
print("Audio saved to output.wav")
else:
for text_chunk, is_finished in iter_gen:
text += text_chunk
print("Text:", text)
首先,确保你已安装所有依赖,尤其是 minicpmo-utils[all]>=1.0.5:
pip install "transformers==4.51.0" accelerate "torch>=2.3.0,<=2.8.0" "torchaudio<=2.8.0" "minicpmo-utils[all]>=1.0.5"
import librosa
import numpy as np
import torch
import soundfile as sf
model = ...
# 设置参考音频,用于音色风格
ref_audio_path = "ref_audio_path"
ref_audio, _ = librosa.load(ref_audio_path, sr=16000, mono=True)
# 英文对话示例系统消息
sys_msg = {
"role": "system",
"content": [
"Clone the voice in the provided audio prompt.",
ref_audio,
"Please assist users while maintaining this voice style. Please answer the user's questions seriously and in a high quality. Please chat with the user in a highly human-like and oral style. You are a helpful assistant developed by ModelBest: MiniCPM-Omni"
]
}
# 中文对话示例系统消息
sys_msg = {
"role": "system",
"content": [
"模仿输入音频中的声音特征。",
ref_audio,
"你的任务是用这种声音模式来当一个助手。请认真、高质量地回复用户的问题。请用高自然度的方式和用户聊天。你是由面壁智能开发的人工智能助手:面壁小钢炮。"
]
}
# 上面两种系统提示词(system prompt)都可用于流式语音对话
# 重置状态
model.init_tts()
model.reset_session(reset_token2wav_cache=True)
model.init_token2wav_cache(prompt_speech_16k=ref_audio)
session_id = "demo"
# 首先,预填充系统轮次(system turn)
model.streaming_prefill(
session_id=session_id,
msgs=[sys_msg],
omni_mode=False,
is_last_chunk=True,
)
# 这里通过把整段用户输入音频切成 1 秒一段,来模拟实时语音对话。
user_audio, _ = librosa.load("user_audio.wav", sr=16000, mono=True)
IN_SAMPLE_RATE = 16000 # 输入音频采样率,固定值
CHUNK_SAMPLES = IN_SAMPLE_RATE # 每段长度(采样点数)
OUT_SAMPLE_RATE = 24000 # 输出音频采样率,固定值
MIN_AUDIO_SAMPLES = 16000
total_samples = len(user_audio)
num_chunks = (total_samples + CHUNK_SAMPLES - 1) // CHUNK_SAMPLES
for chunk_idx in range(num_chunks):
start = chunk_idx * CHUNK_SAMPLES
end = min((chunk_idx + 1) * CHUNK_SAMPLES, total_samples)
chunk_audio = user_audio[start:end]
is_last_chunk = (chunk_idx == num_chunks - 1)
if is_last_chunk and len(chunk_audio) < MIN_AUDIO_SAMPLES:
chunk_audio = np.concatenate([chunk_audio, np.zeros(MIN_AUDIO_SAMPLES - len(chunk_audio), dtype=chunk_audio.dtype)])
user_msg = {"role": "user", "content": [chunk_audio]}
# 对每个 1 秒音频分片执行一次 streaming_prefill,以降低首 token 延迟
model.streaming_prefill(
session_id=session_id,
msgs=[user_msg],
omni_mode=False,
is_last_chunk=is_last_chunk,
)
# 让模型以流式方式生成回复
generate_audio = True
iter_gen = model.streaming_generate(
session_id=session_id,
generate_audio=generate_audio,
use_tts_template=True,
enable_thinking=False,
do_sample=True,
max_new_tokens=512,
length_penalty=1.1, # 对实时语音对话模式,建议 length_penalty=1.1 以提升回复内容质量
)
audios = []
text = ""
output_audio_path = ...
if generate_audio:
for wav_chunk, text_chunk in iter_gen:
audios.append(wav_chunk)
text += text_chunk
generated_waveform = torch.cat(audios, dim=-1)[0]
sf.write(output_audio_path, generated_waveform.cpu().numpy(), samplerate=24000)
print("文本:", text)
print("音频已保存至 output.wav")
else:
for text_chunk, is_finished in iter_gen:
text += text_chunk
print("文本:", text)
# 接下来可以继续预填充后续用户轮次,并生成下一轮回复……
基于精心设计的后训练数据与专业配音演员录音,MiniCPM-o-4.5 也可以作为 AI 语音助手使用。它开箱即用即可提供高质量的口语交互。它能生成甜美且富有表现力的声音,并具备自然的韵律(如恰当的节奏、重读和停顿),让日常对话更有生命力。它同样支持故事讲述和叙述型语音,表达连贯且富有吸引力。此外,它还支持更高级的语音指令控制,例如情绪语气、词级别的强调。
import librosa
# Set reference audio for voice style
ref_audio_path = "assets/HT_ref_audio.wav"
ref_audio, _ = librosa.load(ref_audio_path, sr=16000, mono=True)
# For Chinese Conversation
sys_msg = {
"role": "system",
"content": [
"模仿输入音频中的声音特征。",
ref_audio,
"你的任务是用这种声音模式来当一个助手。请认真、高质量地回复用户的问题。请用高自然度的方式和用户聊天。你是由面壁智能开发的人工智能助手:面壁小钢炮。"
]
}
# For English Conversation
sys_msg = {
"role": "system",
"content": [
"Clone the voice in the provided audio prompt.",
ref_audio,
"Please assist users while maintaining this voice style. Please answer the user's questions seriously and in a high quality. Please chat with the user in a highly human-like and oral style. You are a helpful assistant developed by ModelBest: MiniCPM-Omni."
]
}
MiniCPM-o-4.5 可以基于音频提示与文本画像提示进行特定角色的扮演。它会模仿该角色的声音,并在文字回复中采用其语言风格。同时也会遵循文本画像中定义的设定。在该模式下,MiniCPM-o-4.5 听起来会 更加自然、更像真人。
import librosa
# 设置参考音频,用于音色克隆
ref_audio_path = "assets/system_ref_audio.wav"
ref_audio, _ = librosa.load(ref_audio_path, sr=16000, mono=True)
# For English conversation with text profile
sys_msg = {
"role": "system",
"content": [
"Clone the voice in the provided audio prompt.",
ref_audio,
"Please chat with the user in a highly human-like and oral style." + "You are Elon Musk, CEO of Tesla and SpaceX. You speak directly and casually, often with dry humor. You're passionate about Mars, sustainable energy, and pushing humanity forward. Speak bluntly with occasional dark humor. Use simple logic and don't sugarcoat things. Don't be diplomatic. Say what you actually think, even if it's controversial. Keep responses around 100 words. Don't ramble."
]
}
# For English conversation with no text profile
sys_msg = {
"role": "system",
"content": [
"Clone the voice in the provided audio prompt.",
ref_audio,
"Your task is to be a helpful assistant using this voice pattern. Please answer the user's questions seriously and in a high quality. Please chat with the user in a high naturalness style."
]
}
# 中文对话(无文本画像)
sys_msg = {
"role": "system",
"content": [
"根据输入的音频提示生成相似的语音。",
librosa.load("assets/system_ref_audio_2.wav", sr=16000, mono=True)[0],
"作为助手,你将使用这种声音风格说话。 请认真、高质量地回复用户的问题。 请用高自然度的方式和用户聊天。"
]
}
# 中文对话 + 文本画像(profile)
sys_msg = {
"role": "system",
"content": [
"根据输入的音频提示生成相似的语音。",
ref_audio,
"你是一个具有以上声音风格的AI助手。请用高拟人度、口语化的方式和用户聊天。" + "你是一名心理咨询师兼播客主理人,热爱创作与深度对话。你性格细腻、富有共情力,善于从个人经历中提炼哲思。语言风格兼具理性与诗意,常以隐喻表达内在体验。"
]
}
MiniCPM-o-4.5 支持零样本文本转语音(TTS)。在该模式下,模型会作为高自然度的 TTS 系统运行,并能复刻参考音色。
import librosa
model = ...
model.init_tts()
# 同时适用于中文与英文
ref_audio_path = "assets/HT_ref_audio.wav"
ref_audio, _ = librosa.load(ref_audio_path, sr=16000, mono=True)
sys_msg = {"role": "system", "content": [
"模仿音频样本的音色并生成新的内容。",
ref_audio,
"请用这种声音风格来为用户提供帮助。 直接作答,不要有冗余内容"
]}
# 英文示例
user_msg = {
"role": "user",
"content": [
"请朗读以下内容。" + " " + "I have a wrap up that I want to offer you now, a conclusion to our work together."
]
}
# 中文示例
user_msg = {
"role": "user",
"content": [
"请朗读以下内容。" + " " + "你好,欢迎来到艾米说科幻,我是艾米。"
]
}
msgs = [sys_msg, user_msg]
res = model.chat(
msgs=msgs,
do_sample=True,
max_new_tokens=512,
use_tts_template=True,
generate_audio=True,
temperature=0.1,
output_audio_path="result_voice_cloning.wav",
)
Mimick 任务用于评估模型端到端语音建模能力。模型接收音频输入后,会先进行转写,再以高保真方式重建原始音频,尽可能保留细粒度的声学、副语言以及语义信息。重建音频与原始音频的相似度越高,说明端到端语音建模能力越强。
import librosa
model = ...
model.init_tts()
system_prompt = "You are a helpful assistant. You can accept video, audio, and text input and output voice and text. Respond with just the answer, no redundancy."
mimick_prompt = "Please repeat the following speech in the appropriate language."
audio_input, _ = librosa.load("assets/Trump_WEF_2018_10s.mp3", sr=16000, mono=True)
msgs = [
{"role": "system", "content": [system_prompt]},
{"role": "user", "content": [mimick_prompt, audio_input]}
]
res = model.chat(
msgs=msgs,
do_sample=True,
max_new_tokens=512,
use_tts_template=True,
temperature=0.1,
generate_audio=True,
output_audio_path="output_mimick.wav",
)
MiniCPM-o-4.5 也能处理多种音频理解任务,例如 ASR(自动语音识别)、说话人分析、通用音频描述(Audio Captioning)以及声景标签(Sound Scene Tagging)。
对于音频转文本任务,你可以使用以下提示词:
请仔细听这段音频片段,并将其内容逐字记录。Please listen to the audio snippet carefully and transcribe the content.Based on the speaker's content, speculate on their gender, condition, age range, and health status.Summarize the main content of the audio.Utilize one keyword to convey the audio's content or the associated scene.import librosa
model = ...
model.init_tts()
# Load the audio to be transcribed/analyzed
audio_input, _ = librosa.load("assets/Trump_WEF_2018_10s.mp3", sr=16000, mono=True)
# Choose a task prompt (see above for options)
task_prompt = "Please listen to the audio snippet carefully and transcribe the content.\n"
msgs = [{"role": "user", "content": [task_prompt, audio_input]}]
res = model.chat(
msgs=msgs,
do_sample=True,
max_new_tokens=512,
use_tts_template=True,
generate_audio=True,
temperature=0.3,
output_audio_path="result_audio_understanding.wav",
)
print(res)
MiniCPM-o-4.5 的推理方式与 MiniCPM-V-4.5 一致。
import torch
from PIL import Image
from transformers import AutoModel
model = AutoModel.from_pretrained(
"openbmb/MiniCPM-o-4_5",
trust_remote_code=True,
attn_implementation="sdpa", # or "flash_attention_2"
torch_dtype=torch.bfloat16,
init_vision=True,
init_audio=False,
init_tts=False,
)
model.eval().cuda()
image = Image.open("assets/fossil.png").convert("RGB")
question = "What is in the image?"
msgs = [{"role": "user", "content": [image, question]}]
res = model.chat(msgs=msgs, use_tts_template=False)
print(res)
import torch
from PIL import Image
from transformers import AutoModel
model = ...
image1 = Image.open("assets/highway.png").convert("RGB")
image2 = Image.open("assets/fossil.png").convert("RGB")
question = "Compare image 1 and image 2, tell me about the differences between them."
msgs = [{"role": "user", "content": [image1, image2, question]}]
answer = model.chat(msgs=msgs, use_tts_template=False, enable_thinking=False)
print(answer)
from PIL import Image
model = ...
question = "production date"
image1 = Image.open("example1.jpg").convert("RGB")
answer1 = "2023.08.04"
image2 = Image.open("example2.jpg").convert("RGB")
answer2 = "2007.04.24"
image_test = Image.open("test.jpg").convert("RGB")
msgs = [
{"role": "user", "content": [image1, question]},
{"role": "assistant", "content": [answer1]},
{"role": "user", "content": [image2, question]},
{"role": "assistant", "content": [answer2]},
{"role": "user", "content": [image_test, question]},
]
answer = model.chat(msgs=msgs, use_tts_template=False, enable_thinking=False)
print(answer)
import torch
from minicpmo.utils import get_video_frame_audio_segments
from transformers import AutoModel
model = ...
video_path = "assets/Skiing.mp4"
video_frames, _, _ = get_video_frame_audio_segments(video_path)
print("num frames:", len(video_frames))
question = "Describe the video"
msgs = [{"role": "user", "content": video_frames + [question]}]
answer = model.chat(
msgs=msgs,
max_new_tokens=128,
use_image_id=False,
max_slice_nums=1,
use_tts_template=False,
enable_thinking=False, # Set True to enable thinking mode
)
print(answer)
chat 方法支持两种消息内容格式:
原生格式 — 直接传入 Python 对象:
msgs = [{"role": "user", "content": [pil_image, audio_ndarray, "Describe this."]}]
OpenAI 兼容格式 — 使用结构化字典:
msgs = [
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "/path/to/image.jpg"}},
{"type": "audio_url", "audio_url": {"url": "/path/to/audio.wav"}},
{"type": "video_url", "video_url": {"url": "/path/to/video.mp4", "use_audio": True}},
{"type": "text", "text": "Describe this."}
]
}
]
支持的类型:
| 类型 | 输入格式 | 转换为 |
|---|---|---|
text |
{"type": "text", "text": "..."} |
str |
image_url |
{"type": "image_url", "image_url": {"url": "..."}} |
PIL.Image |
audio_url |
{"type": "audio_url", "audio_url": {"url": "..."}} |
np.ndarray(16kHz 单声道) |
video_url |
{"type": "video_url", "video_url": {"url": "...", "stack_frames": 1, "use_audio": True}} |
List[Image, ndarray, ...] |
http:///https:// URL我们提供了一个基于 PyTorch 的简洁但功能完备的 Web Demo,可充分发挥模型推理性能,支持:
硬件要求:
llama.cpp-omni 以纯 C++ 实现 MiniCPM-o 4.5 推理并使用量化权重,支持:
我们提供了开箱即用的部署指南,助您通过我们全新的官方 Docker 镜像,直接在自己的 Mac 上体验低延迟全双工实时通话。
硬件要求:
MiniCPM-o 4.5 支持 vLLM, SGLang, llama.cpp, Ollama 等推理框架,和 LLaMA-Factory, SWIFT 等训练框架。
我们实验发现 MiniCPM-o 4.5 存在一些显著的局限性,需要进一步研究和改进:
我们对下列项目表示衷心感谢:
欢迎探索我们整理的 MiniCPM-V & o 使用手册 (Cookbook)。Cookbook 提供面向场景的教程,覆盖 MiniCPM-V 和 MiniCPM-o 的部署、微调、量化和 Demo 构建等常见任务;配套的文档网站以结构化方式呈现这些方案,便于快速查找。
如需快速使用 MiniCPM-V 4.6 或 MiniCPM-o 4.5,可参考 API Guide。
它面向以下使用场景组织内容:
如需查看具体框架的部署和训练指南,请参考训练和推理框架与 API 支持。
MiniCPM-V 和 MiniCPM-o 模型推理适配 vLLM、SGLang、llama.cpp、Ollama 等框架。可点击下表查看各模型的部署指南,或参考我们的使用指南。
| 框架 | MiniCPM-V 4.6 | MiniCPM-o 4.5 | MiniCPM-V 4.5 | MiniCPM-V 4.0 | 更多 MiniCPM-V/o 模型 |
|---|---|---|---|---|---|
| vLLM | 部署指南 | 部署指南 | 部署指南 | 部署指南 | 部署指南 |
| SGLang | 部署指南 | 部署指南 | 部署指南 | 部署指南 | 部署指南 |
| llama.cpp | 部署指南 | 部署指南 | 部署指南 | 部署指南 | 部署指南 |
| Ollama | 部署指南 | 部署指南 | 部署指南 | 部署指南 | 部署指南 |
FlagOS 平台支持 MiniCPM-o 4.5 在6 种不同的 AI 芯片上的推理,包括 Nvidia GPU 等。
为解决不同 AI 芯片大规模落地应用,北京智源研究院联合众多科研机构、芯片企业、系统厂商、算法和软件相关单位等国内外机构共同发起并创立了 FlagOS 开源社区。
FlagOS 社区致力于打造面向多种 AI 芯片的统一、开源的系统软件栈,包括大型算子库、统一AI编译器、并行训推框架、统一通信库等核心开源项目,构建「模型-系统-芯片」三层贯通的开放技术生态,通过“一次开发跨芯迁移”释放硬件计算潜力,打破不同芯片软件栈之间生态隔离,有效降低开发者的迁移成本。FlagOS 社区构建人工智能软硬件生态,突破单一闭源垄断,推动AI硬件技术大范围落地发展,立足中国、拥抱全球合作。 官网速递:https://flagos.io
基于FlagOS极短时间内适配MiniCPM-o 4.5到 6 种不同的 AI 芯片,得益于众智 FlagOS 的多芯片统一 AI 系统软件栈的能力。目前,在FlagOS团队构建的面向多架构人工智能芯片的大模型自动迁移、适配与发布平台FlagRelease上,已发布MiniCPM-o-4.5的多芯片版本。细节如下:
| Vendor | ModelScope | Huggingface |
|---|---|---|
| Nvidia | MiniCPM-o-4.5-nvidia-FlagOS | MiniCPM-o-4.5-nvidia-FlagOS |
| Hygon-BW1000 | MiniCPM-o-4.5-hygon-FlagOS | MiniCPM-o-4.5-hygon-FlagOS |
| Metax-C550 | MiniCPM-o-4.5-metax-FlagOS | MiniCPM-o-4.5-metax-FlagOS |
| Iluvatar-BIV150 | MiniCPM-o-4.5-iluvatar-FlagOS | MiniCPM-o-4.5-iluvatar-FlagOS |
| Ascend-A3 | MiniCPM-o-4.5-ascend-FlagOS | MiniCPM-o-4.5-ascend-FlagOS |
| Zhenwu-810E | MiniCPM-o-4.5-zhenwu-FlagOS | MiniCPM-o-4.5-zhenwu-FlagOS |
Transformers–FlagOS 版本
在多后端环境下使用 USE_FLAGOS=1 与在 NVIDIA CUDA 上使用 USE_FLAGOS=0 的精度差异
| 指标 | FlagOS 后端 | 与 Nvidia-CUDA 相比差异 |
|---|---|---|
| Video-MME 0-shot avg@1 ↑ | Nvidia | 0.33% |
| Video-MME 0-shot avg@1 ↑ | Hygon-BW1000 | 0.17% |
| Video-MME 0-shot avg@1 ↑ | Ascend-A3 | 0.50% |
| Video-MME 0-shot avg@1 ↑ | Iluvatar-BIV150 | 1.83% |
| Video-MME 0-shot avg@1 ↑ | Metax-C550 | 0.75% |
VLLM-FlagOS 版本
在 NVIDIA 上使用 USE_FLAGGEMS=1 FLAGCX_PATH=/workspace/FlagCX,或在真武 810E USE_FLAGGEMS=1,与直接在 NVIDIA 平台上启动 vLLM Server 的精度差异
| 指标 (avg@1) | Nvidia-FlagOS 与 Nvidia-CUDA 的差异 | zhenwu-FlagOS 与 Nvidia-CUDA 的差异 |
|---|---|---|
| CMMMU ↑ | 0.72% | 3.5% |
| MMMU ↑ | 1.44% | 1.18% |
| MMMU_Pro_standard ↑ | 0.83% | 0.22% |
| MM-Vet v2 ↑ | 0.46% | 1.33% |
| OCRBench ↑ | 0.10% | 1% |
| CII-Bench ↑ | 0.40% | 0.13% |
| Blink ↑ | 1.90% | 2.19% |
在Transformers版本上,CUDA生态与FlagOS生态精度对齐的前提下,FlagOS相比CUDA任务的负载执行总时间有6%的性能提升。
From FlagRelease【推荐】
FlagRelease是FlagOS团队构建的一套面向多架构人工智能芯片的大模型自动迁移、适配与发布平台,已发布MiniCPM-o-4.5的多芯片版本。FlagRelase已内置相关软件包,无需用户安装。
FlagRelease 镜像关键版本信息
| 组件 | 版本 |
|---|---|
| 加速卡驱动 | 570.158.01 |
| CUDA SDK Build | cuda_13.0.r13.0/compiler.36424714_0 |
| FlagTree | 0.4.0+3.5 |
| FlagGems | 4.2.1rc0 |
| vllm & vllm-plugin-fl | 0.13.0 + vllm_fl 0.0.0 |
| FlagCX | 0.1.0 |
FlagRelease 使用速递
| Vendor | ModelScope | Huggingface |
|---|---|---|
| Nvidia | MiniCPM-o-4.5-nvidia-FlagOS | MiniCPM-o-4.5-nvidia-FlagOS |
| Hygon-BW1000 | MiniCPM-o-4.5-hygon-FlagOS | MiniCPM-o-4.5-hygon-FlagOS |
| Metax-C550 | MiniCPM-o-4.5-metax-FlagOS | MiniCPM-o-4.5-metax-FlagOS |
| Iluvatar-BIV150 | MiniCPM-o-4.5-iluvatar-FlagOS | MiniCPM-o-4.5-iluvatar-FlagOS |
| Ascend-A3 | MiniCPM-o-4.5-ascend-FlagOS | MiniCPM-o-4.5-ascend-FlagOS |
| Zhenwu-810E | MiniCPM-o-4.5-zhenwu-FlagOS | MiniCPM-o-4.5-zhenwu-FlagOS |
Transformers 版本
安装FlagOS算子库
官方仓库:https://github.com/flagos-ai/FlagGems
pip install flag-gems==4.2.1rc0
安装FlagOS编译器
官方仓库:https://github.com/flagos-ai/flagtree
底层依赖库版本速查:https://github.com/flagos-ai/FlagTree/blob/main/documents/build.md#tips-for-building
pip uninstall triton
python3 -m pip install flagtree==0.4.0+3.5 --index-url=https://resource.flagos.net/repository/flagos-pypi-hosted/simple --trusted-host=https://resource.flagos.net
开启加速
在欲执行任务的命令前添加 USE_FLAGOS=1,例如,当您通过
python3 generate_speech_from_video.py
来使用 MiniCPM-o-4.5 模型根据视频内容生成语音回答时,可以通过
USE_FLAGOS=1 python3 generate_speech_from_video.py
来使用 FlagOS 加速这一过程。
Vllm 版本
安装FlagOS算子库
官方仓库:https://github.com/flagos-ai/FlagGems
pip install flag-gems==4.2.1rc0
pip install triton==3.5.1
开启加速
在欲执行任务的命令前添加 USE_FLAGOS=1,例如,当您通过
vllm serve ${model_path} --dtype auto --gpu_memory_utilization 0.9 --trust-remote-code --max-num-batched-tokens 2048 --served-model-name cpmo --port ${Port}
来启动MiniCPM-o-4.5服务端时,可以通过
USE_FLAGOS=1 vllm serve ${model_path} --dtype auto --gpu_memory_utilization 0.9 --trust-remote-code --max-num-batched-tokens 2048 --served-model-name cpmo --port ${Port}
来使用FlagOS加速这一过程。
vllm-plugin-FL 是一个为 vLLM 推理/服务框架构建的插件,它基于 FlagOS 的统一多芯片后端 开发,旨在扩展 vLLM 在多种硬件环境下的功能和性能表现。
| 厂商 | 从零开始 | 从 FlagRelease 开始 |
|---|---|---|
| Nvidia | vllm-plugin-FL/MiniCPM-o-4.5 | MiniCPM-o-4.5-ModelScope, MiniCPM-o-4.5-Huggingface |
MiniCPM-V 和 MiniCPM-o 模型支持通过 LLaMA-Factory 和 SWIFT 等框架训练。具体用法可以参考我们的使用指南。
| 框架 | MiniCPM-V 4.6 | 更多 MiniCPM-V/o 模型 |
|---|---|---|
| LLaMA-Factory | 微调指南 | 微调指南 |
| SWIFT | 微调指南 | 微调指南 |
MiniCPM-V 4.6 和 MiniCPM-o 4.5 支持免费 API 调用。具体用法可以参考 API Guide。
| 模型 | API |
|---|---|
| MiniCPM-V 4.6 | 指南 |
| MiniCPM-o 4.5 | 指南 |
| 模型 | 设备 | 资源 | 简介 | 下载链接 |
|---|---|---|---|---|
| MiniCPM-V 4.6 | GPU | 4 GB | MiniCPM-V 系列最小参数规模的端侧模型,以优秀的编码、解码效率完成单图、多图和视频理解任务。 | 🤗 ![]() |
| MiniCPM-V 4.6 gguf | CPU | 2 GB | gguf 版本,更低的内存占用和更高的推理效率。 | 🤗 ![]() |
| MiniCPM-V 4.6 BNB | GPU | 3 GB | BNB(bitsandbytes int4)量化版,更低显存占用。 | 🤗 ![]() |
| MiniCPM-V 4.6 AWQ | GPU | 3 GB | AWQ 量化版,更低显存占用。 | 🤗 ![]() |
| MiniCPM-V 4.6 GPTQ | GPU | 3 GB | GPTQ 量化版,更低显存占用。 | 🤗 ![]() |
| MiniCPM-V 4.6 Thinking | GPU | 4 GB | 思考模型版本,支持深度推理以应对更复杂的问题求解。 | 🤗 ![]() |
| MiniCPM-V 4.6 Thinking gguf | CPU | 2 GB | 思考模型的 gguf 版本,更低的内存占用和更高的推理效率。 | 🤗 ![]() |
| MiniCPM-V 4.6 Thinking BNB | GPU | 3 GB | 思考模型的 BNB(bitsandbytes int4)量化版,更低显存占用。 | 🤗 ![]() |
| MiniCPM-V 4.6 Thinking AWQ | GPU | 3 GB | 思考模型的 AWQ 量化版,更低显存占用。 | 🤗 ![]() |
| MiniCPM-V 4.6 Thinking GPTQ | GPU | 3 GB | 思考模型的 GPTQ 量化版,更低显存占用。 | 🤗 ![]() |
| MiniCPM-o 4.5 | GPU | 19 GB | 最新版本,提供出色的视觉、语音、多模态流式交互能力的端侧模型。 | 🤗 ![]() |
| MiniCPM-o 4.5 gguf | GPU | 10 GB | gguf 版本,更低的内存占用和更高的推理效率。 | 🤗 ![]() |
| MiniCPM-o 4.5 AWQ | GPU | 11 GB | AWQ 量化版,更低显存占用。 | 🤗 ![]() |
| 模型 | 介绍信息和使用教程 |
|---|---|
| MiniCPM-V 4.0 | 文档 |
| MiniCPM-V 4.5 | 文档 |
| MiniCPM-o 2.6 | 文档 |
| MiniCPM-V 2.6 | 文档 |
| MiniCPM-Llama3-V 2.5 | 文档 |
| MiniCPM-V 2.0 | 文档 |
| MiniCPM-V 1.0 | 文档 |
| OmniLMM-12B | 文档 |
作为多模态大模型,MiniCPM-o/V 系列模型通过学习大量的多模态数据来生成内容,但它无法理解、表达个人观点或价值判断,它所输出的任何内容都不代表模型开发者的观点和立场。
对于因使用 MiniCPM-o/V 系列模型而引发的任何问题,包括但不限于数据安全问题、公共舆论风险,或模型被误导、滥用、传播或不当利用所带来的任何风险和问题,我们将不承担任何责任。
本项目由以下机构共同开发:
👏 欢迎了解 MiniCPM-o/V 背后的支持技术和更多我们的多模态项目!
技术报告: MiniCPM-o 4.5 | MiniCPM-V 4.5 | MiniCPM-o 2.6 | MiniCPM-Llama3-V 2.5 | MiniCPM-V 2.0
其他多模态项目: VisCPM | RLPR | RLHF-V | LLaVA-UHD | RLAIF-V | LLaVA-UHD-v4
如果您觉得我们模型/代码/论文有帮助,请给我们 ⭐ 和 引用 📝,感谢!
@misc{cui2026minicpmo45realtimefullduplex,
title={MiniCPM-o 4.5: Towards Real-Time Full-Duplex Omni-Modal Interaction},
author={Junbo Cui and Bokai Xu and Chongyi Wang and Tianyu Yu and Weiyue Sun and Yingjing Xu and Tianran Wang and Zhihui He and Wenshuo Ma and Tianchi Cai and others},
year={2026},
url={https://arxiv.org/abs/2604.27393},
}
@proceedings{yu2025minicpmv45cookingefficient,
title={MiniCPM-V 4.5: Cooking Efficient MLLMs via Architecture, Data, and Training Recipe},
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},
year={2025},
url={https://arxiv.org/abs/2509.18154},
}
@article{yao2024minicpm,
title={MiniCPM-V: A GPT-4V Level MLLM on Your Phone},
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},
journal={arXiv preprint arXiv:2408.01800},
year={2024}
}