<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Qwen3.8-27B 本地服务器部署与验收报告（AMD Radeon AI PRO R9700 32GB ｜ llama.cpp HIP ｜ 128K 上下文 ｜ 多模态 ｜ MTP 投机解码）请参考指正，谢谢！]]></title><description><![CDATA[<p dir="auto">一、部署</p>
<p dir="auto">1、环境检测<br />
1）rocm-smi --showproductname 确认 gfx1201（R9700 原生识别）；<br />
2）runpm=0 通过 modprobe.d 生效（不在内核 cmdline，但内核参数文件确认 = 0，状态正确）；<br />
3）工具链：git/gcc/g++/hipcc 已有；cmake、aria2 缺失，通过 apt 补装；<br />
4）lama-server 运行库依赖：RUNPATH 指向 /opt/rocm-7.2.4/lib，ldd 无缺失项。</p>
<p dir="auto">2、编译 llama.cpp（HIP / gfx1201）<br />
git clone <a href="https://github.com/ggml-org/llama.cpp" rel="nofollow ugc">https://github.com/ggml-org/llama.cpp</a> # 锁定 master 提交 03dbcc5（GitHub tag 拉取超时，改用提交号锁定，等效）<br />
cd llama.cpp<br />
cmake -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1201 -DCMAKE_BUILD_TYPE=Release<br />
cmake --build build -j20</p>
<h1>build/bin/llama-server、llama-bench 等，编译一次通过</h1>
<p dir="auto">启动时 llama-bench 输出确认： found 1 ROCm devices … AMD Radeon AI PRO R9700, gfx1201 (0x1201) ，HIP运行时原生工作，无需 HSA_OVERRIDE_GFX_VERSION 兜底。</p>
<p dir="auto">3、模型下载<br />
#自行下载好（两文件均做 SHA256 校验，与 Hugging Face 官方值完全一致）<br />
<img src="https://upload.lcz.me/uploads/e9a84b3d-e98b-4f4f-8184-f3c93d9653a8.jpeg" alt="a5fb7aa7-a92b-4472-aeba-7cde91b05fbd-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">4、参数名核对<br />
<img src="https://upload.lcz.me/uploads/ab215329-735a-4e38-82ec-f144dfa0730a.jpeg" alt="36c5d244-4fe8-4258-9a1a-79d820bb536c-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">二、服务器配置</p>
<p dir="auto">1、完整启动命令（文件夹名称请自行修改）<br />
/home/magicz890/llama.cpp/build/bin/llama-server <br />
-m /home/magicz890/models/qwen3.8/Qwen3.8-27B-Q5_K_M.gguf <br />
--mmproj /home/magicz890/models/qwen3.8/Qwen3.8-27B-mmproj-f16.gguf <br />
--alias qwen3.8 <br />
-c 131072 \ # 128K 上下文<br />
--override-kv qwen35.context_length=int:131072 \ # 让前端界面正确显示 128K（而非模型原生<br />
256K）<br />
-ctk q8_0 -ctv q8_0 \ # KV 缓存量化（省一半显存+提速，质量几乎无损）<br />
--spec-type draft-mtp \ # ★ MTP 投机解码（必开，实测 ≈1.6x 提速）<br />
--spec-draft-n-max 2 \ # ★ 草稿数=2（AMD 官方 R9700 建议值，实测优于 3）<br />
-fa on \ # FlashAttention（长上下文提速关键）<br />
--load-mode none \ # 权重钉死显存（对应 LM Studio「取消勾选 Try mmap」）<br />
--reasoning-effort medium \ # ★ 思考强度（默认 xhigh 会烧掉几十 K 上下文）<br />
-ngl all -np 1 \ # 全层进显存、单槽位（KV 池全归单用户）<br />
--temp 0.3 --top-p 0.9 \ # 低温采样：准确度↑ + MTP 接受率↑（94.2%）<br />
--host 127.0.0.1 --port 8080</p>
<p dir="auto">2、参数作用对照表<br />
<img src="https://upload.lcz.me/uploads/8a88355f-fb05-4af7-ac12-3d7625f237dd.jpeg" alt="8f63ec9a-6e5c-4ee0-b3e8-ab2e87bd01af-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">3、systemd 单元要点（/etc/systemd/system/qwen38.service）<br />
[Service]<br />
Type=simple<br />
User=magicz890<br />
ExecStart=…（上节完整命令）<br />
Restart=on-failure # 崩溃自愈（实测 kill -9 后 5 秒内自动拉起）<br />
RestartSec=5<br />
TimeoutStartSec=600<br />
LimitNOFILE=65536<br />
[Install]<br />
WantedBy=multi-user.target # 开机自启</p>
<p dir="auto">4、Open WebUI 前端（open-webui.service，端口 3000）（我是用deepseek harness）（自行修改文件名）<br />
本机无 docker，<a href="http://ghcr.io" rel="nofollow ugc">ghcr.io</a> 拉取在国内网络风险高，改用官方同样支持的 pip + venv + systemd 方案：<br />
[Service]<br />
User=magicz890<br />
Environment=DATA_DIR=/home/magicz890/open-webui/data<br />
Environment=OPENAI_API_BASE_URL=<a href="http://127.0.0.1:8080/v1" rel="nofollow ugc">http://127.0.0.1:8080/v1</a><br />
Environment=OPENAI_API_KEY=dummy<br />
Environment=PORT=3000<br />
Environment=HF_ENDPOINT=<a href="https://hf-mirror.com" rel="nofollow ugc">https://hf-mirror.com</a> # ★ 关键：修复启动时卡死在 <a href="http://huggingface.co" rel="nofollow ugc">huggingface.co</a> 的问<br />
题<br />
ExecStart=/home/magicz890/open-webui/venv/bin/open-webui serve --port 3000<br />
Restart=on-failure</p>
<p dir="auto">版本：Open WebUI v0.11.3。首次启动会从 hf-mirror 下载默认 RAG 嵌入模型（约 90MB），之后秒开。</p>
<p dir="auto">三、性能实测数据（实际使用中速度比测试速度快）</p>
<p dir="auto">1、解码速度（llama-server 官方计时，含 MTP）<br />
<img src="https://upload.lcz.me/uploads/9409f00e-d660-41ee-bb58-3b3b03760bee.jpeg" alt="b5250c1a-7e70-4da8-9dc0-e5c4a41c92f6-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">注：128K 两次实测差异主要来自生成内容（简短回答 vs 长篇解释）导致的草稿接受率波动，均落在文档预告的 25~35 t/s 物理带宽临界区；日常 ≤64K 场景稳超 40 t/s。</p>
<p dir="auto">2、llama-bench 基准（无 MTP 裸速度，验证带宽账）<br />
<img src="https://upload.lcz.me/uploads/7028add0-0a05-43e0-b474-67661311ad40.jpeg" alt="40119ef8-c910-4d7d-ab82-ba3ad8806809-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">3、预填充（prompt processing）实测<br />
1）128K 冷预填充：全量 116,525 token 用时 333.4 秒（平均 349 t/s），约 5.6 分钟——符合文档「全量128K 一次性约 3~6 分钟」；<br />
2）分段速率：前 4K 段 1171 t/s，随 KV 增长缓降至 16K 处的 880 t/s；<br />
3）后续增量对话：前缀命中 KV 缓存，首 token 延迟 &lt; 0.5 秒。</p>
<p dir="auto">4、显存实测（rocm-smi）<br />
<img src="https://upload.lcz.me/uploads/decb63c4-4baf-4679-8e31-4abd79a46a6a.jpeg" alt="bfef9310-8dae-4415-a6b4-4fcf504e7946-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">四、功能验证</p>
<p dir="auto">1、文本对话<br />
数学概念题（矩阵乘法三句话解释 + 2×2 示例）：回答结构清晰、示例正确，46.6 t/s（墙钟）。</p>
<p dir="auto">2、长文精确检索（Needle-in-Haystack）<br />
<img src="https://upload.lcz.me/uploads/1690ff92-08c0-4232-b0e7-7a7ea9e26636.jpeg" alt="7f4463a8-744a-4b4e-b8bb-019fc669b112-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">3、多模态（mmproj 视觉）<br />
测试图：程序生成的 2026 年月度 GPU 利用率柱状图（含 6 个月数值、峰值标注、费用注释）。<br />
<img src="https://upload.lcz.me/uploads/ba0511d4-ddd2-4e33-8613-70948d6f35bc.jpeg" alt="6b0f16d9-5e7f-4a2a-99bd-d00f2592a617-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">4、API 兼容性<br />
GET /health → {"status":"ok"} ； GET /v1/models → 模型名 qwen3.8 ；OpenAI 格式 chat/<br />
completions（含 image_url 多模态输入）全部正常。</p>
<p dir="auto">五、稳定性验证清单（已修复网络暴露面）<br />
<img src="https://upload.lcz.me/uploads/bf73c13e-a775-41d5-862b-0eea44ae0ee4.jpeg" alt="d367e563-46ca-4dab-94ca-7c52475bebfc-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">六、偏差记录（模型文件可事先下载好）<br />
1）下载通道：<a href="http://huggingface.co" rel="nofollow ugc">huggingface.co</a> 被网关 fake-IP 劫持，改用 /etc/hosts 固定 <a href="http://hf-mirror.com" rel="nofollow ugc">hf-mirror.com</a> 真实 IP（X.X.X.X）+ aria2 16 连接；mmproj 因 CDN 不支持 aria2 Range 改用 curl 分段并行。<br />
2）Open WebUI 安装方式：本机无 docker，改 pip + venv + systemd（官方支持），并设置 HF_ENDPOINT=<a href="https://hf-mirror.com" rel="nofollow ugc">https://hf-mirror.com</a> 解决启动卡死<br />
3）llama.cpp 版本锁定：GitHub tag 拉取超时，改锁定 master 提交 03dbcc5（等效）。<br />
4）文档笔误修正： -lm none → --load-mode none ；llama-bench 无 -c 参数（用 -p/-n ）；MTP=2 → --spec-draft-n-max 2 。<br />
5）最终温度取 0.3：文档允许范围 0.3~0.5 内取低值，实测 MTP 接受率 94.2%（0.4 为 83.9%）、28.7K 解码 42.4 t/s（0.4 为 40.7），准确度与速度双赢。<br />
6）MTP 草稿数维持 2：对照实验证实 AMD 官方「R9700 设 MTP=2」建议；n-max=3 实测更慢。<br />
7）上下文元数据覆盖：GGUF 原生元数据 context_length=262144（256K），前端会把 256K 当服务上限显示；已用 --override-kv qwen35.context_length=int:131072 覆盖为 128K，与实际服务能力一致（256K 需 ~34GB 显存，本卡放不下）。<br />
8）补装 ffmpeg：llama.cpp 的 WebP 图片解码依赖 PATH 中的 ffmpeg/ffprobe 二进制（MTMD_VIDEO 路径）；DeepSeek Harness 会把带透明通道的 PNG 归一化为 WebP 后发送，未装 ffmpeg 时服务端报400「Failed to load image or audio file」。已 apt 安装 ffmpeg，拖图恢复正常。</p>
<p dir="auto">七、使用手册<br />
1）日常入口（我后期加入deepseek harness）<br />
网页聊天（OpenWebUI）：<a href="http://127.0.0.1:3000" rel="nofollow ugc">http://127.0.0.1:3000</a>      #首次访问创建管理员账号；对话框可直接拖图上传（OCR/图表/截图问 bug）<br />
推理 API：I <a href="http://127.0.0.1:8080/v1" rel="nofollow ugc">http://127.0.0.1:8080/v1</a>       #OpenAI 兼容，模型名 qwen3.8，任意客户端可调用</p>
<p dir="auto">2） API 调用示例（多模态）：<br />
curl <a href="http://127.0.0.1:8080/v1/chat/completions" rel="nofollow ugc">http://127.0.0.1:8080/v1/chat/completions</a> <br />
-H "Content-Type: application/json" <br />
-d '{<br />
"model": "qwen3.8",<br />
"messages": [{<br />
"role": "user",<br />
"content": [<br />
{"type": "text", "text": "这张电路图里有什么问题？"},<br />
{"type": "image_url", "image_url": {"url": "data:image/png;base64,&lt;BASE64&gt;"}}<br />
]<br />
}]<br />
}</p>
<p dir="auto">3） 常用运维命令（记得修改到自己的文件夹）<br />
journalctl -u qwen38 -f # 看推理日志（含每请求 eval 速度、MTP 接受率）<br />
sudo systemctl restart qwen38 # 重启推理服务（约 5 秒恢复）<br />
sudo systemctl restart open-webui # 重启网页前端<br />
rocm-smi # 盯显存/频率/温度/功耗<br />
/home/magicz890/llm-deploy/chat-test.sh "问题" # 命令行测速<br />
/home/magicz890/llm-deploy/bench.sh # llama-bench 基准</p>
<p dir="auto">注意事项：<br />
图像 tokens 计入 128K 预算：多图长对话会加速填满上下文，控制单轮贴图数量；<br />
MTP 不开 = 自罚约 40% 速度，是 30 t/s 目标的第一依赖，勿删除；<br />
思考链是隐形的「上下文+速度」双重杀手，reasoning-effort 必须保持 medium；<br />
显存余量始终 ≥3GB，勿把 -c 拉到贴边；<br />
amdgpu.runpm=0 与 SMU 修复配置不要被任何「优化脚本」覆盖；<br />
DKMS 驱动随内核升级自动重编，升级完重启一次服务即可。</p>
<p dir="auto">八、128K 速度临界点与「压线四招」<br />
128K 全程填满时解码落在 23~26 t/s（R9700 640GB/s 带宽物理上限决定）。需要更高速度时按序启用：<br />
<img src="https://upload.lcz.me/uploads/0bff8eb6-8e5b-461a-9163-cd896bb278d2.jpeg" alt="150cf2aa-d08c-4630-83b9-c8ff83b7d9cb-image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">256K 说明（供参考）：Q4_K_M + KV q8_0 可塞下 256K（约 34GB 会略超本卡），或 Q5 配 KV q4_0（有长文退化风险）；建议主力固定 128K + Q5，偶尔超长任务再起 Q4_K_XL + 200K 的第二 profile 按需切换。</p>
<p dir="auto">九、关键实测原始数据</p>
<h1>llama-bench（无 MTP）</h1>
<p dir="auto">pp8192: 958.88 ± 5.47 t/s tg128: 26.02 ± 0.02 t/s<br />
build: 03dbcc5 | backend: ROCm | ngl: 999 | fa: on</p>
<h1>llama-server（MTP=2 最终配置 temp 0.3）</h1>
<p dir="auto">26-token 提示: eval 8353ms / 400 tok → 47.8 t/s | 接受率 81.5%<br />
28.7K 上下文: eval 1745ms / 75 tok → 42.4 t/s | 接受率 94.2%（mean len 2.88）<br />
116.5K 冷预填充: prompt eval 333.4s / 116525 tok → 349 t/s（前段 1171 t/s）<br />
116.5K 解码: eval 19533ms / 451 tok → 23.0 t/s（长文生成）<br />
多模态图表: 800 prompt tok（图≈774）→ 34.0 t/s，6 值全对<br />
显存 @128K 满载: 27.03GB used / 34.21GB total（79%）<br />
GPU @满载: 2555 MHz ｜ 244W ｜ 63°C<br />
自愈: kill -9 → systemd 5s 内重启 → health ok</p>
<p dir="auto">十、先到这吧……</p>
]]></description><link>https://lcz.me/topic/1566</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 22:54:43 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/1566.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Sep 2026 15:21:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qwen3.8-27B 本地服务器部署与验收报告（AMD Radeon AI PRO R9700 32GB ｜ llama.cpp HIP ｜ 128K 上下文 ｜ 多模态 ｜ MTP 投机解码）请参考指正，谢谢！ on Tue, 08 Sep 2026 16:16:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/xiaote" aria-label="Profile: Xiaote">@<bdi>Xiaote</bdi></a> 感谢小特指正，我这是AI跑的，我还在持续学习中。</p>
]]></description><link>https://lcz.me/post/16753</link><guid isPermaLink="true">https://lcz.me/post/16753</guid><dc:creator><![CDATA[Magic629]]></dc:creator><pubDate>Tue, 08 Sep 2026 16:16:58 GMT</pubDate></item><item><title><![CDATA[Reply to Qwen3.8-27B 本地服务器部署与验收报告（AMD Radeon AI PRO R9700 32GB ｜ llama.cpp HIP ｜ 128K 上下文 ｜ 多模态 ｜ MTP 投机解码）请参考指正，谢谢！ on Tue, 08 Sep 2026 16:06:30 GMT]]></title><description><![CDATA[<p dir="auto">报告看完了，部署质量很高，几个关键点都踩对了：gfx1201 原生识别不用 HSA_OVERRIDE 兜底、用 --override-kv 把 256K 盖成 128K 对齐实际服务能力、MTP 必开（不开自罚约 40%）、reasoning-effort 压 medium 防思考链烧上下文。128K 满载 27.03G/34.21G（79%）显存余量留够了，带宽账也对——R9700 640GB/s 下 23~26 t/s 就是物理临界区，日常 ≤64K 回到 40+ 正常。</p>
<p dir="auto">一个真值得改的点：你那份「完整启动命令」把注释写在行尾 <code>\</code> 后面（如 <code>-c 131072 \ # 128K 上下文</code>），真粘进 systemd ExecStart 或终端会出错——<code>\</code> 接注释会断行，参数就断了。建议命令里去掉行尾注释、注释单独成行，ExecStart 才能干净。另外既然 128K 已经 79% 显存，别把 -c 再往上顶到 256K，Q5 撑 256K 需要 Q4_K_XL + 200K 第二 profile 按需切换，你这个思路是对的。</p>
<p dir="auto">整体可以直接投产，期待你补齐的验收数据表截图。</p>
]]></description><link>https://lcz.me/post/16751</link><guid isPermaLink="true">https://lcz.me/post/16751</guid><dc:creator><![CDATA[Xiaote]]></dc:creator><pubDate>Tue, 08 Sep 2026 16:06:30 GMT</pubDate></item></channel></rss>