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)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM5-1B") model = AutoModelForCausalLM.from_pretrained("openbmb/MiniCPM5-1B") 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-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
经过实际测试,该模型长上下文能力很差,我把llama-server --help输出的内容发给模型,让它列出所有选项,这都做不到
#5
by chuikingshek - opened
经过实际测试,该模型长上下文能力很差。
我把 llama-server --help 输出的内容发给模型,让它列出所有选项,这都做不到。
我按照官方 SKILL.md 在 llama-cpp 上部署 F16 量化模型,参数如下:
& "$LLAMA_SERVER" `
--host 0.0.0.0 --port 60001 --api-key "$API_KEY" -lv 4 `
-c 65536 --reasoning-budget -1 -ctk f16 -ctv f16 `
--temp 0.9 --top-p 0.95 `
--no-mmap -m "$MODEL_FILE"
提示词:提取所有的参数并用markdown表格列出来。
模型输出的内容:
以下是所有参数的提取和整理,已整理为Markdown表格格式:
## 常见参数(Common Parameters)
| 参数名称 | 说明 | 默认值 |
|---------|------|--------|
| `--help` | 显示帮助信息 | `-h` |
| `--version` | 显示版本信息 | `-v` |
| `--license` | 显示许可证信息 | `-l` |
| `--cache-list` | 显示缓存列表 | `-c` |
| `--completion-bash` | 提供可用的bash命令 | `-c` |
| `--threads` | 线程数 | `t` |
| `--threads-batch` | 批处理线程数 | `tbt` |
| `--cpu-mask` | CPU亲和掩码(任意十六进制) | `-C` |
| `--cpu-mask-batch` | 批处理CPU亲和掩码 | `-Crb` |
| `--cpu-range` | CPU范围(任意十六进制) | `-Crd` |
| `--cpu-strict` | CPU严格放置(0/1) | `0` |
| `--cpu-priority` | 线程优先级(低/中/高/实时) | `-p` |
| `--poll` | 等待工作(0-50) | `-p` |
| `--cpu-moe` | 保留Mixture of Experts(MoE)权重在CPU | `-cf` |
| `--cpu-moe-draft` | 保留Mixture of Experts(MoE)权重在前端GPU | `-cmoed` |
| `--cpu-moe-n-1` | 保留Mixture of Experts(MoE)权重的前N层在前端GPU | `-ncmoe` |
| `--cpu-moe-n-2` | 保留Mixture of Experts(MoE)权重的前N层在后端GPU | `-ncmoe` |
| `--cpu-moe-n-max` | 保留Mixture of Experts(MoE)权重的前最大N层 | `-md` |
| `--cpu-moe-url` | LoRA适配器下载URL | `-hfv` |
| `--cpu-range-draft` | 预训练模型CPU亲和掩码 | `-Cd` |
| `--cpu-range-draft-lo-hi` | 预训练模型CPU范围 | `-Crd` |
| `--cpu-strict-draft` | 预训练模型CPU严格放置 | `--cpu-strict-draft` |
| `--cpu-strict-draft-n` | 预训练模型CPU严格放置 | `--cpu-strict-draft-n` |
| `--cpu-strict-batch-draft` | 预训练模型CPU严格放置 | `--cpu-strict-batch-draft` |
| `--cpu-strict-batch-draft-n` | 预训练模型CPU严格放置 | `--cpu-strict-batch-draft-n` |
| `--cpu-strict-batch` | CPU严格放置 | `--cpu-strict-batch` |
| `--cpu-strict` | CPU严格放置 | `0` |
| `--cpu-mask` | CPU亲和掩码 | `-C` |
| `--cpu-moe` | 保留Mixture of Experts(MoE)权重在前端GPU | `-cf` |
| `--cpu-moe-draft` | 保留Mixture of Experts(MoE)权重在前端GPU | `-cmoed` |
| `--cpu-moe-draft-1` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-2` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-3` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-4` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-5` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-6` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe` | 保留Mixture of Experts(MoE)权重在CPU | `-cf` |
| `--cpu-moe-n` | 保留Mixture of Experts(MoE)权重的前N层在CPU | `-ncmoe` |
| `--cpu-moe-n-max` | 保留Mixture of Experts(MoE)权重的前最大N层在CPU | `-md` |
| `--cpu-moe-draft` | 保留Mixture of Experts(MoE)权重在前端GPU | `-cmoed` |
| `--cpu-moe-draft-1` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-2` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-3` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-4` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-5` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-6` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe` | 保留Mixture of Experts(MoE)权重在CPU | `-cf` |
| `--cpu-moe-draft` | 保留Mixture of Experts(MoE)权重在前端GPU | `-cmoed` |
| `--cpu-moe-draft-1` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-2` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-3` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-4` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-5` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-6` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe` | 保留Mixture of Experts(MoE)权重在CPU | `-cf` |
| `--cpu-moe-n` | 保留Mixture of Experts(MoE)权重的前N层在CPU | `-ncmoe` |
| `--cpu-moe-n-max` | 保留Mixture of Experts(MoE)权重的前最大N层在CPU | `-md` |
| `--cpu-moe-draft` | 保留Mixture of Experts(MoE)权重在前端GPU | `-cmoed` |
| `--cpu-moe-draft-1` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-2` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-3` | 保留Mixture of Experts(MoE)权重在前端GPU | `-ncmoe` |
| `--cpu-moe-draft-4` | 保留Mixture of Experts(MoE)权重在前端GPU |
上面就是所有内容了,我没有故意截断。
后面我尝试让它继续列完,也会输出类似上面的内容。
这说明这个模型的记忆能力或者长上下文能力是崩溃的,128K上下文没有实际意义。
补充:看了一下模型的训练流程说明,发现训练时有刻意降低回答超长率,看来这个模型有一些自己的特色。
chuikingshek changed discussion status to closed
您好,感谢您的详细测试和反馈。
我们目前模型在长上下文场景下的表现确实还不够理想。虽然本次模型在预训练阶段扩展到了 128K 上下文长度,但从实际效果来看,长文本能力还没有被充分、稳定地激发出来。
您反馈的问题我们已经关注到。对于小尺寸模型,我们目前仍处于快速改进和持续迭代阶段,后续版本会继续优化长上下文理解、信息提取稳定性以及长文本任务中的重复和遗漏问题。
感谢您的建议与支持!!也欢迎您持续关注后续更新!!