股票
板块
用户
资讯
首页
天眼
自选
发现
开户
首页
天眼
自选
发现
我的

基于昇腾AI部署Qwen3.5系列模型,实操指南发布!



​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠继除夕开源Qwen3.5-397B-A17B之后,通义千问(Qwen)团队再度开源三款中型模型:Qwen3.5-35B-A3B、Qwen3.5-122B-A10B、Qwen3.5-27B。基于混合注意力机制与高稀疏MoE架构创新,新模型在更小总参数和激活参数规模下实现性能跃升。


昇腾致力于以极致的算力和开放的生态,加速AI产业的繁荣,全面支持Qwen等业界主流最新模型。此次昇腾也第一时间进行了推理支持和优化,基于昇腾Atlas 800 A3产品,现在您可以在SGLang和vLLM上直接体验这3个模型的推理。


实操上手指南


我们将以Qwen3.5-122B-A10B为例,详细拆解昇腾环境下基于vLLM和SGLang的部署推理流程。其他规格的Qw​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠en3.5部署指南,请在文末“更多推理指导”中查找。


基于vLLM进行实操


环境准备


硬件设备


本指南基于Atlas 800 A3单机验证。


模型权重下载


Qwen3.5-122B-A10B(BF16 版本):

https://ai.atomgit.com/hf_mirrors/Qwen/Qwen3.5-122B-A10B


注:建议将模型权重下载至多节点共享目录,例如 /root/.cache/。


软件安装


推荐使用官方Docker镜像直接部署,您亦可使用源码在您的环境直接构建。


官方Docker镜像


您可以通过镜像链接(https://ai.gitcode.com/Eco-Tech/Qwen3.5-397B-A17B-w8a8-mtp/tree/main/vll​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠m-image)下载镜像压缩包来进行部署,具体流程如下:


# 使用docker加载下载的镜像压缩包# 根据您的环境更新要加载的vllm-ascend镜像压缩包名称,以下以A3 arm为例:docker load -i Vllm-ascend-Qwen3_5-A3-Ubuntu-v0.tar 
# 根据您的设备更新 --device(Atlas A3:/dev/davinci[0-15])。# 注意:您需要提前将权重下载至 /root/.cache。# 更新 vllm-ascend 镜像,并配置对应的Image名export IMAGE=vllm-ascend:qwen3_5-v0-a3 export NAME=vllm-ascend
# 使用定义的变量运行容器# 注意:若使用 D​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠ocker 桥接网络,请提前开放可供多节点通信的端口docker run --rm \--name $NAME \--net=host \--shm-size=100g \--device /dev/davinci0 \--device /dev/davinci1 \--device /dev/davinci2 \--device /dev/davinci3 \--device /dev/davinci4 \--device /dev/davinci5 \--device /dev/davinci6 \--device /dev/davinci7 \--device /dev/davinci_manager \--device /dev/devmm_svm \--device /dev/h​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠isi_hdc \-v /usr/local/dcmi:/usr/local/dcmi \-v /usr/local/Ascend/driver/tools/hccn_tool:/usr/local/Ascend/driver/tools/hccn_tool \-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 $IMAGE bash

源码构建


如果您不希望使用上述Docker镜像,也可通过源码完整构建:保证你的环境成功安装了CANN 8.5.0。


从源码安装vllm-ascend,请参考安装指南(https://docs.vllm.ai/projects/ascend/en/latest/installation.html)。


从源码安装vllm-ascend后,您需要将vllm、vllm-ascend、transformers 升级至主分支:


# 升级 vllmgit clone https://gi​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠thub.com/vllm-project/vllm.gitcd vllmgit checkout a75a5b54c7f76bc2e15d3025d6git fetch origin pull/34521/head:pr-34521git merge pr-34521VLLM_TARGET_DEVICE=empty pip install -v .# 升级 vllm-ascendpip uninstall vllm-ascend -ygit clone https://github.com/vllm-project/vllm-ascend.gitcd vllm-ascendgit checkout c63b7a11888e9e1caeeff8git fetch origin pu​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠ll/6742/head:pr-6742git merge pr-6742pip install -v .# 重新安装 transformersgit clone https://github.com/huggingface/transformers.gitcd transformersgit reset --hard fc9137225880a9d03f130634c20f9dbe36a7b8bfpip install .

启动推理


执行以下脚本进行在线推理。


export PYTORCH_NPU_ALLOC_CONF="expandable_segments:True"export HCCL_OP_EXPANSION_MODE="AIV"export HCCL_BUFF​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠SIZE=1024export OMP_NUM_THREADS=1export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so.2:$LD_PRELOADexport TASK_QUEUE_ENABLE=1vllm serve /root/.cache/modelscope/hub/models/vllm-ascend/Qwen3.5-122B-A10B/ \    --served-model-name "qwen3.5" \    --host 0.0.0.0 \    --port 8010 \    --data-parallel-size 1 \    --tensor-parallel-size 8 \    --max-model-len 5​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠000 \    --max-num-batched-tokens 16384 \    --max-num-seqs 128 \    --gpu-memory-utilization 0.94 \    --trust-remote-code \    --async-scheduling \    --allowed-local-media-path / \    --mm-processor-cache-gb 0 \ --enforce-eager \    --additional-config '{"enable_cpu_binding":true, "multistream_overlap_shared_expert": true}'


执行以下脚本向模型发送一条请求:


curl http://localhost:8000/​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠v1/completions \  -H "Content-Type: application/json" \  -d '{        "prompt": "The future of AI is",        "path": "/path/to/model/Qwen3.5-122B-A10B/",        "max_tokens": 100,        "temperature": 0        }'


执行结束后,您可以看到模型回答如下:


Prompt: 'The future of AI is', Generated text: ' not just about building smarter machines, but about creating systems that can collaborate with humans in meaningful, ethic​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠al, and sustainable ways. As AI continues to evolve, it will increasingly shape how we live, work, and interact — and the decisions we make today will determine whether this future is one of shared prosperity or deepening inequality.\n\nThe rise of generative AI, for example, has already begun to transform creative industries, education, and scientific research. Tools like Ch​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠atGPT, Midjourney, and'

也可执行以下脚本向模型发送一条多模态请求:


curl http://localhost:8000/v1/completions \  -H "Content-Type: application/json" \    -d '{        "model": "qwen3.5",        "messages": [            {"role": "system", "content": "You are a helpful assistant."},            {"role": "user", "content": [                {"type": "image_url", "image_url": {"url": "

"
}},
                {"type": "text", "text": "What is the text in the ill​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠ustrate?"}            ]}        ]    }'


执行结束后,您可以看到模型回答如下:


{"id":"chatcmpl-9dab99d55addd8c0","object":"chat.completion","created":1771060145,"model":"qwen3.5","choices":[{"index":0,"message":{"role":"assistant","content":"TONGYI Qwen","refusal":null,"annotations":null,"audio":null,"function_call":null,"tool_calls":[],"reasoning":null},"logprobs"​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠:null,"finish_reason":"stop","stop_reason":null,"token_ids":null}],"service_tier":null,"system_fingerprint":null,"usage":{"prompt_tokens":112,"total_tokens":119,"completion_tokens":7,"prompt_tokens_details":null},"prompt_logprobs":null,"prompt_token_ids":null,"kv_transfer_params":null}

基于SGLang进行实操


环境准备


硬件设备


本指南基于Atlas 800 A​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠3单机验证。


模型权重下载


Qwen3.5-122B-A10B(BF16 版本):

https://ai.atomgit.com/hf_mirrors/Qwen/Qwen3.5-122B-A10B


注:建议将模型权重下载至多节点共享目录,例如 /root/.cache/。


软件安装


官方Docker镜像


NPU运行时环境所需的依赖已集成到Docker镜像中,推荐直接使用镜像部署。


#Atlas 800 A3docker pull quay.io/ascend/sglang:v0.5.9-cann8.5.0-a3#Atlas 800 A2docker pull quay.io/ascend/sglang:v0.5.9-cann8.5.0-910b
#start contai​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠nerdocker run -itd --shm-size=16g --privileged=true --name ${NAME} \--privileged=true --net=host \-v /var/queue_schedule:/var/queue_schedule \-v /etc/ascend_install.info:/etc/ascend_install.info \-v /usr/local/sbin:/usr/local/sbin \-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \-v /usr/local/Ascend/firmware:/usr/local/Ascend/firm​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠ware \--device=/dev/davinci0:/dev/davinci0 \--device=/dev/davinci1:/dev/davinci1 \--device=/dev/davinci2:/dev/davinci2 \--device=/dev/davinci3:/dev/davinci3 \--device=/dev/davinci4:/dev/davinci4 \--device=/dev/davinci5:/dev/davinci5 \--device=/dev/davinci6:/dev/davinci6 \--device=/dev/davinci7:/dev/davinci7 \--device=/dev/davin​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠ci8:/dev/davinci8 \--device=/dev/davinci9:/dev/davinci9 \--device=/dev/davinci10:/dev/davinci10 \--device=/dev/davinci11:/dev/davinci11 \--device=/dev/davinci12:/dev/davinci12 \--device=/dev/davinci13:/dev/davinci13 \--device=/dev/davinci14:/dev/davinci14 \--device=/dev/davinci15:/dev/davinci15 \--device=/dev/davinci_manager:/​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠dev/davinci_manager \--device=/dev/hisi_hdc:/dev/hisi_hdc \--entrypoint=bash \quay.io/ascend/sglang:${tag}

启动推理


单节点部署,执行以下脚本进行在线推理。


# high performance cpuecho performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governorsysctl -w vm.swappiness=0sysctl -w kernel.numa_balancing=0sysctl -w kernel.sched_migration_cost_ns=50000# bind​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠ cpuexport SGLANG_SET_CPU_AFFINITY=1
unset https_proxyunset http_proxyunset HTTPS_PROXYunset HTTP_PROXYunset ASCEND_LAUNCH_BLOCKING# cannsource /usr/local/Ascend/ascend-toolkit/set_env.shsource /usr/local/Ascend/nnal/atb/set_env.sh
export STREAMS_PER_DEVICE=32export HCCL_BUFFSIZE=1000export HCCL_OP_EXPANSION_MODE=AIVexport HCCL_SOCKET​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠_IFNAME=loexport GLOO_SOCKET_IFNAME=lo
python3 -m sglang.launch_server \        --model-path $MODEL_PATH \        --attention-backend ascend \        --device npu \        --tp-size 8 --nnodes 1 --node-rank 0 \        --chunked-prefill-size 4096 --max-prefill-tokens 280000 \        --disable-radix-cache \        --trust-remote-code \        --host 127.0.0.1 \        --mem-fraction-static 0.7 \        --port 8000 \        --cuda-graph​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠-bs 16 \        --enable-multimodal \        --mm-attention-backend ascend_attn \        --dtype bfloat16


发送请求:


curl --location http://127.0.0.1:8000/v1/chat/completions --header 'Content-Type: application/json' --data '{  "model": "qwen3.5",  "messages": [    {      "role": "user",      "content": [        {          "type": "image_url",          "image_url": {"url": "/image_path/qwen.png"}         },        {"type": "text", "te​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠xt": "What is the text in the illustrate?"}      ]    }  ]}'


执行结束后,您可以看到模型回答如下:


{"id":"cdcd6d14645846e69cc486554f198154","object":"chat.completion","created":1772098465,"model":"qwen3.5","choices":[{"index":0,"message":{"role":"assistant","content":"The user is asking about the text present in the image. I will analyze the image to identify the text.\n</thin​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠k>\n\nThe text in the image is \"TONGyi Qwen\".","reasoning_content":null,"tool_calls":null},"logprobs":null,"finish_reason":"stop","matched_stop":248044}],"usage":{"prompt_tokens":98,"total_tokens":138,"completion_tokens":40,"prompt_tokens_details":null,"reasoning_tokens":0},"metadata":{"weight_version":"default"}}

更多推理指导


更多SG​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠Lang、vLLM框架上3个模型的详细实操指导,请参考以下的社区指南链接进行体验:




基于vLLM部署指南




Qwen3.5B-35B-A3B :

https://ai.gitcode.com/vLLM_Ascend/Qwen3.5-35B-A3B

https://modelers.cn/models/vLLM_Ascend/Qwen3.5-35B-A3B


Qwen3.5B-122B-A10B :

https://ai.gitcode.com/vLLM_Ascend/Qwen3.5-122B-A10B

https://modelers.cn/models/vLLM_Ascend/Qwen3.5-122B-A10B


Qwen3.5B-27B :

https://​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠ai.gitcode.com/vLLM_Ascend/Qwen3.5-27B

https://modelers.cn/models/vLLM_Ascend/Qwen3.5-27B



基于SGLang部署指南




SGLang社区文档:

https://docs.sglang.io/platforms/ascend_npu_qwen3_5_examples.html


Qwen3.5-122B-A10B:

https://modelers.cn/models/SGLangAscend/Qwen3.5-122B-A10B

https://ai.gitcode.com/SGLangAscend/Qwen3.5-122B-A10B


Qwen3.5-27B:

http​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠s://modelers.cn/models/SGLangAscend/Qwen3.5-27B

https://ai.gitcode.com/SGLangAscend/Qwen3.5-27B


Qwen3.5-35B-A3B:

https://modelers.cn/models/SGLangAscend/Qwen3.5-35B-A3B

https://gitcode.com/SGLangAscend/Qwen3.5-35B-A3B

​‌‍⁠‌⁠​​‌⁠​⁠‌‌‌‌‍‍‍⁠‌⁠‍‌‍​‌‍‍​​⁠‍‌⁠
原文链接
多空观点 观点仅供交流,不构成投资建议
点赞
踩一踩
收藏
分享

评论 (0)

0/200
声明:社区内容仅代表用户个人观点,不构成任何投资建议。投资有风险,入市需谨慎。