minicpm5-deploy-sglang
它能做什么
这个技能指导你的 AI 使用 SGLang 运行 MiniCPM5,SGLang 是一个面向 NVIDIA 显卡的服务器。适合需要同时处理大量请求,或希望模型调用工具的团队。
适用场景
- ✓你需要在 NVIDIA GPU 上同时为许多用户提供服务的服务器的时候。
- ✓你想让 MiniCPM5 通过 OpenAI 风格的 API 使用工具调用的时候。
- ✓你在为测试或评估运行大批量提示词的时候。
技能链接
https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-deploy-sglang/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我在我的 NVIDIA GPU 上用 SGLang 启动 MiniCPM5 服务器,以便我的应用可以调用它。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能安装 SGLang,设置几个环境变量,在你选择的端口上启动服务器,并用一个测试请求进行检查。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Deploy MiniCPM5-1B and MiniCPM5-2B with SGLang
OpenAI-compatible server with RadixAttention prefix cache. Best fit for tool calling, batched eval pipelines, and high-concurrency serving.
Required input
| Var | Example | Default |
|---|---|---|
MODEL_PATH |
openbmb/MiniCPM5-2B or openbmb/MiniCPM5-1B |
required; |
PORT |
30000 |
30000 |
GPU_ID |
0 |
0 |
CTX_LEN |
131072 (128 K) |
131072 |
MEM_FRAC |
0.85 |
0.85 |
TOOL_PARSER |
minicpm5 |
minicpm5; use auto if you want template detection |
Steps
1. Install (once)
pip install "sglang[srt]>=0.5.16" # latest, requires CUDA 13.x driver
# pip install "sglang==0.5.6.post3" # fallback for CUDA 12.x driver hosts
For tool calling, install from main — the minicpm5 parser (PR #25600, merged 2026-05-22) is not in any pip release yet (v0.5.12.post1 was branched earlier). Plain chat works on the pip release; only --tool-call-parser minicpm5 needs main:
pip install "git+https://github.com/sgl-project/sglang.git@main#subdirectory=python"
2. Recommended runtime env vars
export VLLM_WORKER_MULTIPROC_METHOD=spawn
export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1
export SGLANG_DISABLE_CUDNN_CHECK=1
3. Launch
CUDA_VISIBLE_DEVICES=${GPU_ID} python -m sglang.launch_server \
--model-path "${MODEL_PATH}" \
--served-model-name MiniCPM5-2B \
--dtype bfloat16 \
--context-length ${CTX_LEN} \
--mem-fraction-static ${MEM_FRAC} \
--tool-call-parser ${TOOL_PARSER} \
--host 0.0.0.0 \
--port ${PORT}
Wait for The server is fired up and ready to roll! .
Speculative decoding (DSpark): we also release MiniCPM5-2B-DSpark, a DSpark draft model trained for MiniCPM5-2B. Enable it in SGLang to accelerate decoding while keeping the target model's outputs unchanged:
CUDA_VISIBLE_DEVICES=${GPU_ID} python -m sglang.launch_server \
--model-path "${MODEL_PATH}" \
--served-model-name MiniCPM5-2B \
--dtype bfloat16 \
--context-length ${CTX_LEN} \
--mem-fraction-static ${MEM_FRAC} \
--tool-call-parser ${TOOL_PARSER} \
--host 0.0.0.0 \
--port ${PORT} \
--speculative-algorithm DSPARK \
--speculative-draft-model-path openbmb/MiniCPM5-2B-DSpark \
--speculative-dspark-block-size 7
4. Validate
curl http://localhost:${PORT}/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "MiniCPM5-2B",
"messages": [{"role": "user", "content": "1+1=?"}],
"temperature": 1.0, "top_p": 0.95, "max_tokens": 64,
"chat_template_kwargs": {"enable_thinking": true}
}'
Expected: choices[0].message.content contains "2".
Tool calling
SGLang includes a native MiniCPM5 XML tool-call parser. Keep TOOL_PARSER=minicpm5 (or auto) when launching, then send an OpenAI-style tools request:
curl http://localhost:${PORT}/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "MiniCPM5-2B",
"messages": [{"role": "user", "content": "What is the weather in Beijing?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}],
"tool_choice": "auto",
"temperature": 1.0, "top_p": 0.95,
"max_tokens": 256
}'
Offline / batched (Engine API)
import sglang as sgl
llm = sgl.Engine(model_path="${MODEL_PATH}", tp_size=1, mem_fraction_static=0.8, context_length=131072)
outputs = llm.generate(
["用一句话解释什么是 GQA。"],
sampling_params={"temperature": 1.0, "top_p": 0.95, "max_new_tokens": 1024,
"skip_special_tokens": False},
)
print(outputs)
Common pitfalls
GLIBCXX_3.4.31 not found(only if you hit it — not universal): conda Python ships an olderlibstdc++than the SGLang wheel was built against. Force-load the system one:LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6 python -m sglang.launch_server ...
When NOT to use
- Production servi
常见问题
每个发布版本都支持工具调用吗?
还不是。这个技能说明,MiniCPM5 的工具解析器需要 SGLang 的主分支,而不是 pip 发布版。
需要哪种 GPU 环境?
这个技能面向 NVIDIA GPU,列出了 CUDA 13 驱动,并为 CUDA 12 驱动提供了备选方案。
什么是 RadixAttention?
它是 SGLang 使用的前缀缓存,这个技能将其作为服务功能的一部分进行了说明。
详情
作者的原始描述
Serve MiniCPM5-1B or MiniCPM5-2B via SGLang as an OpenAI-compatible HTTP server with RadixAttention prefix cache and built-in MiniCPM5 tool-call parsing. Use when the user asks for "SGLang", "RadixAttention", "prefix cache", batch evaluation, tool calling, or wants a high-concurrency NVIDIA-GPU server alternative to vLLM.
repo: OpenBMB/MiniCPM
热度
- GitHub 星标
- 12k
- 排名
- #11535
- 许可证
- Apache-2.0
- 更新时间
- 2026/9/21
评论
- …
同一仓库的更多技能
minicpm5-deploy-litert
12k帮你的智能体使用谷歌的 LiteRT-LM 运行时,在电脑或 Android 手机上运行 MiniCPM5 模型,只需一个模型文件。
minicpm5-deploy-llama-cpp
12k向你的智能体展示如何使用 llama.cpp,借助现成的 GGUF 文件,在 CPU 或家用显卡上运行 MiniCPM5 模型。
minicpm5-deploy-lmstudio
12k帮你的智能体在 LM Studio 中运行 MiniCPM5 模型,这是一款带聊天窗口的桌面应用,并启动其本地 OpenAI 风格服务器。
minicpm5-deploy-mlx
12k帮你的智能体使用苹果的 MLX 框架,在 Apple 芯片 Mac 上原生运行 MiniCPM5 模型,实现快速的本地聊天和文本生成。