本文介绍如何在昇腾 NPU 上部署 Qwen3-ASR 语音识别模型,使用 vLLM-Ascend 作为推理框架,通过容器化方式快速启动服务。

环境要求

  • 昇腾 NPU(支持 910B 系列)
  • Docker
  • 预装 Ascend 驱动

部署流程

1. 下载模型

pip install modelscope
modelscope download --model Qwen/Qwen3-ASR-1.7B

下载完成会显示类似:

Downloading Model from https://www.modelscope.cn to directory: /root/.cache/modelscope/hub/models/Qwen/Qwen3-ASR-1.7B

2. 查看 NPU 信息

宿主机上执行 npu-smi info 查看 NPU 状态:

[root@<hostname> ~]# npu-smi info
+------------------------------------------------------------------------------------------------+
| npu-smi 25.2.3                   Version: 25.2.3                                               |
+---------------------------+---------------+----------------------------------------------------+
| NPU   Name                | Health        | Power(W)    Temp(C)           Hugepages-Usage(page)|
| Chip                      | Bus-Id        | AICore(%)   Memory-Usage(MB)  HBM-Usage(MB)        |
+===========================+===============+====================================================+
| 0     <NPU型号>             | OK            | 95.7        39                0    / 0             |
| 0                         | 0000:XX:00.0  | 0           0    / 0          3197 / 65536         |
+===========================+===============+====================================================+
| 1     <NPU型号>             | OK            | 94.1        37                0    / 0             |
| 0                         | 0000:XX:00.0  | 0           0    / 0          3197 / 65536         |
+===========================+===============+====================================================+
| ...                          ...        | ...           ...                                |
+===========================+===============+====================================================+
+---------------------------+---------------+----------------------------------------------------+
| NPU     Chip              | Process id    | Process name             | Process memory(MB)      |
+===========================+===============+====================================================+
| No running processes found in NPU 0                                                            |
+===========================+===============+====================================================+
| ...                          ...        | ...           ...                                |
+===========================+===============+====================================================+
[root@<hostname> ~]#

3. 启动容器

export IMAGE=quay.io/ascend/vllm-ascend:v0.23.0.post1-openeuler

docker run  \
    --name vllm-ascend-asr \
    --shm-size=1g \
    --net host \
    --device /dev/davinci7 \
    --device /dev/davinci_manager \
    --device /dev/devmm_svm \
    --device /dev/hisi_hdc \
    -v /usr/local/dcmi:/usr/local/dcmi \
    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
    -v /usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64 \
    -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
    -v /etc/ascend_install.info:/etc/ascend_install.info \
    -v /root/.cache:/root/.cache \
    -it -d $IMAGE bash

4. 进入容器并查看 NPU

docker exec -it vllm-ascend-asr bash

容器内查看显卡信息:

[root@<hostname> workspace]# npu-smi info
+------------------------------------------------------------------------------------------------+
| npu-smi 25.2.3                   Version: 25.2.3                                               |
+---------------------------+---------------+----------------------------------------------------+
| NPU   Name                | Health        | Power(W)    Temp(C)           Hugepages-Usage(page)|
| Chip                      | Bus-Id        | AICore(%)   Memory-Usage(MB)  HBM-Usage(MB)        |
+===========================+===============+====================================================+
| 7     <NPU型号>             | OK            | 94.2        43                0    / 0             |
| 0                         | 0000:XX:00.0  | 0           0    / 0          3197 / 65536         |
+===========================+===============+====================================================+
+---------------------------+---------------+----------------------------------------------------+
| NPU     Chip              | Process id    | Process name             | Process memory(MB)      |
+===========================+===============+====================================================+
| No running processes found in NPU 7                                                            |
+===========================+===============+====================================================+
[root@<hostname> workspace]#

5. 启动 vLLM 服务

vllm serve /root/.cache/modelscope/hub/models/Qwen/Qwen3-ASR-1.7B \
  --served-model-name qwen3-asr \
  --tensor-parallel-size 1 \
  --max-model-len 4096 \
  --gpu-memory-utilization 0.9 \
  --enforce-eager \
  --port 8001

6. 验证服务

curl http://<your-server-ip>:8001/v1/chat/completions     -H "Content-Type: application/json"     -d '{
        "model": "qwen3-asr",
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "type": "audio_url",
                        "audio_url": {
                            "url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-ASR-Repo/asr_en.wav"
                        }
                    }
                ]
            }
        ]
    }'

返回结果示例:

{"id":"chatcmpl-b826d4875713cafc","object":"chat.completion","created":1791807431,"model":"qwen3-asr","choices":[{"index":0,"message":{"role":"assistant","content":"language English<asr_text>Uh huh. Oh yeah, yeah. He wasn't even that big when I started listening to him, but and his solo music didn't do overly well, but he did very well when he started writing for other people.","refusal":null,"annotations":null,"audio":null,"function_call":null,"reasoning":null},"logprobs":null,"finish_reason":"stop","stop_reason":null,"token_ids":null,"routed_experts":null}],"service_tier":null,"system_fingerprint":"vllm-0.23.0-d33e1ed6","usage":{"prompt_tokens":211,"total_tokens":260,"completion_tokens":49,"prompt_tokens_details":null,"completion_tokens_details":null},"prompt_logprobs":null,"prompt_token_ids":null,"prompt_text":null,"kv_transfer_params":null}

服务成功响应后,说明 Qwen3-ASR 已部署完成。

Logo

作为“人工智能6S店”的官方数字引擎,为AI开发者与企业提供一个覆盖软硬件全栈、一站式门户。

更多推荐