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

minicpm5-deploy-vllm-ascend

Skill này làm gì

Skill này hướng dẫn AI chạy MiniCPM5-2B trên chip Huawei Ascend bằng vLLM-Ascend. Skill dành cho các đội có phần cứng Ascend và cần một máy chủ cho model.

Khi nào nên dùng

  • ✓Khi bạn có Huawei Ascend NPU và muốn chạy MiniCPM5-2B.
  • ✓Khi bạn cần thiết lập CANN, torch_npu hoặc cài đặt thiết bị Ascend cho model.
  • ✓Khi bạn muốn một máy chủ MiniCPM5 tương thích OpenAI trên phần cứng Ascend.

Liên kết skill

https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-deploy-vllm-ascend/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-vllm-ascend/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-2B trên máy chủ Huawei Ascend của chúng tôi bằng vLLM và kiểm tra xem API có trả lời không.”

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

Cách hoạt động

Skill thiết lập môi trường vLLM và vLLM-Ascend khớp nhau, chọn các thiết bị Ascend, khởi động máy chủ và kiểm thử bằng một yêu cầu chat.

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-2B with vLLM-Ascend

Use this skill for the BF16 / FP16 openbmb/MiniCPM5-2B checkpoint on Huawei Ascend NPU. vllm-ascend is installed alongside a matching vLLM release and supplies the Ascend backend.

Required input

Variable Example Default
MODEL_PATH openbmb/MiniCPM5-2B required
PORT 8000 8000
ASCEND_RT_VISIBLE_DEVICES 0 0
CTX_LEN 32768 32768; the native maximum is 131072
MEM_FRAC 0.85 0.85
TP_SIZE 1 number of visible devices

Accept either the Hugging Face id or a local directory containing the MiniCPM5-2B model files.

Prerequisites

Use a compatible Linux Ascend environment with CANN, PyTorch, and TorchNPU installed. Keep the vLLM and vLLM-Ascend versions matched. The basic serving recipe below follows the tested vllm==0.18.0 / vllm-ascend==0.18.0 pair.

Device visibility is controlled by ASCEND_RT_VISIBLE_DEVICES; CUDA_VISIBLE_DEVICES does not select Ascend devices.

Install

The prebuilt image is the simplest option for a compatible Ascend host. This is a minimal single-device example; adjust device nodes and driver mounts for the host hardware and image documentation.

docker run -it --net=host --shm-size=1g \
    --device /dev/davinci0 --device /dev/davinci_manager \
    --device /dev/devmm_svm --device /dev/hisi_hdc \
    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
    -v /usr/local/dcmi:/usr/local/dcmi \
    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
    quay.io/ascend/vllm-ascend:v0.18.0

For an existing CANN environment:

pip install vllm==0.18.0 vllm-ascend==0.18.0 \
    --extra-index-url https://download.pytorch.org/whl/cpu

For built-in MiniCPM5 tool-call parsing, use the matching vllm==0.23.0 / vllm-ascend==0.23.0 stack described in Tool calling. The parser responses in the cookbook were produced with the upstream parser file on an older vLLM and a compatibility shim because the 0.23.0 stack was not available on the test hardware.

Prepare the environment

Run the CANN and NNAL setup scripts before starting vLLM. Change the paths if those components are installed elsewhere.

source /usr/local/Ascend/ascend-toolkit/set_env.sh
source /usr/local/Ascend/nnal/atb/set_env.sh

export ASCEND_RT_VISIBLE_DEVICES=${ASCEND_RT_VISIBLE_DEVICES:-0}
export LD_LIBRARY_PATH=$(python3 -c "import torch,os;print(os.path.dirname(torch.__file__))")/lib:\
$(python3 -c "import torch_npu,os;print(os.path.dirname(torch_npu.__file__))")/lib:$LD_LIBRARY_PATH

Check the driver and Python packages before loading the model:

npu-smi info
python3 -c "import torch, torch_npu; print(torch_npu.npu.is_available(), torch_npu.npu.device_count())"

If npu-smi reports a missing driver library, add the corresponding driver lib64 directories to LD_LIBRARY_PATH according to the host installation.

Launch the server

vllm serve "${MODEL_PATH}" \
    --served-model-name MiniCPM5-2B \
    --dtype bfloat16 \
    --max-model-len ${CTX_LEN:-32768} \
    --gpu-memory-utilization ${MEM_FRAC:-0.85} \
    --tensor-parallel-size ${TP_SIZE:-1} \
    --trust-remote-code \
    --port ${PORT:-8000}

Set TP_SIZE to the number of devices in ASCEND_RT_VISIBLE_DEVICES when using tensor parallelism.

Validate chat completions

MiniCPM5-2B is think-only. Use temperature=1.0, top_p=0.95, and enable_thinking=true:

curl http://localhost:${PORT:-8000}/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": 256,
        "chat_template_kwargs": {"enable_thinking": true}
    }'

Expect HTTP 200 and an answer containing 2 in choices[0].message.content. Leave enough max_tokens for the model's reasoning text.

Tool calling

MiniCPM5-2B emits XML-style tool calls. This section requires matching vLLM and vLLM-Ascend 0.23.0; that release includes the minicpm5 parser in the OpenAI server layer, so no parser plugin file is needed:

pip install vllm==0.23.0
pip install vllm-ascend==0.23.0 \
    --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi
vllm serve "${MODEL_PATH}" \
    --served-model-name MiniCPM5-2B \
    --dtype bfloat16 \
    --max-model-len ${CTX_LEN:-3276
Câu hỏi thường gặp

Có chạy trên GPU NVIDIA không?

Không. Skill dành cho hệ thống Huawei Ascend NPU và chọn thiết bị bằng ASCEND_RT_VISIBLE_DEVICES.

Skill dựa vào những phiên bản nào?

Skill nói cặp đã thử nghiệm là vllm 0.18.0 và vllm-ascend 0.18.0, và hai phiên bản phải khớp nhau.

Độ dài ngữ cảnh mặc định là bao nhiêu?

Mặc định là 32768, còn độ dài tối đa gốc của model là 131072.

Chi tiết

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

Deploy MiniCPM5-2B with vLLM on Huawei Ascend NPU using vLLM-Ascend. Use when the user mentions vLLM-Ascend, Ascend NPU, Huawei Ascend, CANN, torch_npu, davinci devices, or wants an OpenAI-compatible MiniCPM5 server on Ascend hardware.

repo: OpenBMB/MiniCPM

Độ phổ biến

Sao GitHub
12k
Vị trí xếp hạng
#11537
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ự