Image-Text-to-Text
Transformers
Safetensors
multilingual
minicpmv
feature-extraction
minicpm-v
vision
ocr
multi-image
video
custom_code
conversational
Instructions to use openbmb/MiniCPM-V-4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM-V-4 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", trust_remote_code=True) 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 AutoModel model = AutoModel.from_pretrained("openbmb/MiniCPM-V-4", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM-V-4 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" # 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", "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
- SGLang
How to use openbmb/MiniCPM-V-4 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" \ --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", "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" \ --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", "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 with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM-V-4
Commit History
Yesterday
-
Chat template as a processor-only chat_template.json
Verified signatureThe tokenizer also loads a repo-level `chat_template.jinja`, so it replaced the tokenizer's own chat template. `chat_template.json` is read by the processor only, and the tokenizer keeps its template.0595932 -
Add native Transformers support (config and processor files only)
Verified signatureThis PR adds native Transformers support for MiniCPM-V 4.0 while keeping the existing remote code working. It goes with https://github.com/huggingface/transformers/pull/51299, which adds the model to Transformers as `minicpmv2_6`, on top of MiniCPM-Llama3-V 2.5 (https://github.com/huggingface/transformers/pull/50929, whose Hub files are openbmb/MiniCPM-Llama3-V-2_5#80, with the same layout). **The weights are not changed.** Transformers maps the original weight names at load time. **It can be merged now:** the remote code keeps loading as before (`trust_remote_code=True`, `auto_map` unchanged), and Transformers versions that include the model load it natively. | File | Change | |---|---| | `config.json` | All original keys kept, incl. `auto_map`. Added: `model_type: "minicpmv2_6"`, `text_config`, `resampler_n_latents`, `resampler_n_heads`, `image_token_id`. `vision_config` gets `model_type: "minicpmv2_6_vision"` (the remote code only reads its sizes), and `slice_config` no longer ha…e56c89f
18 days ago
-
update docs link
Verified signaturec0d840f
-
Update README.md
Verified signature6f69a82 -
Update README.md
Verified signatureaee41ca
-
Update README.md
Verified signature0968cf9 -
Update: license
Verified signature69e2993
-
Upload README.md with huggingface_hub
Verified signature2c0ac54
-
update readme
tc-mb85a1b57 -
update readme
tc-mb079336d
-
Initial commit: MiniCPM-V-4 model
tc-mb1160da8