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-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM5-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openbmb/MiniCPM5-1B") 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-1B") model = AutoModelForCausalLM.from_pretrained("openbmb/MiniCPM5-1B", 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
- AMD Developer Cloud
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM5-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/MiniCPM5-1B" # 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-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openbmb/MiniCPM5-1B
- SGLang
How to use openbmb/MiniCPM5-1B 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-1B" \ --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-1B", "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-1B" \ --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-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openbmb/MiniCPM5-1B with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM5-1B
Commit History
-
Update README-cn.md
Verified signature87179e5 -
Update README-cn.md
Verified signature010676f -
Update README-cn.md
Verified signature59a3199 -
Update README-cn.md
Verified signature8762e95 -
Update README.md
Verified signaturec1838b5
-
Update README-cn.md
Verified signature4e9de7a -
Update README.md
Verified signature0592600 -
fix: update Transformers quickstart to be compatible with transformers v5.x
Verified signaturede0bfbe -
Update README.md
Verified signatureae28fc1 -
fix: update Transformers quickstart to be compatible with transformers v5.x
Verified signatureapply_chat_template() changed its return_dict default from False (v4) to True (v5), causing AttributeError when passing the result directly to model.generate(). Use explicit return_dict=True with **inputs unpacking to work across both versions.ce40a6e
-
update README
8895d92 -
update README
ec01347 -
update README
81f7f25 -
minor update
b282ae7 -
minor update
ab959d9
-
Update Chinese model card (README-cn.md)
Verified signaturee23a05a -
Update model card README
Verified signatureb64d06c -
Delete .ms_upload_cache
Verified signatureb265d87 -
Update Chinese model card (README-cn.md)
Verified signatureb0834b9 -
Update model card README
Verified signature2a83ad0 -
Update Chinese model card (README-cn.md)
Verified signature243554f -
Update model card README
Verified signature72ea395 -
Update Chinese model card (README-cn.md)
Verified signaturef00e004 -
Update model card README
Verified signature88d0cba -
Update Chinese model card (README-cn.md)
Verified signaturec9a4379 -
Update model card README
Verified signature8773529 -
Add Chinese model card (README-cn.md)
Verified signaturece43f1c -
Add model card README
Verified signature9da0a79 -
Add model card README
Verified signature94c7e15 -
Fix config _name_or_path to openbmb/MiniCPM5-1B
Verified signature5155e74
-
Bump transformers_version to 5.6.2
Verified signature68a0509 -
Bump transformers_version to 5.6.2
Verified signature6f72b37 -
init commit
84cfb63
-
initial commit
Verified signature849c46b