Text Generation
Transformers
Safetensors
English
Chinese
qwen3
minicpm
minicpm5
llama
long-context
tool-calling
on-device
edge-ai
custom_code
text-generation-inference
Instructions to use openbmb/MiniCPM5-2B-DSpark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM5-2B-DSpark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openbmb/MiniCPM5-2B-DSpark", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM5-2B-DSpark", trust_remote_code=True) model = AutoModel.from_pretrained("openbmb/MiniCPM5-2B-DSpark", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM5-2B-DSpark with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/MiniCPM5-2B-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/MiniCPM5-2B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/openbmb/MiniCPM5-2B-DSpark
- SGLang
How to use openbmb/MiniCPM5-2B-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/MiniCPM5-2B-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/MiniCPM5-2B-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/MiniCPM5-2B-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/MiniCPM5-2B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use openbmb/MiniCPM5-2B-DSpark with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM5-2B-DSpark
| { | |
| "architectures": [ | |
| "Qwen3DSparkModel" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoModel": "dspark.DSparkDraftModel" | |
| }, | |
| "block_size": 7, | |
| "bos_token_id": 0, | |
| "draft_vocab_size": 130560, | |
| "dtype": "bfloat16", | |
| "eos_token_id": [ | |
| 1, | |
| 130073 | |
| ], | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 6144, | |
| "layer_types": [ | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention" | |
| ], | |
| "max_position_embeddings": 131072, | |
| "max_window_layers": 5, | |
| "mlp_bias": false, | |
| "model_type": "qwen3", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 5, | |
| "num_key_value_heads": 2, | |
| "num_target_layers": 42, | |
| "pad_token_id": 1, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-06, | |
| "rope_parameters": { | |
| "rope_theta": 5000000, | |
| "rope_type": "default" | |
| }, | |
| "sliding_window": null, | |
| "tie_word_embeddings": false, | |
| "transformers_version": "5.12.1", | |
| "use_cache": true, | |
| "use_sliding_window": false, | |
| "vocab_size": 130560, | |
| "attention_mode": "gqa", | |
| "confidence_head_alpha": 1.0, | |
| "confidence_head_with_markov": true, | |
| "enable_confidence_head": true, | |
| "markov_head_type": "vanilla", | |
| "markov_rank": 256, | |
| "mask_token_id": 75982, | |
| "projector_type": "dspark", | |
| "target_layer_ids": [ | |
| 1, | |
| 10, | |
| 20, | |
| 30, | |
| 39 | |
| ] | |
| } | |