Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)12k · #11533

minicpm5-deploy-mlx

Skill này làm gì

Skill này hướng dẫn AI chạy MiniCPM5 trên máy Mac Apple Silicon bằng framework MLX của Apple. Skill dành cho người dùng Mac muốn lựa chọn cục bộ nhanh nhất trên máy của mình.

Khi nào nên dùng

  • ✓Khi bạn có máy Mac dòng M và muốn chạy MiniCPM5 cục bộ.
  • ✓Khi bạn muốn dùng mlx_lm để sinh văn bản từ dòng lệnh.
  • ✓Khi bạn có một model Hugging Face và muốn chuyển nó sang định dạng MLX trên máy Mac.

Liên kết skill

https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-deploy-mlx/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-deploy-mlx/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Giúp tôi chạy MiniCPM5 trên máy Mac bằng MLX và kiểm tra xem nó có trả lời đúng 1+1 không.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill cài các công cụ mlx-lm, chạy một prompt thử với một model MLX có sẵn, và cũng có thể chuyển một model bạn đã có sang định dạng MLX.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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 on mlx-lm < 0.31 (older versions ignore multi-id eos_token_id lists). Upgrade, or pass --extra-eos-token "<|im_end|>" as a manual override — <|im_end|> is token id 130073 and is already listed in generation_config.json on 0.31+.

When NOT to use

  • Not on Apple Silicon → minicpm5-deploy-llama-cpp (CPU/CUDA) or minicpm5-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

docs/deployment/mlx.md

Câu hỏi thường gặp

Tôi có cần tự chuyển đổi model không?

Thường là không. Skill khuyên dùng một kho MLX có sẵn khi nó tồn tại.

Làm sao biết nó hoạt động?

Skill nói câu trả lời phải chứa số 2 cho câu hỏi 1+1.

Có chạy được máy chủ cục bộ không?

Có. Skill có máy chủ tương thích OpenAI qua mlx_lm.server.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
12k
Vị trí xếp hạng
#11533
Giấy phép
Apache-2.0
Cập nhật
21/9/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự