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
29 days ago
-
Remove the dead `<tool_sep>` branch from chat_template.jinja (fixes OpenBMB/MiniCPM#379)
Verified signatureRemove the dead `<tool_sep>` branch from chat_template.jinja (fixes OpenBMB/MiniCPM#379) ## What Two changes, nothing else: 1. Delete the `<tool_sep>` handling block inside the assistant branch (former lines 54–117). It split `content` on `<tool_sep>` and tried to interleave the tool-call XML between the text segments by accumulating `processed_content` inside `for` loops. 2. Change the trailing tool-call block guard from `{%- if message.tool_calls and not has_tool_sep %}` to `{%- if message.tool_calls %}`. Diff: 66 lines removed, 1 line changed. Parameter rendering, reasoning handling, tool-response handling and the generation prompt are untouched. ## Why **The branch never worked.** Jinja2 does not propagate `{% set %}` assignments made inside a `for` loop to the enclosing scope, so `processed_content` kept its initial value `content_parts[0]` — everything after the first `<tool_sep>` was silently dropped (see #379 for the minimal reproducer). `has_tool_sep` was never defined a…930f638
-
Enhance README with sampling parameter recommendations and Llama.cpp usage examples
12a3808 -
Enhance README with sampling parameter recommendations and Llama.cpp usage examples
62b9b3b
-
Add a LiteRT-LM row to the Deployment cookbook table
abe115e -
Add a LiteRT-LM row to the Deployment cookbook table (#12)
- Add a LiteRT-LM row to the Deployment cookbook table (71c68834587f77f606f491335866dd23edc640e5) - Deployment table: drop the community-conversion wording from the LiteRT-LM row (f97e2c604de7c9ece5bb0fc5d407a39549f59d73) - Deployment table: add IoT to the LiteRT-LM row (e58d4791de037eac4c90647e276c27b41a53053c) Co-authored-by: Daisuke Majima (MLBoy) <mlboydaisuke@users.noreply.huggingface.co>bca2410
-
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