<?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[(小白篇)全自动MiniMax H3 视频生成栈 · 部署与执行全记录（全原始数据待优化版）]]></title><description><![CDATA[<h1>MiniMax H3 视频生成栈 · 部署与执行全记录</h1>
<p dir="auto"><strong>记录时间</strong>：2026-11-16 (Asia/Shanghai)<br />
<strong>部署主机</strong>：<code>magic629-AI</code> / 192.168.67.202（本地 Windows 工作站经 SSH 驱动）<br />
<strong>本次任务</strong>：<a href="http://lcz.me/topic/3045" rel="nofollow ugc">lcz.me/topic/3045</a> 剑心比赛，两条 1344×768 / 12s 成片<br />
<strong>关联文档</strong>：<code>H3剑心比赛\任务执行流程与参数记录.md</code>（任务视角）、<code>参赛帖-文案.md</code>（提交用）</p>
<blockquote>
<p dir="auto">本文按 <strong>部署 → 执行 → 参数 → 建议</strong> 四部分组织。部署与参数部分是从服务器实采的原始事实，执行部分是本次两条片子的真实时间线，建议部分按优先级排列并标注证据来源。</p>
</blockquote>
<hr />
<h1>第一部分　部署</h1>
<h2>1. 硬件平台</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>实测值</th>
<th>取证方式</th>
</tr>
</thead>
<tbody>
<tr>
<td>主板</td>
<td>Gigabyte <strong>Z890 AERO G</strong>，BIOS F21（2026-06-11）</td>
<td><code>hostnamectl</code></td>
</tr>
<tr>
<td>CPU</td>
<td>Intel <strong>Core Ultra 7 265K</strong>，20 核</td>
<td><code>/proc/cpuinfo</code>、<code>nproc</code></td>
</tr>
<tr>
<td>CPU 调度</td>
<td><strong>performance</strong> governor</td>
<td><code>scaling_governor</code></td>
</tr>
<tr>
<td>内存</td>
<td>62 GiB（当前用 45 GiB / 可用 16 GiB），Swap 39 GiB</td>
<td><code>free -h</code></td>
</tr>
<tr>
<td>系统盘</td>
<td>NVMe 915 GB，已用 437 GB（51%），可用 432 GB</td>
<td><code>df -h /</code></td>
</tr>
<tr>
<td>独显</td>
<td><strong>2× AMD Radeon AI PRO R9700 32GB</strong></td>
<td><code>lspci -nn</code> → <code>1002:7551 rev c0</code> ×2</td>
</tr>
<tr>
<td>GPU 插槽</td>
<td>PCI <code>03:00.0</code> / <code>06:00.0</code></td>
<td><code>lspci -nn</code></td>
</tr>
<tr>
<td>单卡显存</td>
<td><strong>32,624 MiB</strong></td>
<td><code>/sys/class/drm/card{0,1}/device/mem_info_vram_total</code></td>
</tr>
<tr>
<td>核显</td>
<td>Intel Arrow Lake-U <code>8086:7d67</code>（不参与推理）</td>
<td><code>lspci -nn</code></td>
</tr>
</tbody>
</table>
<h2>2. 系统与驱动栈</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>层</th>
<th>版本</th>
</tr>
</thead>
<tbody>
<tr>
<td>OS</td>
<td>Ubuntu <strong>24.04.5 LTS</strong></td>
</tr>
<tr>
<td>Kernel</td>
<td><strong>7.0.0-42-generic</strong></td>
</tr>
<tr>
<td>amdgpu 驱动</td>
<td><strong>7.1.9.31600000</strong></td>
</tr>
<tr>
<td>ROCm</td>
<td><code>/opt/rocm</code></td>
</tr>
<tr>
<td>torch</td>
<td><strong>2.14.1+rocm7.14</strong>（HIP <strong>7.14.60850</strong>）</td>
</tr>
<tr>
<td>Docker</td>
<td><strong>29.1.3</strong>，runtime <code>runc</code>，storage <code>overlayfs</code></td>
</tr>
</tbody>
</table>
<h2>3. 模型资产清单</h2>
<p dir="auto">全部位于 <code>/home/magic629/</code>，合计 <strong>约 176.5 GB</strong>：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>文件</th>
<th>字节</th>
<th>用途</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>h3-models/minimax-h3-ref2va-fp8.rad</code></td>
<td>26,863,880,192</td>
<td><strong>本次出片所用</strong>，Ref2VA fp8 容器</td>
</tr>
<tr>
<td><code>h3-models/minimax-h3-fp8.rad</code></td>
<td>65,001,896,448</td>
<td>完整版 fp8 容器（未用于本次）</td>
</tr>
<tr>
<td><code>…/text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors</code></td>
<td>15,687,142,551</td>
<td>Qwen3-VL 文本/图像编码器</td>
</tr>
<tr>
<td><code>…/diffusion_models/minimax_h3_ref2va_pruned_fp8_scaled.safetensors</code></td>
<td>20,958,205,608</td>
<td>ComfyUI 通路用</td>
</tr>
<tr>
<td><code>…/diffusion_models/minimax_h3_ref2va_pruned_bf16.safetensors</code></td>
<td>40,225,724,176</td>
<td>同上 bf16</td>
</tr>
<tr>
<td><code>…/loras/minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors</code></td>
<td>1,956,193,000</td>
<td><strong>4 步 turbo LoRA（本次未用，见建议 4）</strong></td>
</tr>
<tr>
<td><code>…/vae/minimax_h3_video_vae_fp16.safetensors</code></td>
<td>5,207,808,496</td>
<td>视频 VAE</td>
</tr>
<tr>
<td><code>…/vae/minimax_h3_audio_vae_fp32.safetensors</code></td>
<td>605,254,808</td>
<td>音频 VAE</td>
</tr>
</tbody>
</table>
<h2>4. 推理引擎与预处理组件</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>组件</th>
<th>位置 / 版本</th>
</tr>
</thead>
<tbody>
<tr>
<td>Radiance 引擎</td>
<td><code>~/radiance-h3-fullref/build/bin/radiance</code>，13,818,568 B</td>
</tr>
<tr>
<td>源码仓库</td>
<td><code>~/radiance-h3-fullref</code>，git <code>a065337</code>，分支 <code>h3-fullref</code>，末次提交 2026-10-26</td>
</tr>
<tr>
<td>预处理脚本</td>
<td><code>~/radiance-h3-fullref/scripts/h3_fullref.py</code></td>
</tr>
<tr>
<td>ComfyUI 宿主</td>
<td><code>~/ComfyUI</code>（独立 <code>.venv</code>）</td>
</tr>
<tr>
<td>H3 视频节点</td>
<td><code>~/ComfyUI/comfy_extras/nodes_minimax_h3.py</code></td>
</tr>
<tr>
<td>节点内常量</td>
<td><code>CANVAS_MULTIPLE=32</code>、<code>REF_IMAGE_SHORT_EDGE=2048</code>、<code>AUDIO_LATENT_FPS=40</code></td>
</tr>
</tbody>
</table>
<h2>5. systemd 服务拓扑</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>单元</th>
<th>状态</th>
<th>职责</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>radiance-h3fullref.service</code></td>
<td>inactive / <strong>disabled</strong></td>
<td>H3 视频服务，TP2，:8001。<strong>按需启动</strong>，不随开机自启</td>
</tr>
<tr>
<td><code>radiance-flashnext.service</code></td>
<td>inactive / enabled</td>
<td>LLM 服务，容器 :8010，经网关对外 :8000/:8100</td>
</tr>
<tr>
<td><code>radiance-gateway.service</code></td>
<td>active</td>
<td>生产网关：并发闸、分级超时、重试、访问日志</td>
</tr>
<tr>
<td><code>radiance-monitor.service</code></td>
<td>active</td>
<td>5 秒采样 + 阈值告警</td>
</tr>
<tr>
<td><code>radiance-logshipper.service</code></td>
<td>active</td>
<td>容器日志外送（容器重建后仍存活）</td>
</tr>
<tr>
<td><code>radiance-cpu-performance.service</code></td>
<td>active(exited)</td>
<td>锁定 performance governor</td>
</tr>
<tr>
<td><code>radiance-watchdog.service</code></td>
<td>inactive(dead)</td>
<td>一次性任务：保证 LLM <strong>真的在服务</strong>，不只是容器在跑</td>
</tr>
<tr>
<td><code>radiance-watchdog.timer</code></td>
<td>active</td>
<td>每 <strong>20 秒</strong> 触发上面的看门狗</td>
</tr>
</tbody>
</table>
<h2>6. GPU 独占与三层让位机制</h2>
<p dir="auto">双卡各 32 GB，H3 与 LLM <strong>物理上不能共存</strong>（LLM 常驻 32,570 MiB）。为此部署了三层防护：</p>
<p dir="auto"><strong>第一层 — systemd 冲突声明</strong>（<code>radiance-flashnext.service.d/gpu-exclusive.conf</code>）</p>
<pre><code class="language-ini">[Unit]
Conflicts=radiance-h3fullref.service
[Service]
ExecStartPre=/usr/local/bin/radiance-wait-gpu-free.sh
ExecStop=/usr/bin/docker compose -f /home/magic629/radiance/compose/flashnext.yaml stop radiance-flashnext
</code></pre>
<p dir="auto"><strong>第二层 — 启动前显存闸门</strong>（<code>radiance-wait-gpu-free.sh</code>）<br />
只统计 &gt;30 GB 的大卡，要求每卡空闲 ≥ 30,000 MiB，最多等 180 s，超时<strong>放行</strong>（fail-open，避免死锁）。</p>
<p dir="auto"><strong>第三层 — 视频任务闸门</strong>（<code>radiance-video-gate.sh</code>，看门狗每轮调用）<br />
判定"有视频任务"的四个条件，任一成立看门狗就让路：</p>
<ol>
<li>锁文件 <code>.video-task.lock</code> 存在且持有进程仍存活</li>
<li>保持文件 <code>.video-pin</code> 存在</li>
<li><code>radiance-h3fullref</code> active 且 :8001 有 queued/running 任务</li>
<li><code>radiance-h3fullref</code> active 且启动未满 <code>GRACE=180s</code>（模型加载期）</li>
</ol>
<p dir="auto">三条都不成立而单元仍开着 → 判为"任务已完成的残留服务"，连续 <code>IDLE_AFTER=120s</code> 空闲后自动停服务回收双卡。</p>
<p dir="auto"><strong>看门狗为什么不能只看容器状态</strong>（脚本注释里的实战教训）：</p>
<ul>
<li>引擎 OOM 后，<code>unless-stopped</code> 策略会让 dockerd 立刻重启容器，容器状态一直 <code>running</code>，看门狗第一行就 <code>exit 0</code>，崩溃循环完全隐形。</li>
<li>compose 的 healthcheck 有 <code>start_period: 15m</code>，容器起来后 15 分钟内 Docker 一律报 healthy，所以 <code>Up (healthy)</code> 在崩溃循环期间是假象。</li>
<li>⇒ 判活必须自己探 <code>:8010/health</code>。</li>
</ul>
<p dir="auto"><strong>LLM 容器刻意设 <code>restart: "no"</code></strong>：让崩溃真的表现为"停止"，而不是被 restart 策略掩盖成"一直在跑"。</p>
<h2>7. 出片脚本清单</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>脚本</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>~/h3-make.sh</code></td>
<td>原始版，<strong>只取目录里第一张图</strong></td>
</tr>
<tr>
<td><code>~/h3-make-multi.sh</code></td>
<td>本次新写，支持多图（目录内全部图片展开成多个 <code>--image</code>）+ 分段计时</td>
</tr>
<tr>
<td><code>~/h3-run-full.sh</code> / <code>~/h3-run-submit.sh</code> / <code>~/h3-shot.sh</code></td>
<td>既有工作流脚本</td>
</tr>
<tr>
<td><code>~/contest-driver.sh</code></td>
<td>串行驱动：3D 跑完自动接 2D，<code>nohup</code> 后台</td>
</tr>
</tbody>
</table>
<hr />
<h1>第二部分　执行</h1>
<h2>8. 一条命令出片的四阶段流水线</h2>
<pre><code class="language-bash">bash ~/h3-make-multi.sh &lt;素材目录&gt; &lt;秒&gt; &lt;步数&gt; &lt;宽x高&gt; &lt;轮询超时分钟&gt;
# 本次实际调用：
bash ~/h3-make-multi.sh ~/h3-contest-3d 12 20 1344x768 240
</code></pre>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>阶段</th>
<th>动作</th>
<th>关键实现</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>① 腾显存</strong></td>
<td><code>systemctl stop radiance-h3fullref</code> + 停 LLM 容器</td>
<td>轮询 <code>mem_info_vram_used &lt; 1500 MiB</code>，实测降到 57/57 MiB</td>
</tr>
<tr>
<td><strong>② 预处理</strong></td>
<td>单卡跑 <code>h3_fullref.py prepare</code></td>
<td><code>ROCR_VISIBLE_DEVICES=0</code>，Qwen3-VL 编码 + VAE 编码 6 张参考图 → <code>request.json</code></td>
</tr>
<tr>
<td><strong>③ 起服务</strong></td>
<td><code>systemctl start radiance-h3fullref</code></td>
<td>双卡 TP2 加载 25 GiB fp8，轮询 <code>/v1/models</code> 直到 200</td>
</tr>
<tr>
<td><strong>④ 提交轮询</strong></td>
<td><code>POST /v1/videos</code> → <code>GET /v1/videos/{id}</code> → <code>GET …/content</code></td>
<td>每 5 s 查状态，每 60 s 打一行日志</td>
</tr>
</tbody>
</table>
<p dir="auto">全程 <code>trap cleanup EXIT</code> 保证异常退出也把双卡还给 LLM。</p>
<h2>9. 本次两条成片的真实时间线</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>时刻</th>
<th>事件</th>
</tr>
</thead>
<tbody>
<tr>
<td>11:42:00</td>
<td>3D 开始，视频闸门加锁（<code>what=h3-make-multi h3-contest-3d</code>）</td>
</tr>
<tr>
<td>11:42:01</td>
<td>看门狗检测到闸门，停掉 flashnext 让出双卡</td>
</tr>
<tr>
<td>~11:43:47</td>
<td>prepare 完成（107 s），<code>request.json</code> 92 MB</td>
</tr>
<tr>
<td>~11:44:02</td>
<td>服务就绪（15 s）</td>
</tr>
<tr>
<td>12:04:16</td>
<td>3D 完成并下载，<strong>Total Time 1336 s</strong>；2D 立即开始</td>
</tr>
<tr>
<td>12:26:33</td>
<td>2D 完成并下载，<strong>Total Time 1337 s</strong></td>
</tr>
<tr>
<td>12:26:36</td>
<td>闸门发现陈旧锁（pid 已不存在）自动清除</td>
</tr>
<tr>
<td>12:28:39</td>
<td>看门狗判定视频服务空转 123 s，停服务回收双卡</td>
</tr>
<tr>
<td>12:28:59</td>
<td>LLM 恢复，<code>:8010 = 200</code>，耗时 28 s</td>
</tr>
</tbody>
</table>
<h2>10. 计时证据</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>阶段</th>
<th>3D 版</th>
<th>2D 版</th>
</tr>
</thead>
<tbody>
<tr>
<td>预处理 prepare（墙钟）</td>
<td><strong>107 s</strong></td>
<td><strong>98 s</strong></td>
</tr>
<tr>
<td>服务冷启动就绪</td>
<td>15 s</td>
<td>15 s</td>
</tr>
<tr>
<td>生成 submit → completed</td>
<td><strong>1213 s</strong></td>
<td><strong>1223 s</strong></td>
</tr>
<tr>
<td><strong>端到端 Total Time</strong></td>
<td><strong>1336 s ≈ 22.3 分钟</strong></td>
<td><strong>1337 s ≈ 22.3 分钟</strong></td>
</tr>
<tr>
<td>两条合计</td>
<td><strong>44.6 分钟</strong></td>
<td></td>
</tr>
</tbody>
</table>
<blockquote>
<p dir="auto">墙钟 107 s 比引擎自报 <code>preprocess_seconds</code> 95.995 s 多约 11 s，差额是 Python 解释器启动 + ComfyUI 导入 + 三个模型文件从盘加载。<br />
三段相加（107+15+1213=1335）与端到端 1336 s 吻合，说明计时口径自洽。</p>
</blockquote>
<p dir="auto"><strong>进度曲线</strong>（两条几乎重合，说明 3D/2D 风格对算力无影响）：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>已用时间</th>
<th>3D</th>
<th>2D</th>
<th></th>
<th>已用时间</th>
<th>3D</th>
<th>2D</th>
</tr>
</thead>
<tbody>
<tr>
<td>60 s</td>
<td>0</td>
<td>0</td>
<td></td>
<td>840 s</td>
<td>63</td>
<td>63</td>
</tr>
<tr>
<td>120 s</td>
<td>4</td>
<td>4</td>
<td></td>
<td>1020 s</td>
<td>76</td>
<td>76</td>
</tr>
<tr>
<td>240 s</td>
<td>18</td>
<td>18</td>
<td></td>
<td>1140 s</td>
<td>85</td>
<td>85</td>
</tr>
<tr>
<td>480 s</td>
<td>36</td>
<td>36</td>
<td></td>
<td>1200 s</td>
<td>96</td>
<td>94</td>
</tr>
<tr>
<td>720 s</td>
<td>54</td>
<td>54</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<hr />
<h1>第三部分　参数</h1>
<h2>11. <code>h3_fullref.py prepare</code> 全参数表</h2>
<p dir="auto">源码实测（<code>scripts/h3_fullref.py</code> 第 23–40 行）：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>默认值</th>
<th>合法区间 / 说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>phase</code></td>
<td>位置参数</td>
<td>—</td>
<td>只接受 <code>prepare</code></td>
</tr>
<tr>
<td><code>--comfy</code></td>
<td>Path</td>
<td><strong>必填</strong></td>
<td>ComfyUI 根目录</td>
</tr>
<tr>
<td><code>--work</code></td>
<td>Path</td>
<td><strong>必填</strong></td>
<td>工作目录，产出 <code>request.json</code></td>
</tr>
<tr>
<td><code>--models</code></td>
<td>Path</td>
<td><strong>必填</strong></td>
<td>模型目录</td>
</tr>
<tr>
<td><code>--steps</code></td>
<td>int</td>
<td><strong>20</strong></td>
<td><strong>1..64</strong> 去噪步数</td>
</tr>
<tr>
<td><code>--length</code></td>
<td>int</td>
<td><strong>124</strong></td>
<td>帧数，必须 <code>17n+5</code>，n∈7..21 → 124/141/…/362</td>
</tr>
<tr>
<td><code>--width</code></td>
<td>int</td>
<td><strong>576</strong></td>
<td>32 的倍数，边长 ≥256</td>
</tr>
<tr>
<td><code>--height</code></td>
<td>int</td>
<td><strong>352</strong></td>
<td>同上</td>
</tr>
<tr>
<td><code>--reference-max-area</code></td>
<td>int</td>
<td><strong>202752</strong>（576×352）</td>
<td><strong>1024..1032192</strong> 像素</td>
</tr>
<tr>
<td><code>--pad-reference-video</code></td>
<td>flag</td>
<td>关</td>
<td>参考视频补零</td>
</tr>
<tr>
<td><code>--seed</code></td>
<td>int</td>
<td><strong>145</strong></td>
<td></td>
</tr>
<tr>
<td><code>--image</code></td>
<td>Path，<strong>可重复</strong></td>
<td>—</td>
<td>多张身份/风格参考图</td>
</tr>
<tr>
<td><code>--video</code></td>
<td>Path，可重复</td>
<td>—</td>
<td>无声运动参考</td>
</tr>
<tr>
<td><code>--audio</code></td>
<td>Path，可重复</td>
<td>—</td>
<td>独立音乐/音效参考</td>
</tr>
<tr>
<td><code>--video-audio</code></td>
<td>两个 Path</td>
<td>—</td>
<td>成对的视频+音轨</td>
</tr>
<tr>
<td><code>--prompt</code></td>
<td>Path</td>
<td>—</td>
<td>提示词文件</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>校验逻辑原文</strong>：</p>
<pre><code class="language-python">if not 1 &lt;= opts.steps &lt;= 64: parser.error("steps must be 1..64 denoiser evaluations")
if not 124 &lt;= opts.length &lt;= 362 or (opts.length-5) % 17:
    parser.error("length must be 17*n+5 frames, with n in 7..21 (124, 141, ..., 362)")
if (min(w,h) &lt; 256 or w % 32 or h % 32 or w*h &gt; 1344*768 or max(w,h) &gt; 4*min(w,h)):
    parser.error("size must use multiples of 32, sides &gt;=256, area &lt;=1344*768 and aspect &lt;=4:1")
if not 1024 &lt;= opts.reference_max_area &lt;= 1344*768:
    parser.error("reference-max-area must be 1024..1032192 pixels")
...
if len(images) &gt; 9 or len(videos) &gt; 3 or len(audio_refs) &gt; 3 or ... &gt; 12:
    raise ValueError("Reference count exceeds H3 limits")
</code></pre>
<blockquote>
<p dir="auto"><strong>注意</strong>：全文无 <code>lora</code> / <code>turbo</code> 字样 —— 这条通路不支持加载 LoRA（见建议 4）。</p>
</blockquote>
<h2>12. 本次参数取值与推导</h2>
<p dir="auto"><strong>帧数</strong>（12 秒 → 294 帧）：</p>
<pre><code class="language-python">n = max(7, min(21, round((12*24 - 5) / 17)))   # = round(283/17) = 17
length = n*17 + 5                               # = 294 帧 = 12.25 s @24fps
</code></pre>
<p dir="auto"><strong>分辨率</strong>：1344×768 面积 = 1,032,192 px，正好等于校验上限 <code>1344*768</code>，无需降档。</p>
<p dir="auto"><strong>完整 prepare 命令行</strong>：</p>
<pre><code class="language-bash">ROCR_VISIBLE_DEVICES=0 ~/ComfyUI/.venv/bin/python \
  ~/radiance-h3-fullref/scripts/h3_fullref.py prepare \
  --comfy ~/ComfyUI --models ~/h3-models/ComfyUI-Models \
  --work &lt;素材目录&gt;/work-&lt;HHMMSS&gt; \
  --width 1344 --height 768 --length 294 --steps 20 --seed 145 \
  --reference-max-area 344064 --pad-reference-video \
  --prompt &lt;素材目录&gt;/prompt.txt \
  --image jianxin1.jpg --image jianxin2.jpg --image jianxin3.jpg \
  --image zhizhixiong1.jpg --image zhizhixiong2.jpg --image zhizhixiong3.jpg
</code></pre>
<p dir="auto">prepare 进程内注入的 ComfyUI 启动参数：</p>
<pre><code class="language-python">sys.argv = [argv0, "--disable-triton-backend", "--use-ck-attention",
            "--disable-pinned-memory", "--disable-smart-memory",
            "--disable-dynamic-vram"]
</code></pre>
<h2>13. 推理服务启动参数</h2>
<pre><code>~/radiance-h3-fullref/build/bin/radiance \
  --model ~/h3-models/minimax-h3-ref2va-fp8.rad \
  --radiance-home ~/radiance-h3-fullref/build/radiance_home \
  --tp 2 --p2p off \
  --host-pool-mib 8192 --gpu-headroom-mib 2048 \
  --vision-tower-placement ram \
  --kernels libr4d --placement layer_offload \
  --host 0.0.0.0 --port 8001
</code></pre>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>参数</th>
<th>值</th>
<th>作用</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--tp</code></td>
<td>2</td>
<td>双卡张量并行，切分 25 GiB 权重</td>
</tr>
<tr>
<td><code>--p2p</code></td>
<td>off</td>
<td>规避该双卡拓扑下 P2P 稳定性问题</td>
</tr>
<tr>
<td><code>--host-pool-mib</code></td>
<td>8192</td>
<td>8 GB 主机池承接卸载层</td>
</tr>
<tr>
<td><code>--gpu-headroom-mib</code></td>
<td>2048</td>
<td>每卡预留 2 GB 防 OOM</td>
</tr>
<tr>
<td><code>--vision-tower-placement</code></td>
<td>ram</td>
<td>Qwen3-VL 不常驻显存</td>
</tr>
<tr>
<td><code>--kernels</code></td>
<td>libr4d</td>
<td>针对 gfx12xx 的手写 RDNA4 算子</td>
</tr>
<tr>
<td><code>--placement</code></td>
<td>layer_offload</td>
<td>分层卸载</td>
</tr>
</tbody>
</table>
<p dir="auto">环境变量：<code>ROCR_VISIBLE_DEVICES=0,1</code>、<code>HSA_NO_SCRATCH_RECLAIM=0</code>、<code>HSA_SCRATCH_SINGLE_LIMIT=67108864</code>、<code>LimitMEMLOCK=infinity</code>；单元内 <code>Restart=on-failure</code>、<code>RestartSec=5</code>。</p>
<h2>14. <code>request.json</code> 完整结构</h2>
<p dir="auto">文件 96,043,875 B（91.6 MiB），实测字段：</p>
<pre><code>model               = 'minimax-h3-ref2va'
prompt              = &lt;1034 字符&gt;
task                = 'ref2va'
size                = '1344x768'
seconds             = 12.25
seed                = 145
num_inference_steps = 21
prepared_context =
    .format         = 'h3-layer50-bf16-v1'
    .rows           = 3608
    .tags           = &lt;list len=3608&gt;
    .data           = &lt;49,261,228 字符 base64&gt;
    .initial_noise  = {visual_rows, audio_rows, visual, audio}
conditions = &lt;list len=6&gt;
    [0] kind=image frames=1 height=48 width=22  visual=&lt;135,168 字符&gt;
    [1] kind=image frames=1 height=90 width=44  visual=&lt;506,880 字符&gt;
    [2] kind=image frames=1 height=78 width=52  visual=&lt;519,168 字符&gt;
    [3] kind=image frames=1 height=44 width=28  visual=&lt;157,696 字符&gt;
    [4] kind=image frames=1 height=50 width=34  visual=&lt;217,600 字符&gt;
    [5] kind=image frames=1 height=36 width=36  visual=&lt;165,888 字符&gt;
</code></pre>
<blockquote>
<p dir="auto"><code>conditions</code> 六条按顺序对应 <code>jianxin1-3</code> / <code>zhizhixiong1-3</code>；<code>height</code>/<code>width</code> 是 VAE 潜空间尺寸（×16 即像素尺寸）。<br />
<code>num_inference_steps = 21</code> 而 prepare 传的是 <code>--steps 20</code>，差 1 是引擎把初始状态计入。</p>
</blockquote>
<p dir="auto"><strong>API 调用</strong>：</p>
<pre><code>POST http://127.0.0.1:8001/v1/videos
Authorization: Bearer $RADIANCE_API_KEY
Content-Type: application/json
body = request.json
→ {"id": "video_2cfb4d1a29f83f1d1f2dac2fb6e1ea64"}
GET  /v1/videos/{id}          → status / progress
GET  /v1/videos/{id}/content  → mp4
</code></pre>
<h2>15. <code>inputs.json</code> 实测值（两条完全一致）</h2>
<pre><code class="language-json">{
  "width": 1344, "height": 768, "megapixels": 1.032192,
  "frames": 294, "fps": 24, "steps": 20, "seed": 145,
  "context_rows": 3608, "packed_rows": 95609,
  "reference_max_area": 344064, "pad_reference_video": true,
  "target_shapes": [[1, 24, 87, 48, 84], [1, 32, 2, 490]],
  "sampling_step_timeout_seconds": 600,
  "watchdog_trigger_seconds": 585,
  "preprocess_seconds": 95.995
}
</code></pre>
<blockquote>
<p dir="auto"><code>target_shapes[0] = [1,24,87,48,84]</code> → 视频潜空间：batch 1、24 通道、87 潜帧、48×84 潜空间 = 768×1344 像素。<br />
<code>target_shapes[1] = [1,32,2,490]</code> → 音频潜空间（成片带 AAC 音轨）。<br />
2D 版唯一差异是 <code>preprocess_seconds = 90.115</code>。</p>
</blockquote>
<h2>16. 成片规格（ffprobe 实测）</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>3D 版</th>
<th>2D 版</th>
</tr>
</thead>
<tbody>
<tr>
<td>文件</td>
<td><code>H3-3D-CGI-1344x768-12s.mp4</code></td>
<td><code>H3-2D-动画-1344x768-12s.mp4</code></td>
</tr>
<tr>
<td>大小</td>
<td>12,778,318 B</td>
<td>13,478,132 B</td>
</tr>
<tr>
<td>编码</td>
<td>h264</td>
<td>h264</td>
</tr>
<tr>
<td>分辨率</td>
<td><strong>1344×768</strong></td>
<td><strong>1344×768</strong></td>
</tr>
<tr>
<td>帧数</td>
<td><strong>294</strong></td>
<td><strong>294</strong></td>
</tr>
<tr>
<td>时长</td>
<td><strong>12.250000 s</strong></td>
<td><strong>12.250000 s</strong></td>
</tr>
<tr>
<td>音频</td>
<td>aac，384 帧</td>
<td>aac，384 帧</td>
</tr>
<tr>
<td>job id</td>
<td><code>video_2cfb4d1a29f83f1d1f2dac2fb6e1ea64</code></td>
<td><code>video_6b4d10461a92b4b6bae7397659aca22b</code></td>
</tr>
</tbody>
</table>
<p dir="auto">抽帧目视验证（第 0/98/196/290 帧）：人物身份与参考图一致、双刃相击火花、火星飞舞、结尾紫袍举剑指镜头；2D 版未被 3D 参考图带偏风格。</p>
<hr />
<h1>第四部分　建议</h1>
<h2>P0　已造成真实故障，建议尽快处理</h2>
<h3>建议 1　给 <code>pin</code> 加失效判定与 TTL</h3>
<p dir="auto"><strong>现象</strong>：2026-11-15 13:11–13:43 共 <strong>32 分钟</strong>，LLM 被反复拉起又杀掉，<code>:8000</code> 持续 <code>Connection refused</code>。</p>
<p dir="auto"><strong>根因</strong>：<code>.video-pin</code> 文件是<strong>永久的、无 TTL、无任何自动清除路径</strong>。另一个任务 <code>h3-lcz</code> 带 <code>KEEP_LLM_DOWN=1</code> 结束时执行了 <code>pin</code>，此后即使 <code>radiance-h3fullref</code> 已经是 <code>inactive</code>（没有任何东西需要保护），看门狗每 20 秒仍读到 <code>pin</code> → 走"让路"分支 → 唯一的动作就是 <code>docker stop radiance-flashnext</code>。</p>
<p dir="auto">现场不是"没人拉"，而是"每拉起一次，20 秒内被杀掉一次"。</p>
<p dir="auto"><strong>建议改法</strong>（<code>radiance-video-gate.sh</code> 的 <code>status</code> 分支）：<code>pin</code> 只在 <code>radiance-h3fullref</code> 确实 active 或 :8001 有排队任务时才算数；服务已停则自动 <code>rm -f "$PIN"</code> 并记日志。再加一个 <code>PIN_TTL</code>（如 3600 s）兜底。</p>
<h3>建议 2　修掉 <code>KEEP_LLM_DOWN</code> 分支跳过 <code>end</code> 的缺陷</h3>
<p dir="auto"><code>h3-make-multi.sh</code> 的清理函数：</p>
<pre><code class="language-bash">if [ "$KEEP_LLM_DOWN" = "1" ]; then
  "$VGATE" pin "KEEP_LLM_DOWN=1" 2&gt;/dev/null || true
  return $rc          # ← 在这里 return，下面的 "$VGATE" end 永远不执行
fi
"$VGATE" end
</code></pre>
<p dir="auto"><strong>建议</strong>：把 <code>end</code> 移进 <code>trap</code> 无条件执行，<code>pin</code> 只表达"别回收视频服务"，不该顺带吞掉解锁。</p>
<h3>建议 3　把 LLM 容器重新纳入 systemd 托管</h3>
<p dir="auto"><strong>现状</strong>：<code>radiance-flashnext.service</code> 显示 <code>inactive</code>，但容器在跑并正常服务 —— 因为出片脚本是靠 <code>docker start</code> 兜底拉起的，绕过了 systemd。</p>
<p dir="auto"><strong>后果</strong>：<code>gpu-exclusive.conf</code> 里的 <code>Conflicts=</code> 保护<strong>失效</strong>（systemctl 认为服务没在跑），出片脚本的 <code>systemctl stop radiance-flashnext</code> 变成空操作，只能靠 <code>docker stop</code> 兜底；引擎 OOM 时 <code>restart: "no"</code> 下没有 systemd 层重启，只能等看门狗的 20 秒周期。</p>
<p dir="auto"><strong>建议</strong>：选 LLM 空闲窗口执行 <code>docker stop radiance-flashnext &amp;&amp; systemctl start radiance-flashnext.service</code>，恢复托管。会中断当前会话，需你确认时机。</p>
<h2>P1　明显收益</h2>
<h3>建议 4　把 4 步 turbo LoRA 接进出片通路（最大单点提速机会）</h3>
<p dir="auto">磁盘上已有 <code>minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors</code>（1.82 GiB），但：</p>
<ul>
<li><code>h3_fullref.py</code> 全文<strong>无</strong> <code>lora</code> / <code>turbo</code> 字样；</li>
<li>引擎命令行也没有 <code>--lora</code> 类选项。</li>
</ul>
<p dir="auto">当前 <code>--steps 20</code> 对应生成段 <strong>1213 s</strong>。若 4 步可用，理论上生成段压到约 1/5（≈ 4 分钟），<strong>端到端从 22.3 分钟降到约 6 分钟</strong>，两条片子从 44.6 分钟降到约 12 分钟。</p>
<p dir="auto"><strong>需要先验证两件事</strong>：① radiance 引擎是否支持加载 LoRA（可能要改引擎或走 ComfyUI 通路）；② 4 步画质是否达到比赛要求。建议先拿一张参考图做 4 步 vs 20 步的 A/B 对比，再决定是否切换。</p>
<h3>建议 5　<code>--reference-max-area</code> 默认值偏低，建议在脚本里写死</h3>
<p dir="auto">默认 <code>202752</code>（576×352），而本次显式提到 <code>344064</code>。别人直接跑默认值时参考图细节会丢失，容易误判成"模型质量差"。建议在 <code>h3-make-multi.sh</code> 里把该值与分辨率绑定并加注释。</p>
<p dir="auto">同理 <code>--length</code> 默认 124（≈5.2 s）、<code>--width/height</code> 默认 576×352，直接跑默认值会得到小尺寸短片。建议脚本强制显式传参（本次已这么做）。</p>
<h3>建议 6　试一次 <code>--p2p on</code> 的 A/B</h3>
<p dir="auto">当前 <code>--p2p off</code> 是为稳定性关掉的。Z890 平台两条 x8 插槽，若 PCIe P2P 实际可用，开启后 TP2 的 all-reduce 开销可能下降。生成段 1213 s 是绝对大头，哪怕省 5% 也值 1 分钟。建议做一次对照测试，画质与稳定性无退化就常开。</p>
<h3>建议 7　试调 <code>--placement</code> / <code>--host-pool-mib</code></h3>
<p dir="auto">25 GiB 权重切到 2×32 GB，每卡仅 12.5 GiB，显存其实放得下；之所以还要 <code>layer_offload</code> + 8 GB 主机池，是激活值 + KV + 参考图编码挤占。可以试着调小 host-pool 或换 placement 策略，观察生成段是否缩短。</p>
<h2>P2　稳健性与可维护性</h2>
<h3>建议 8　出片工作目录自动清理</h3>
<p dir="auto">每个 <code>work-*</code> 目录留 <code>request.json</code> 92 MB + <code>prepared.pt</code> 143 MB ≈ 235 MB。单次不大，但模型资产已占 176.5 GB，磁盘剩 432 GB。建议脚本收尾保留最近 N 个、其余删除。</p>
<h3>建议 9　出片前检查内存余量</h3>
<p dir="auto">62 GiB 总内存，LLM 常驻 <code>--host-pool-mib 12288</code>（12 GB pinned）+ 权重，当前可用仅 16 GiB；而 H3 prepare 要把 Qwen3-VL 32B（14.6 GiB）读进内存。若同时有别的负载，可能触发 OOM。建议 prepare 前加一条 <code>MemAvailable</code> 检查，不足时先停 LLM 或把 <code>--vision-tower-placement</code> 切回显存。</p>
<h3>建议 10　把 Total Time 落到一张 CSV</h3>
<p dir="auto">现在计时证据散在 <code>contest-3d.log</code> / <code>contest-2d.log</code> 里。建议每次出片完成后追加一行 CSV（时间、分辨率、帧数、步数、prepare/generate/total），方便横向比较不同参数的耗时，也直接构成比赛要求的"完整运行日志"。</p>
<h3>建议 11　服务器侧统一 ASCII 文件名</h3>
<p dir="auto">本次实测踩坑：中文文件名（<code>成片-*.mp4</code>）在 PowerShell → SSH → bash 的管道里 glob 失败；<code>Get-Content -Raw | ssh "bash -s"</code> 会把 UTF-8 中文按 GBK 重编码导致脚本语法错误。建议服务器侧一律 ASCII 命名，本地再改中文名；含特殊字符的远端命令一律走 <code>scp</code> 传脚本 + <code>tr -d '\r'</code>。</p>
<h3>建议 12　保持现状的两项</h3>
<ul>
<li><code>radiance-h3fullref</code> 设为 <code>disabled</code>（不随开机自启）是<strong>正确</strong>的 —— 按需启动，避免开机就吃掉双卡。</li>
<li>服务"用完就停"是<strong>正确</strong>的 —— 冷启动加载 25 GiB 只要 15 s，常驻省不下什么。</li>
</ul>
<hr />
<h2>待办提醒</h2>
<ol>
<li><strong>上传油管</strong>需你本人账号操作，传完把两个链接填进 <code>参赛帖-文案.md</code> 第二节。</li>
<li><strong>发新帖</strong>：标题以 <code>[H3剑心比赛]</code> 开头（楼主 #8 楼要求），正文用 <code>参赛帖-文案.md</code>。</li>
<li>建议 3 的 systemd 重新托管需要你指定一个 LLM 空闲窗口。</li>
</ol>
]]></description><link>https://lcz.me/topic/3098</link><generator>RSS for Node</generator><lastBuildDate>Thu, 19 Nov 2026 00:16:34 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/3098.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Nov 2026 16:34:59 GMT</pubDate><ttl>60</ttl></channel></rss>