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)# 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=40) 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
add the LiteRT-LM version of MiniCPM5-2B
Browse files- README-cn.md +1 -0
- README.md +1 -0
README-cn.md
CHANGED
|
@@ -161,6 +161,7 @@ datasets:
|
|
| 161 |
- **[MiniCPM5-2B-MLX](https://huggingface.co/openbmb/MiniCPM5-2B-MLX)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-MLX) · MLX / 4bit,适用于 Apple Silicon
|
| 162 |
- **[MiniCPM5-2B-GPTQ](https://huggingface.co/openbmb/MiniCPM5-2B-GPTQ)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-GPTQ) · GPTQ / 4bit 量化模型
|
| 163 |
- **[MiniCPM5-2B-DSpark](https://huggingface.co/openbmb/MiniCPM5-2B-DSpark)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-DSpark) · DSpark 草稿模型,用于推理加速
|
|
|
|
| 164 |
|
| 165 |
**MiniCPM5-1B**
|
| 166 |
|
|
|
|
| 161 |
- **[MiniCPM5-2B-MLX](https://huggingface.co/openbmb/MiniCPM5-2B-MLX)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-MLX) · MLX / 4bit,适用于 Apple Silicon
|
| 162 |
- **[MiniCPM5-2B-GPTQ](https://huggingface.co/openbmb/MiniCPM5-2B-GPTQ)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-GPTQ) · GPTQ / 4bit 量化模型
|
| 163 |
- **[MiniCPM5-2B-DSpark](https://huggingface.co/openbmb/MiniCPM5-2B-DSpark)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-DSpark) · DSpark 草稿模型,用于推理加速
|
| 164 |
+
- **[MiniCPM5-2B-LiteRT](https://huggingface.co/litert-community/MiniCPM5-2B)** · [ModelScope](https://www.modelscope.cn/models/litert-community/MiniCPM5-2B) · MiniCPM5-2B 的 LiteRT-LM 版本
|
| 165 |
|
| 166 |
**MiniCPM5-1B**
|
| 167 |
|
README.md
CHANGED
|
@@ -172,6 +172,7 @@ Use this directory to choose the model format that matches your runtime:
|
|
| 172 |
- **[MiniCPM5-2B-MLX](https://huggingface.co/openbmb/MiniCPM5-2B-MLX)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-MLX) · MLX / 4bit for Apple Silicon
|
| 173 |
- **[MiniCPM5-2B-GPTQ](https://huggingface.co/openbmb/MiniCPM5-2B-GPTQ)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-GPTQ) · GPTQ / 4bit quantized model
|
| 174 |
- **[MiniCPM5-2B-DSpark](https://huggingface.co/openbmb/MiniCPM5-2B-DSpark)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-DSpark) · DSpark draft model for inference acceleration
|
|
|
|
| 175 |
|
| 176 |
**MiniCPM5-1B**
|
| 177 |
|
|
|
|
| 172 |
- **[MiniCPM5-2B-MLX](https://huggingface.co/openbmb/MiniCPM5-2B-MLX)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-MLX) · MLX / 4bit for Apple Silicon
|
| 173 |
- **[MiniCPM5-2B-GPTQ](https://huggingface.co/openbmb/MiniCPM5-2B-GPTQ)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-GPTQ) · GPTQ / 4bit quantized model
|
| 174 |
- **[MiniCPM5-2B-DSpark](https://huggingface.co/openbmb/MiniCPM5-2B-DSpark)** · [ModelScope](https://www.modelscope.cn/models/OpenBMB/MiniCPM5-2B-DSpark) · DSpark draft model for inference acceleration
|
| 175 |
+
- **[MiniCPM5-2B-LiteRT](https://huggingface.co/litert-community/MiniCPM5-2B)** · [ModelScope](https://www.modelscope.cn/models/litert-community/MiniCPM5-2B) · the LiteRT-LM version of MiniCPM5-2B
|
| 176 |
|
| 177 |
**MiniCPM5-1B**
|
| 178 |
|