如何快速上手Qwen3.5-27B:从环境准备到单节点部署的终极教程

【免费下载链接】Qwen3.5-27B 【免费下载链接】Qwen3.5-27B 项目地址: https://ai.gitcode.com/hf_mirrors/vLLM_Ascend/Qwen3.5-27B

Qwen3.5-27B是Qwen系列最新的旗舰多模态模型,采用MoE架构,在保持极强模型能力的同时显著降低推理成本。本文将为新手用户提供从环境准备到单节点部署的完整指南,帮助你快速体验这一强大AI模型的魅力。

一、Qwen3.5-27B模型简介

Qwen3.5-27B作为新一代多模态大模型,具备以下核心特性:

  • 原生多模态能力(Vision Encoder + 图文融合)
  • 混合注意力机制(Full Attention与Linear-Attention交替)
  • MTP多Token预测分支
  • 高性能MoE专家路由与共享专家机制

该模型支持256K的超长上下文,能够处理复杂的多模态任务,为用户提供更智能、更全面的AI服务。

二、环境准备的黄金步骤

2.1 获取模型权重

首先需要下载Qwen3.5-27B的BF16版本模型权重,建议将其下载至共享目录,如/root/.cache/,以便后续使用。

2.2 两种安装方式任选

2.2.1 官方Docker镜像(推荐新手)

使用官方Docker镜像是最简单快捷的方式:

# 使用docker加载下载的镜像压缩包(以A3 arm为例)
docker load -i Vllm-ascend-Qwen3_5-A3-Ubuntu-v0.tar

# 设置环境变量
export IMAGE=vllm-ascend:qwen3_5-v0-a3
export NAME=vllm-ascend

# 运行容器
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/hisi_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
2.2.2 源码构建(适合高级用户)

如果不希望使用Docker镜像,也可以通过源码构建:

  1. 确保环境已安装CANN 8.5.0
  2. 从源码安装vllm-ascend,参考官方安装指南
  3. 升级相关依赖至指定版本:
# 升级vllm
git clone https://github.com/vllm-project/vllm.git
cd vllm
git checkout a75a5b54c7f76bc2e15d3025d6
git fetch origin pull/34521/head:pr-34521
git merge pr-34521
VLLM_TARGET_DEVICE=empty pip install -v .

# 升级vllm-ascend
pip uninstall vllm-ascend -y
git clone https://github.com/vllm-project/vllm-ascend.git
cd vllm-ascend
git checkout c63b7a11888e9e1caeeff8
git fetch origin pull/6742/head:pr-6742
git merge pr-6742
pip install -v .

# 重新安装transformers
git clone https://github.com/huggingface/transformers.git
cd transformers
git reset --hard fc9137225880a9d03f130634c20f9dbe36a7b8bf
pip install .

三、A3系列单节点部署实战

3.1 启动推理服务

执行以下脚本启动Qwen3.5-27B的在线推理服务:

export PYTORCH_NPU_ALLOC_CONF="expandable_segments:True"
export HCCL_OP_EXPANSION_MODE="AIV"
export HCCL_BUFFSIZE=1024
export OMP_NUM_THREADS=1
export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so.2:$LD_PRELOAD
export TASK_QUEUE_ENABLE=1

vllm serve /root/.cache/modelscope/hub/models/vllm-ascend/Qwen3.5-27B/ \
    --served-model-name "qwen3.5" \
    --host 0.0.0.0 \
    --port 8010 \
    --data-parallel-size 1 \
    --tensor-parallel-size 4 \
    --max-model-len 5000 \
    --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}'

3.2 发送文本请求

服务启动后,可通过以下命令发送文本请求:

curl http://localhost:8000/v1/completions \
  -H "Content-Type: application/json" \
  -d '{
        "prompt": "The future of AI is",
        "path": "/path/to/model/Qwen3.5-27B/",
        "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, ethical, 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.'

3.3 体验多模态能力

Qwen3.5-27B还支持多模态输入,尝试发送包含图片的请求:

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": "https://modelscope.oss-cn-beijing.aliyuncs.com/resource/qwen.png"}},
                {"type": "text", "text": "What is the text in the illustrate?"}
            ]}
        ]
    }'

四、模型评估方法

4.1 精度评估

可使用AISBench进行精度评估,详细步骤请参阅官方文档中的使用AISBench进行精度评估

4.2 性能评估

同样可以使用AISBench进行性能评估,或参考vLLM基准测试了解更多性能测试方法。

五、注意事项

  1. 当前版本仍在性能优化中,仅为尝鲜体验
  2. 模型和数据集仅供非商业目的使用,请遵守对应License
  3. 使用过程中如发现问题,可提交issue反馈

通过以上步骤,你已经成功部署并体验了Qwen3.5-27B模型的基本功能。随着技术的不断发展,该模型将为更多应用场景提供强大的AI支持,赶快开始你的探索之旅吧!

【免费下载链接】Qwen3.5-27B 【免费下载链接】Qwen3.5-27B 项目地址: https://ai.gitcode.com/hf_mirrors/vLLM_Ascend/Qwen3.5-27B

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐