minicpm5-deploy-mlx
它能做什么
这个技能指导你的 AI 使用苹果的 MLX 框架,在 Apple 芯片 Mac 上运行 MiniCPM5。适合希望在自己的机器上获得最快本地运行方式的 Mac 用户。
适用场景
- ✓你有 M 系列芯片的 Mac,想在本地运行 MiniCPM5 的时候。
- ✓你想用 mlx_lm 从命令行生成文本的时候。
- ✓你有一个 Hugging Face 模型,想在 Mac 上将其转换为 MLX 格式的时候。
技能链接
https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-deploy-mlx/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我用 MLX 在我的 Mac 上运行 MiniCPM5,并检查它对 1+1 是否给出正确答案。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能安装 mlx-lm 工具,使用现成的 MLX 模型运行测试提示,也可以把你已有的模型转换为 MLX 格式。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Deploy MiniCPM5-1B and MiniCPM5-2B with MLX (Apple Silicon)
Apple's on-device tensor framework. Highest throughput on M-series. Stays inside one Python process — no separate server, no llama.cpp build chain.
Required input
| Var | Example | Default |
|---|---|---|
MLX_REPO |
openbmb/MiniCPM5-2B-MLX (pre-converted 4-bit affine) |
required; openbmb/MiniCPM5-1B-MLX also works |
OR HF_REPO + QUANT |
openbmb/MiniCPM5-2B, 4bit or bf16 |
for local conversion |
MAX_TOKENS |
200 |
200 |
Steps
1. Install (once)
pip install "mlx-lm>=0.31" "gguf"
2A. Use a pre-converted MLX repo (recommended when available)
mlx_lm.generate --model "${MLX_REPO}" \
--prompt "<|im_start|>user
1+1=?<|im_end|>
<|im_start|>assistant
" \
--max-tokens ${MAX_TOKENS} --temp 1.0 --top-p 0.95
2B. Convert from a HF checkpoint locally (advanced)
Use mlx_lm.convert only if you have a self-trained HF fp16 checkpoint:
HF=/path/to/your-fp16-hf
# Convert: bf16
mlx_lm.convert --hf-path "$HF" --mlx-path ./minicpm5-mlx-bf16
# Convert: 4-bit (smaller / faster)
mlx_lm.convert --hf-path "$HF" --mlx-path ./minicpm5-mlx-q4 -q --q-bits 4
Then run as in 2A.
3. Validate
The reply should contain "2" for 1+1=?.
OpenAI-compatible server (mlx-lm)
mlx_lm.server --model "${MLX_REPO}" --host 127.0.0.1 --port 8000
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "default",
"messages": [{"role":"user","content":"1+1=?"}],
"temperature": 1.0, "top_p": 0.95, "max_tokens": 64
}'
Common pitfalls
- Slow first generate: MLX JIT-compiles kernels on first call (~5-10 s); subsequent calls hit the warm cache.
- Model runs past
<|im_end|>: only happens onmlx-lm < 0.31(older versions ignore multi-ideos_token_idlists). Upgrade, or pass--extra-eos-token "<|im_end|>"as a manual override —<|im_end|>is token id 130073 and is already listed ingeneration_config.jsonon 0.31+.
When NOT to use
- Not on Apple Silicon →
minicpm5-deploy-llama-cpp(CPU/CUDA) orminicpm5-deploy-vllm(CUDA) - Want a desktop GUI →
minicpm5-deploy-lmstudio(LM Studio bundles an MLX runtime) - Want one-line CLI run →
minicpm5-deploy-ollama
Reference
常见问题
我需要自己转换模型吗?
通常不需要。如果存在现成的 MLX 仓库,这个技能会推荐使用它。
我怎么知道它是否正常工作?
这个技能说明,对于 1+1 这个问题,回复应包含数字 2。
它可以运行本地服务器吗?
可以。这个技能通过 mlx_lm.server 提供兼容 OpenAI 的服务器。
详情
作者的原始描述
Run MiniCPM5-1B or MiniCPM5-2B natively on Apple Silicon with Apple's MLX framework. Use when the user has an Apple Silicon Mac and asks for "MLX", "mlx_lm", "mlx_lm.convert", "mlx_lm.generate", or wants the fastest path on Apple Silicon.
repo: OpenBMB/MiniCPM
热度
- GitHub 星标
- 12k
- 排名
- #11533
- 许可证
- 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-ollama
12k教你的智能体在 Mac 或 Linux 笔记本电脑上使用 Ollama 运行 MiniCPM5,只需一个 GGUF 文件和几条简单命令。