## 一、项目概述
### 1.1 部署目标
在 8 卡海光 DCU K100-AI 服务器上,部署三个模型组成完整的 RAG 知识库服务,**8 张卡全部利用,零空闲**,Embedding 和 Reranker 各部署 2 个实例通过 Nginx 负载均衡,提升多用户并发文档上传场景下的吞吐量:
| 模型 | 用途 | 分配卡数 | DCU 卡号 | 端口 |
|------|------|---------|---------|------|
| Qwen3.5-122B-A10B-GPTQ-Int4 | LLM 对话模型 | 4 卡 | DCU 0-3 | 8001 |
| Qwen3-Reranker-4B #1 | 知识库重排序(实例1) | 1 卡 | DCU 4 | 8002 |
| Qwen3-Embedding-8B #1 | 知识库向量化(实例1) | 1 卡 | DCU 5 | 8003 |
| Qwen3-Embedding-8B #2 | 知识库向量化(实例2) | 1 卡 | DCU 6 | 8004 |
| Qwen3-Reranker-4B #2 | 知识库重排序(实例2) | 1 卡 | DCU 7 | 8005 |
| Nginx 负载均衡 | Embedding 统一入口 | - | - | **8030** |
| Nginx 负载均衡 | Reranker 统一入口 | - | - | **8031** |
> **对外只暴露 3 个端口**:8001(LLM)、8030(Embedding 负载均衡)、8031(Reranker 负载均衡)
### 1.2 服务器配置
| 项目 | 规格 |
|------|------|
| CPU | 2×Hygon 7380 (32 Core, 2.2GHz) |
| GPU | 8×海光 DCU K100-AI (64GB/卡) |
| 内存 | 1024GB (16×64GB) |
| 系统盘 | 2×480G SATA SSD |
| 数据盘 | 2×3.2T SSD |
### 1.3 关于 122B 模型为什么用 GPTQ-Int4
Qwen3.5-122B-A10B 的 BF16 版本权重大小约 244GB,4 张 K100-AI 总显存 256GB,可用显存(按 0.925 利用率)约 236GB,> **BF16 装不下**(244GB > 236GB)。
采用官方 GPTQ-Int4 量化版本后,权重降至约 74GB(含索引文件),4 卡总共 236GB 可用显存,扣除权重还剩 ~160GB 用于 KV Cache,完全满足日常推理需求。
- 量化模型下载:`ModelScope` [Qwen/Qwen3.5-122B-A10B-GPTQ-Int4](https://modelscope.cn/models/Qwen/Qwen3.5-122B-A10B-GPTQ-Int4)
- 量化模型精度:Int4 量化对 MoE 模型的精度影响可控,实测对话质量接近 BF16
> **参考**:sourcefind 官方文档标注 K100AI 上 Qwen3.5-122B-A10B BF16 最低需要 **8 卡**。
### 1.4 重要踩坑记录
以下问题在实际部署中遇到过,务必注意:
| 问题 | 原因 | 解决方案 |
|------|------|---------|
| **FP8 量化模型无法启动** | K100-AI 不支持 FP8 MoE 后端,报错 `No FP8 MoE backend` | K100-AI 只能用 BF16 或 GPTQ 量化,FP8 仅支持 BW1100/BW1101 |
| **GPTQ 必须用 float16** | GPTQ 量化不支持 bfloat16,报错 `torch.bfloat16 is not supported for quantization method gptq` | 启动参数用 `--dtype float16` 而非 `--dtype bfloat16` |
| **注意力头数必须被 TP 整除** | vLLM 张量并行要求 `num_attention_heads % tensor_parallel_size == 0` | 122B 头数 32,只能用 TP=1/2/4/8,不能用 TP=3/6 |
| **Qwen3.5 默认开启 thinking mode** | MoE 模型可能输出异常符号(如连续感叹号) | 必须加 `--default-chat-template-kwargs '{"enable_thinking": false}'` |
| **vLLM DCU 版不支持专家并行** | `--enable-expert-parallelism` 参数不存在 | 只能使用张量并行(TP),无法使用 EP |
---
## 二、软件环境说明
### 2.1 Docker 镜像
本方案使用两个不同的 Docker 镜像,因为不同模型需要不同的 vLLM 版本:
| 容器 | 镜像 | vLLM 版本 | 用途 |
|------|------|-----------|------|
| llm-server | `harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm018-ubuntu22.04-dtk26.04-gemma4-0413` | 0.18.1 | Qwen3.5-122B |
| reranker-emb-server | `harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-py3.10` | 0.11.0 | Reranker + Embedding |
### 2.2 软件版本
| 软件 | LLM 容器 | Reranker/Embedding 容器 |
|------|---------|----------------------|
| DTK | 26.04 | 26.04 |
| Python | 3.10.12 | 3.10.12 |
| vLLM | 0.18.1+das.3266200.dtk2604 | 0.11.0+das.opt1.rc4.dtk2604 |
| PyTorch | 2.10.0+das.opt1.dtk2604 | 2.5.1+das.opt1.dtk2604 |
| Transformers | 5.5.0 | 4.57.6 |
### 2.3 前置条件
- 操作系统已安装 Docker(建议 20.10+)
- 已安装海光 DCU 驱动(hyhal)
- 服务器可访问 `harbor.sourcefind.cn` 镜像仓库(需注册光源平台账号)
- 服务器可访问 ModelScope 或 HuggingFace 下载模型
---
## 三、模型下载
### 3.1 创建模型存储目录
```bash
# 在数据盘上创建模型存储目录(推荐使用 SSD 数据盘)
mkdir -p /data/models
```
### 3.2 下载 Qwen3.5-122B-A10B-GPTQ-Int4
```bash
# 安装 modelscope CLI(如果未安装)
pip install modelscope
# 下载模型(约 61GB,耗时较长,建议用 nohup 或 tmux)
modelscope download --model Qwen/Qwen3.5-122B-A10B-GPTQ-Int4 --local_dir /data/models/Qwen3.5-122B-A10B-GPTQ-Int4
```
也可以用 git clone(需安装 git-lfs):
```bash
git lfs install
git clone https://www.modelscope.cn/Qwen/Qwen3.5-122B-A10B-GPTQ-Int4.git /data/models/Qwen3.5-122B-A10B-GPTQ-Int4
```
### 3.3 下载 Qwen3-Reranker-4B
```bash
modelscope download --model Qwen/Qwen3-Reranker-4B --local_dir /data/models/Qwen3-Reranker-4B
```
或:
```bash
git clone https://www.modelscope.cn/Qwen/Qwen3-Reranker-4B.git /data/models/Qwen3-Reranker-4B
```
### 3.4 下载 Qwen3-Embedding-8B
```bash
modelscope download --model Qwen/Qwen3-Embedding-8B --local_dir /data/models/Qwen3-Embedding-8B
```
或:
```bash
git clone https://www.modelscope.cn/Qwen/Qwen3-Embedding-8B.git /data/models/Qwen3-Embedding-8B
```
### 3.5 下载进度确认
```bash
# 检查三个模型目录是否存在关键文件
ls -lh /data/models/Qwen3.5-122B-A10B-GPTQ-Int4/config.json
ls -lh /data/models/Qwen3-Reranker-4B/config.json
ls -lh /data/models/Qwen3-Embedding-8B/config.json
```
---
## 四、部署 Qwen3.5-122B(4 卡 LLM 对话服务)
### 4.1 启动 Docker 容器
```bash
docker run -dit \
--shm-size 200g \
--network=host \
--name llm-server \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
--device=/dev/mkfd \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
-u root \
-v /opt/hyhal/:/opt/hyhal/:ro \
-v /data/models:/data/models \
harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm018-ubuntu22.04-dtk26.04-gemma4-0413 \
bash
```
### 4.2 进入容器并启动 vLLM 服务
```bash
docker exec -it llm-server bash
```
在容器内执行:
```bash
# 设置环境变量
export HIP_VISIBLE_DEVICES=0,1,2,3
export ALLREDUCE_STREAM_WITH_COMPUTE=1
# 启动 vLLM 服务
vllm serve /data/models/Qwen3.5-122B-A10B-GPTQ-Int4 \
--port 8001 \
--trust-remote-code \
--dtype bfloat16 \
--quantization gptq \
--tensor-parallel-size 4 \
--gpu-memory-utilization 0.90 \
--max-model-len 8192 \
--default-chat-template-kwargs '{"enable_thinking": false}' \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--tool-call-parser qwen3_coder
```
**参数说明**:
| 参数 | 说明 |
|------|------|
| `--quantization gptq` | 指定使用 GPTQ 量化加载模型 |
| `--tensor-parallel-size 4` | 4 卡张量并行 |
| `--gpu-memory-utilization 0.90` | 略低于默认 0.925,给系统留余量 |
| `--max-model-len 8192` | 限制最大上下文长度,节省 KV Cache 显存 |
| `--reasoning-parser qwen3` | Qwen3 系列思维链解析器 |
| `--enable-auto-tool-choice` | 启用工具调用 |
> **提示**:如果 `--quantization gptq` 报错,vLLM 通常能从模型 config.json 中自动检测量化方式,可去掉此参数尝试。
### 4.3 测试 LLM 服务
```bash
# 在容器内或宿主机上执行(使用 --network=host)
curl http://localhost:8001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "/data/models/Qwen3.5-122B-A10B-GPTQ-Int4",
"messages": [
{"role": "user", "content": "你好,请用一句话介绍自己"}
],
"temperature": 0.7,
"max_tokens": 256
}'
```
预期返回类似:
```json
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"choices": [{
"message": {
"role": "assistant",
"content": "你好!我是基于 Qwen3.5 大语言模型的 AI 助手..."
}
}]
}
```
---
## 五、部署 Qwen3-Reranker-4B(1 卡重排序服务)
### 5.1 启动 Docker 容器
```bash
docker run -dit \
--shm-size 64g \
--network=host \
--name reranker-server \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
--device=/dev/mkfd \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
-u root \
-v /opt/hyhal/:/opt/hyhal/:ro \
-v /data/models:/data/models \
harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-py3.10 \
bash
```
### 5.2 进入容器并启动 Reranker 服务
```bash
docker exec -it reranker-server bash
```
在容器内执行:
```bash
# 设置环境变量 - 只使用 DCU 卡 4
export HIP_VISIBLE_DEVICES=4
export VLLM_USE_NN=0
export ALLREDUCE_STREAM_WITH_COMPUTE=1
# 启动 Reranker 服务
vllm serve /data/models/Qwen3-Reranker-4B \
--port 8002 \
--max-model-len 4096 \
--block-size 16 \
--trust-remote-code \
--enforce-eager \
--enable-prefix-caching \
--served-model-name Qwen3-reranker \
--task score \
--disable-log-requests \
--hf-overrides '{"architectures":["Qwen3ForSequenceClassification"],"classifier_from_token": ["no", "yes"],"is_original_qwen3_reranker": true}'
```
**参数说明**:
| 参数 | 说明 |
|------|------|
| `HIP_VISIBLE_DEVICES=4` | 仅使用第 4 张 DCU 卡 |
| `--task score` | 指定任务类型为评分(Reranker 模式) |
| `--served-model-name Qwen3-reranker` | API 中的模型名称 |
| `--max-model-len 4096` | Reranker 通常不需要超长上下文 |
| `--hf-overrides` | **关键参数**:覆盖模型架构配置,激活 Reranker 分类头 |
> **注意**:`--hf-overrides` 中的配置是 Reranker 在 vLLM 上运行的必要参数,缺少会导致模型无法正确输出评分。
### 5.3 测试 Reranker 服务
```bash
curl http://127.0.0.1:8002/score \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"text_1": "什么是人工智能",
"text_2": "人工智能是计算机科学的一个分支,致力于创建能够模拟人类智能的系统。",
"model": "Qwen3-reranker"
}'
```
预期返回包含相关性评分(0-1 之间,越接近 1 越相关):
```json
{
"id": "score-xxx",
"data": [{"index": 0, "object": "score", "score": 0.95}]
}
```
---
## 六、部署 Qwen3-Embedding-8B(1 卡向量化服务)
### 6.1 使用同一个容器或新容器
**方案 A**:在同一个 `reranker-server` 容器内再启动一个 vLLM 进程(更节省资源)
**方案 B**:单独启动一个新容器(更隔离,推荐)
以下采用方案 B:
```bash
docker run -dit \
--shm-size 64g \
--network=host \
--name embedding-server \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
--device=/dev/mkfd \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
-u root \
-v /opt/hyhal/:/opt/hyhal/:ro \
-v /data/models:/data/models \
harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-py3.10 \
bash
```
### 6.2 进入容器并启动 Embedding 服务
```bash
docker exec -it embedding-server bash
```
在容器内执行:
```bash
# 设置环境变量 - 只使用 DCU 卡 5
export HIP_VISIBLE_DEVICES=5
export VLLM_USE_NN=0
export ALLREDUCE_STREAM_WITH_COMPUTE=1
# 启动 Embedding 服务
vllm serve /data/models/Qwen3-Embedding-8B \
--port 8003 \
--max-model-len 8192 \
--trust-remote-code \
--enforce-eager \
--task embed \
--served-model-name Qwen3-embedding \
--disable-log-requests
```
**参数说明**:
| 参数 | 说明 |
|------|------|
| `HIP_VISIBLE_DEVICES=5` | 仅使用第 5 张 DCU 卡 |
| `--task embed` | 指定任务类型为向量嵌入 |
| `--served-model-name Qwen3-embedding` | API 中的模型名称 |
| `--max-model-len 8192` | Embedding 最大输入长度 |
### 6.3 测试 Embedding 服务
```bash
curl http://127.0.0.1:8003/v1/embeddings \
-H 'Content-Type: application/json' \
-d '{
"model": "Qwen3-embedding",
"input": "什么是人工智能"
}'
```
预期返回包含向量数据:
```json
{
"object": "list",
"data": [{
"object": "embedding",
"index": 0,
"embedding": [0.0123, -0.0456, 0.0789, ...]
}],
"model": "Qwen3-embedding",
"usage": {"prompt_tokens": 5, "total_tokens": 5}
}
```
---
## 七、服务端口汇总
| 服务 | 端口 | API 路径 | 用途 |
|------|------|---------|------|
| Qwen3.5-122B LLM | 8001 | `/v1/chat/completions` | 对话生成 |
| Qwen3-Reranker-4B | 8002 | `/score` | 重排序评分 |
| Qwen3-Embedding-8B | 8003 | `/v1/embeddings` | 文本向量化 |
---
## 八、服务持久化与开机自启
### 8.1 创建启动脚本
创建 `/data/scripts/start_all.sh`:
```bash
#!/bin/bash
# Qwen3.5 + Reranker + Embedding 全量启动脚本
set -e
echo "========== 启动 Qwen3.5-122B LLM 服务 =========="
docker start llm-server
sleep 5
docker exec -d llm-server bash -c '
export HIP_VISIBLE_DEVICES=0,1,2,3
export ALLREDUCE_STREAM_WITH_COMPUTE=1
vllm serve /data/models/Qwen3.5-122B-A10B-GPTQ-Int4 \
--port 8001 \
--trust-remote-code \
--dtype bfloat16 \
--quantization gptq \
--tensor-parallel-size 4 \
--gpu-memory-utilization 0.90 \
--max-model-len 8192 \
--default-chat-template-kwargs '{"'enable_thinking'": false}' \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--tool-call-parser qwen3_coder
'
echo "========== 启动 Qwen3-Reranker 服务 =========="
docker start reranker-server
sleep 5
docker exec -d reranker-server bash -c '
export HIP_VISIBLE_DEVICES=4
export VLLM_USE_NN=0
export ALLREDUCE_STREAM_WITH_COMPUTE=1
vllm serve /data/models/Qwen3-Reranker-4B \
--port 8002 \
--max-model-len 4096 \
--block-size 16 \
--trust-remote-code \
--enforce-eager \
--enable-prefix-caching \
--served-model-name Qwen3-reranker \
--task score \
--disable-log-requests \
--hf-overrides '"'"'{"architectures":["Qwen3ForSequenceClassification"],"classifier_from_token": ["no", "yes"],"is_original_qwen3_reranker": true}'"'"'
'
echo "========== 启动 Qwen3-Embedding 服务 =========="
docker start embedding-server
sleep 5
docker exec -d embedding-server bash -c '
export HIP_VISIBLE_DEVICES=5
export VLLM_USE_NN=0
export ALLREDUCE_STREAM_WITH_COMPUTE=1
vllm serve /data/models/Qwen3-Embedding-8B \
--port 8003 \
--max-model-len 8192 \
--trust-remote-code \
--enforce-eager \
--task embed \
--served-model-name Qwen3-embedding \
--disable-log-requests
'
echo "========== 所有服务已启动,等待模型加载... =========="
echo "LLM 服务: http://localhost:8001"
echo "Reranker 服务: http://localhost:8002"
echo "Embedding 服务: http://localhost:8003"
echo "预计 122B 模型加载需要 5-10 分钟"
```
```bash
chmod +x /data/scripts/start_all.sh
```
### 8.2 创建健康检查脚本
创建 `/data/scripts/health_check.sh`:
```bash
#!/bin/bash
# 检查三个服务是否正常运行
check_service() {
local name=$1
local port=$2
local path=$3
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:${port}${path} --max-time 5)
if [ "$response" = "200" ] || [ "$response" = "000" ]; then
echo "[OK] ${name} (port ${port})"
else
echo "[FAIL] ${name} (port ${port}) - HTTP ${response}"
fi
}
echo "========== 服务健康检查 =========="
check_service "Qwen3.5-122B LLM" 8001 "/v1/models"
check_service "Qwen3-Reranker" 8002 "/v1/models"
check_service "Qwen3-Embedding" 8003 "/v1/models"
```
```bash
chmod +x /data/scripts/health_check.sh
```
### 8.3 创建停止脚本
创建 `/data/scripts/stop_all.sh`:
```bash
#!/bin/bash
echo "========== 停止所有服务 =========="
docker stop embedding-server 2>/dev/null && echo "Embedding 服务已停止" || echo "Embedding 服务未运行"
docker stop reranker-server 2>/dev/null && echo "Reranker 服务已停止" || echo "Reranker 服务未运行"
docker stop llm-server 2>/dev/null && echo "LLM 服务已停止" || echo "LLM 服务未运行"
echo "========== 所有服务已停止 =========="
```
```bash
chmod +x /data/scripts/stop_all.sh
```
### 8.4 设置 systemd 开机自启(可选)
创建 `/etc/systemd/system/qwen-ai.service`:
```ini
[Unit]
Description=Qwen AI Services (LLM + Reranker + Embedding)
After=docker.service
Requires=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/data/scripts/start_all.sh
ExecStop=/data/scripts/stop_all.sh
[Install]
WantedBy=multi-user.target
```
```bash
systemctl daemon-reload
systemctl enable qwen-ai.service
```
---
## 九、对接 RAG 应用示例
### 9.1 配置 Dify 接入
在 Dify 的「设置 → 模型供应商 → 自定义模型」中添加:
**LLM 模型**:
- 模型类型:Text Generation
- 模型名称:`/data/models/Qwen3.5-122B-A10B-GPTQ-Int4`
- API Base URL:`http://localhost:8001/v1`
- API Key:`EMPTY`(vLLM 不需要认证)
**Embedding 模型**:
- 模型类型:Embeddings
- 模型名称:`Qwen3-embedding`
- API Base URL:`http://localhost:8003/v1`
- API Key:`EMPTY`
**Reranker 模型**:
- 需要通过中间层(如 Xinference 或自定义 API)适配 Dify 的 Reranker 接口
### 9.2 Python 调用示例
```python
from openai import OpenAI
# LLM 对话
llm_client = OpenAI(base_url="http://localhost:8001/v1", api_key="EMPTY")
response = llm_client.chat.completions.create(
model="/data/models/Qwen3.5-122B-A10B-GPTQ-Int4",
messages=[{"role": "user", "content": "你好"}],
temperature=0.7,
max_tokens=512
)
print(response.choices[0].message.content)
# Embedding 向量化
emb_client = OpenAI(base_url="http://localhost:8003/v1", api_key="EMPTY")
response = emb_client.embeddings.create(
model="Qwen3-embedding",
input="你好,世界"
)
print(f"向量维度: {len(response.data[0].embedding)}")
```
### 9.3 模拟 RAG 检索 + 重排流程
```python
import requests
import numpy as np
def embed_text(text):
"""调用 Embedding 服务获取向量"""
resp = requests.post("http://localhost:8003/v1/embeddings",
json={"model": "Qwen3-embedding", "input": text})
return resp.json()["data"][0]["embedding"]
def rerank(query, documents, top_k=3):
"""调用 Reranker 服务对文档重排序"""
results = []
for doc in documents:
resp = requests.post("http://localhost:8002/score",
json={"text_1": query, "text_2": doc, "model": "Qwen3-reranker"})
score = resp.json()["data"][0]["score"]
results.append({"text": doc, "score": score})
results.sort(key=lambda x: x["score"], reverse=True)
return results[:top_k]
def rag_query(query, knowledge_base):
"""简易 RAG 查询流程"""
# Step 1: 向量召回(初筛)
query_emb = np.array(embed_text(query))
scores = []
for doc in knowledge_base:
doc_emb = np.array(embed_text(doc))
sim = np.dot(query_emb, doc_emb) / (np.linalg.norm(query_emb) * np.linalg.norm(doc_emb))
scores.append({"text": doc, "score": float(sim)})
scores.sort(key=lambda x: x["score"], reverse=True)
candidates = [s["text"] for s in scores[:10]] # 取 Top-10 候选
# Step 2: Reranker 精排
reranked = rerank(query, candidates, top_k=3)
context = "\n".join([r["text"] for r in reranked])
# Step 3: LLM 生成回答
llm_client = OpenAI(base_url="http://localhost:8001/v1", api_key="EMPTY")
response = llm_client.chat.completions.create(
model="/data/models/Qwen3.5-122B-A10B-GPTQ-Int4",
messages=[
{"role": "system", "content": f"根据以下参考信息回答用户问题:\n{context}"},
{"role": "user", "content": query}
],
temperature=0.3,
max_tokens=512
)
return response.choices[0].message.content
```
---
## 十、常见问题排查
### 10.1 ImportError: librocm_smi64.so.2
**原因**:hyhal 版本较低
**解决**:
```bash
# 升级 hyhal
# 具体升级方式根据系统版本参考光源平台文档
```
### 10.2 vLLM 启动报 OOM(显存不足)
**排查步骤**:
1. 检查 `HIP_VISIBLE_DEVICES` 是否正确,避免多容器抢占同一张卡
2. 降低 `--gpu-memory-utilization`(如从 0.90 降到 0.85)
3. 降低 `--max-model-len`(如从 8192 降到 4096)
4. 检查是否有其他进程占用 DCU 显存:
```bash
# 在容器内查看 DCU 卡使用情况
hy-smi
```
### 10.3 容器间 GPU 冲突
**现象**:多个容器启动时报 DCU 初始化失败
**解决**:确保每个容器的 `HIP_VISIBLE_DEVICES` 不重叠。因为 `--device=/dev/dri` 会让所有卡对容器可见,必须通过环境变量限制:
| 容器 | HIP_VISIBLE_DEVICES |
|------|---------------------|
| llm-server | 0,1,2,3 |
| reranker-server | 4 |
| embedding-server | 5 |
### 10.4 Reranker 返回结果异常
**检查**:`--hf-overrides` 参数是否完整。这是 Reranker 模型正常工作的关键参数,尤其是 `classifier_from_token` 和 `is_original_qwen3_reranker` 字段。
### 10.5 GPTQ-Int4 模型加载失败
如果添加 `--quantization gptq` 报错,尝试:
1. **去掉 `--quantization gptq` 参数**,vLLM 通常能从 `config.json` 中的 `quantization_config` 字段自动检测
2. 检查模型 `config.json` 中是否包含 `quantization_config` 段:
```bash
cat /data/models/Qwen3.5-122B-A10B-GPTQ-Int4/config.json | grep -A5 quantization_config
```
3. 如果仍然不行,使用 `--quantization gptq_marlin` 或 `--quantization gptq_int8` 尝试
### 10.6 多容器网络通信
三个容器均使用 `--network=host`,直接通过 `localhost` + 端口号通信。如果端口冲突,修改各自的 `--port` 参数。
### 10.7 模型加载时间过长
Qwen3.5-122B-A10B-GPTQ-Int4 约 61GB 权重从 SSD 加载到 4 张 DCU 卡上,预计需要 **5-10 分钟**。首次加载后如果开启 prefix caching,后续请求会更快。
---
## 十一、剩余 2 卡(DCU 6-7)使用建议
| 方案 | 说明 |
|------|------|
| 部署额外 Embedding 实例 | 多实例负载均衡,应对高并发向量化请求 |
| 部署小模型(Qwen3.5-9B) | 作为快速推理模型,处理简单对话或工具调用 |
| 用于模型微调 | 配合 LoRA/QLoRA 进行领域适配微调 |
| 部署向量数据库 | 如 Milvus GPU 版,加速向量检索 |
---
## 十二、参考资料
- sourcefind Qwen3.5 vLLM 部署教程:https://developer.sourcefind.cn/codes/modelzoo/qwen3.5_vllm
- sourcefind Qwen3-Reranker 部署教程:https://developer.sourcefind.cn/codes/modelzoo/qwen3-reranker_pytorch
- Qwen3.5-122B-GPTQ-Int4 模型下载:https://modelscope.cn/models/Qwen/Qwen3.5-122B-A10B-GPTQ-Int4
- Qwen3-Reranker-4B 模型下载:https://huggingface.co/Qwen/Qwen3-Reranker-4B
- Qwen3-Embedding-8B 模型下载:https://huggingface.co/Qwen/Qwen3-Embedding-8B
- 光源平台(Docker 镜像下载):https://sourcefind.cn