主题
Qwen2.5-14B-Instruct-AWQ 部署记录
日期: 2026-08-18 模型: Qwen/Qwen2.5-14B-Instruct-AWQ (4-bit AWQ 量化) GPU: AMD Radeon RX 7900 XTX 24GB (gfx1100) 节点: szb122009 (192.168.122.9) 框架: vLLM v0.6.6 + ROCm 6.3.2
一、部署成果
1.1 VRAM 分配详情
| 组件 | 大小 |
|---|---|
| 总 GPU 内存 | 23.98 GiB |
| 可用内存 (90% util) | 21.59 GiB |
| 模型权重 (AWQ 4-bit) | 9.38 GiB |
| 非 PyTorch 开销 | 0.27 GiB |
| PyTorch 激活峰值 | 3.95 GiB |
| KV Cache | 7.99 GiB |
| GPU Blocks | 2726 |
| CPU Blocks | 1365 |
| 最大 32K 并发 | 1.33x |
1.2 推理测试结果
- ✅ 英文测试: "15 * 37 = 555" (数学正确)
- ✅ 中文测试: 量子计算原理 (高质量回答, 202 tokens)
- ✅ 启动耗时: ~110 秒 (含模型加载 + KV Cache 初始化)
1.3 vLLM 启动参数
bash
python3 -m vllm.entrypoints.openai.api_server \
--model /models/huggingface/Qwen/Qwen2.5-14B-Instruct-AWQ \
--served-model-name qwen2.5-14b \
--host 0.0.0.0 --port 8000 \
--quantization awq \
--gpu-memory-utilization 0.90 \
--max-model-len 32768 \
--dtype float16 \
--enforce-eager \
--enable-auto-tool-choice \
--tool-call-parser hermes \
--disable-frontend-multiprocessing二、模型下载与传输
2.1 下载策略
由于 GPU 节点 (192.168.122.9) 外网速度极慢 (<0.5 MB/s),采用 Master 下载 + kubectl cp 方案:
Master (192.168.122.37) GPU Node (szb122009)
curl hf-mirror.com ──► /tmp/model-14b/ /opt/models/huggingface/
~10 MB/s │ │
└─ kubectl cp ─────────┘
(K8s API, ~100 MB/s)2.2 模型文件清单
| 文件 | 大小 |
|---|---|
| model-00001-of-00003.safetensors | 3.8 GB |
| model-00002-of-00003.safetensors | 3.7 GB |
| model-00003-of-00003.safetensors | 1.9 GB |
| config.json | 841 B |
| generation_config.json | 243 B |
| merges.txt | 1.6 MB |
| model.safetensors.index.json | 105 KB |
| tokenizer.json | 6.8 MB |
| tokenizer_config.json | 7.2 KB |
| vocab.json | 2.7 MB |
| LICENSE | 12 KB |
| 总计 | ~9.4 GB |
2.3 传输 Pod 配置
yaml
apiVersion: v1
kind: Pod
metadata:
name: transfer-qwen14b
spec:
nodeName: szb122009
containers:
- name: transfer
image: 192.168.122.156:30000/cnrancher/vllm-rocm:v0.6.6
command: ["sleep", "infinity"]
volumeMounts:
- name: models
mountPath: /models
volumes:
- name: models
hostPath:
path: /opt/models
type: DirectoryOrCreate传输命令:
bash
kubectl cp /tmp/model-14b/model-00001-of-00003.safetensors \
default/transfer-qwen14b:/models/huggingface/Qwen/Qwen2.5-14B-Instruct-AWQ/model-00001-of-00003.safetensors三、关键配置与环境变量
3.1 ROCm 适配
yaml
env:
- name: HSA_OVERRIDE_GFX_VERSION
value: "11.0.0" # RX 7900 XTX (gfx1100) 伪装为 gfx1100
- name: VLLM_TARGET_DEVICE
value: rocm
- name: PYTORCH_ROCM_ARCH
value: gfx1100
- name: VLLM_USE_TRITON_FLASH_ATTN
value: "0" # 使用 CK Flash Attention 替代 Triton3.2 运行时补丁 (initContainer 内)
- tokenizer.py: 移除
all_special_tokens_extended引用 (transformers 兼容) - multiprocessing/client.py: 修复
property对象不可调用错误 - init.py: 修复
torch._inductor.config.compile_threads属性缺失
四、已知警告与限制
| 警告 | 影响 | 处理 |
|---|---|---|
| AWQ + ROCm 未充分优化 | 推理速度可能慢于非量化模型 | 可接受, 功能正常 |
| SWA 不支持 Triton Flash Attention | Sliding Window Attention 不可用 | 设置 VLLM_USE_TRITON_FLASH_ATTN=0 使用 CK 后端 |
| enforce-eager + 无 CUDA Graph | async output 不可用 | 已设置, 不影响功能 |
| custom all-reduce 不支持 AMD | 单 GPU 无需 all-reduce | 自动禁用 |
五、deploy.sh 更新记录
- 新增
qwen14b选项到模型切换 - 默认启动模型改为 qwen14b (qwen7b 缩容到 0)
- Open WebUI 环境变量和 SQLite DB 更新指向 qwen14b
- 修复 qwen7b switch case 中 URL 错误
六、操作命令速查
bash
# 启动 qwen14b
kubectl scale deployment vllm-qwen14b --replicas=1
# 停止 qwen14b (释放 GPU)
kubectl scale deployment vllm-qwen14b --replicas=0
# 切换模型
./deploy.sh switch qwen14b
# 查看日志
kubectl logs -f deployment/vllm-qwen14b
# 测试推理
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"qwen2.5-14b","messages":[{"role":"user","content":"你好"}]}'