Instructions to use openbmb/MiniCPM-V-4.7-1B-DSpark 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-DSpark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openbmb/MiniCPM-V-4.7-1B-DSpark")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM-V-4.7-1B-DSpark") model = AutoModel.from_pretrained("openbmb/MiniCPM-V-4.7-1B-DSpark", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM-V-4.7-1B-DSpark 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-DSpark" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-V-4.7-1B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/openbmb/MiniCPM-V-4.7-1B-DSpark
- SGLang
How to use openbmb/MiniCPM-V-4.7-1B-DSpark 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-DSpark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-V-4.7-1B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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-DSpark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-V-4.7-1B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use openbmb/MiniCPM-V-4.7-1B-DSpark with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM-V-4.7-1B-DSpark
Low Acceptance Rate When Converted to GGUF
I am getting around 0.1 acceptance rate when using the gguf file created using convert_hf_to_gguf.py script provided by llama.cpp. Are the rope parameters etc. given in config.json correct?
It was an issue on my end, the reported numbers on this repo were for reasoning off. I got the speed boost after switching off the reasoning. Thank you for the model.
It was an issue on my end, the reported numbers on this repo were for reasoning off. I got the speed boost after switching off the reasoning. Thank you for the model.
Thks. We may support reasoning on+off in next version.
Hola
Thanks for the additional information. We have also tested the model with reasoning enabled and found that the speculative decoding acceptance rate can decrease compared with reasoning disabled, but it should not normally drop to around 0.1. Could you please share more details about your concrete use case and setup?
I am getting around 0.1 acceptance rate when using the gguf file created using convert_hf_to_gguf.py script provided by llama.cpp. Are the rope parameters etc. given in config.json correct?
Not a conversion issue - rope and the DSpark metadata are correct. It is the
template default: MiniCPM-V-4.7-1B only injects the empty thinking block when
enable_thinking is false, and llama.cpp defaults it to true. So --jinja always
starts in thinking mode, while the model card numbers are enable_thinking=false.
Turn it off with:
-rea off # new builds, also sets enable_thinking=false
--chat-template-kwargs '{"enable_thinking": false}' # older builds
or per request: {"chat_template_kwargs": {"enable_thinking": false}}
(or "reasoning_effort": "none").