Text Generation
Transformers
Safetensors
English
Chinese
llama
minicpm
minicpm5
long-context
tool-calling
on-device
edge-ai
conversational
text-generation-inference
Instructions to use openbmb/MiniCPM5-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM5-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openbmb/MiniCPM5-2B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM5-2B") model = AutoModelForCausalLM.from_pretrained("openbmb/MiniCPM5-2B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM5-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/MiniCPM5-2B" # 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/MiniCPM5-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openbmb/MiniCPM5-2B
- SGLang
How to use openbmb/MiniCPM5-2B 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" \ --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/MiniCPM5-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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" \ --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/MiniCPM5-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openbmb/MiniCPM5-2B with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM5-2B
Commit History
-
Harden KV-BSS masking and add numerical cache tests
Verified signatureac79321 -
Harden KV-BSS masking and add numerical cache tests
Verified signature954c497
-
Update to RoPE+KV-cache modeling (LF normalization, GenerationMixin, honest test docs)
Verified signatureff0399b -
Add complete production modeling, configuration, test suite, and integration documentation
Verified signaturedcea2e5 -
Add KV-BSS (Key-Value Binding Softmax Sharpening) attention hook
Verified signature### KV-BSS: Key-Value Binding Softmax Sharpening for 128K Context Inference This Pull Request adds the standalone **KV-BSS (Key-Value Binding Softmax Sharpening)** attention hook module for `MiniCPM5-2B`. ### Background & Motivation In ultra-long context inference (up to 131,072 tokens), standard attention logits suffer from entropy dispersion (attention haze), which reduces associative retrieval accuracy on structured bindings (e.g. `["key"] => "value"`, AST parsing, schema extraction). ### What KV-BSS does: 1. **Focus Factor Scaling (τ_focus = 1.10)**: Steeping attention logits concentrates probability mass around exact antecedent keys. 2. **Attention Haze Floor Filtering**: Masks logits falling more than 12.0 nats below the maximum attention score to `-inf`, eliminating associative noise. - Full compressed model release: [F-Labs/MiniCPM5-2B-Hadamard-GSQ](https://huggingface.co/F-Labs/MiniCPM5-2B-Hadamard-GSQ) - Core framework: [GitHub: dsadawq3/FQuant](https://github.com/dsadawq…752d317 -
docs: update README
cd199ce -
add `MiniCPM5-2B-DSpark-GGUF`
d6c082b
-
add the LiteRT-LM version of MiniCPM5-2B
a063f08 -
docs: update links of `Just RL II` and formatting in README files for clarity and consistency
0e9c66d
-
update README
3497c46 -
update README
d3ad48d -
update README
aac3680 -
docs: update MiniCPM5-2B-GPTQ model link in README files
b04e640
-
docs: update training data and SGLang details
zzhd312cb6 -
docs: update SGLang version requirement
zzh85dfd5e -
upload MiniCPM5-2B
Verified signatureab8fd77 -
initial commit
Verified signature71b5e66