Ascend-SACT/Minimax-H3-Optimization
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

MiniMax-H3 vLLM-Omni Ascend 910B2 (A2) 部署实践

适用于 Atlas 800T A2 服务器(910B2),vllm-omni v0.28.0 参考:MiniMax-H3-NPU A3 部署指南

1. 适用范围

分区任务输入能力
combined(FL2VA + Ref2VA 双 DiT 同时加载)T2VA0 图,文本生成音视频
combinedFL2VA1 图首帧,或 2 图首帧+尾帧生成音视频
combinedRef2VA单图/多图、图片加音频、单视频/多视频参考生成

本报告基于 910B2 (Atlas 800T A2) 4 卡部署,对比 v0.28.0 优化包中各层叠加的收益。

2. 环境

项验证基线
硬件Atlas 800T A2 (910B2),8 个逻辑 NPU(测试用 4 卡),每卡 64 GB HBM
驱动25.5.2
CANN Toolkit9.0.1
Python3.12.13
容器镜像quay.io/ascend/vllm-omni:v0.28.0
补丁vllm-omni-h3-optimization-full-v0.28.0.patch(317 行,5 文件)+ vllm-omni-h3-res-multistep-v0.28.0.patch(228 行,3 文件)
优化包package-v0.28-910B2/

2.1 与 A3 参考环境的差异

项A3(参考仓库)A2(本机)
芯片910B3910B2
镜像v0.26.0-a3v0.28.0(通用版)
服务形态分区独立服务(FL2VA / Ref2VA 分开)combined 服务(双 DiT 同时加载)
DLO--enable-layerwise-offload(普通)--enable-distributed-layerwise-offload --dlo-no-use-allgather
INT8 量化不支持支持(v0.28 新特性)
RainFusion 稀疏 FA不支持支持(mindiesd 3.1.0 内置)
Cache-DiT不支持支持(双 DiT 缓存)
容器要求无特殊必须 --ipc=host

2.2 910B2 特有注意事项

  1. 容器必须 --ipc=host:默认 /dev/shm 仅 64MB,vllm-omni 需要 ≥240MB
  2. 日志必须重定向到文件:docker exec -d 的 pipe 无 reader,日志丢光
  3. PYTORCH_NPU_ALLOC_CONF=expandable_segments:True 必须:INT8 量化时 npu_dynamic_quant 因碎片化 OOM
  4. --dlo-no-use-allgather 必须:910B2 上默认 AllGather 路径导致 aclnnCat 超时卡死
  5. RainFusion 910B2 实测可用:原"仅 A3 验证"结论随 mindiesd 3.1.0 过时
  6. v0.28.0 通用镜像已内置 mindiesd 3.1.0,无需额外安装

3. 部署准备

3.1 权重

/mnt/weight/MiniMax-H3/
├── FL2VA/          # FL2VA 分区(transformer/text_encoder/VAE 等)
├── Ref2VA/         # Ref2VA 分区(transformer/text_encoder/VAE 等)
├── transformer/    # 主 DiT(14 个 shard)
├── transformer_ref/# Ref DiT(14 个 shard)
├── text_encoder/   # Qwen3-VL 文本编码器
├── vae/            # 视频 VAE
└── audio_vae/      # 音频 VAE

3.2 Turbo LoRA 权重

/mnt/weight/Minimax-h3-Turbo/
├── minimax_h3_fl2v_turbo_4step_v1.0_768p_bf16.safetensors
└── minimax_h3_ref2v_turbo_8step_v1.0_768p_bf16.safetensors

3.3 容器创建

docker run -itd --name minimax-h3-v028 \
  --privileged --network host --ipc=host \
  --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/Ascend/driver:/usr/local/Ascend/driver \
  -v /usr/local/Ascend/addkernell:/usr/local/Ascend/addkernell \
  -v /mnt/weight:/mnt/weight \
  quay.io/ascend/vllm-omni:v0.28.0 \
  /bin/bash -c "sleep infinity"

3.4 应用补丁

docker exec minimax-h3-v028 bash -c '
cd /vllm-workspace/vllm-omni
git apply /path/to/vllm-omni-h3-optimization-full-v0.28.0.patch
git apply /path/to/vllm-omni-h3-res-multistep-v0.28.0.patch
'

两个补丁按上述顺序应用,相互正交(res_multistep 补丁基于五文件补丁后的文件状态生成)。

3.5 启动服务

docker exec -d minimax-h3-v028 bash /tmp/start_h3_npu_4card_rainfusion.sh

4. 服务部署

4.1 生产配置(INT8 + RainFusion + cache_dit + DLO)

source /usr/local/Ascend/ascend-toolkit/set_env.sh
export ASCEND_RT_VISIBLE_DEVICES=4,5,6,7
export MASTER_PORT=29697
export PORT=9098
export MODEL=/mnt/weight/MiniMax-H3

export VLLM_WORKER_MULTIPROC_METHOD=spawn
export VLLM_OMNI_VIDEO_SYNC_TIMEOUT=1800
export VLLM_OMNI_ASYNC_OUTPUT_TIMEOUT=1800
export HCCL_OP_EXPANSION_MODE=AIV
export VLLM_OMNI_PRINT_STAGE_TIMING=1
export OMP_NUM_THREADS=1
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True

exec vllm serve "${MODEL}" \
  --omni --host 0.0.0.0 --port "${PORT}" \
  --trust-remote-code --num-gpus 4 \
  --usp 4 --ring 1 --text-encoder-tp-size 4 \
  --enable-distributed-layerwise-offload --dlo-no-use-allgather \
  --quantization int8 \
  --vae-parallel-mode tile --vae-use-tiling --vae-patch-parallel-size 4 \
  --diffusion-attention-backend RAINFUSION_ATTN \
  --cache-backend cache_dit --enable-cache-dit-summary \
  --init-timeout 3600 --stage-init-timeout 3600

4.2 BF16 基线配置(不含 INT8/RainFusion)

# 去掉 --quantization int8
# 换 --diffusion-attention-backend FLASH_ATTN

4.3 健康检查

curl -fsS http://127.0.0.1:9098/v1/models

5. 服务调用

5.1 T2VA(0 图,文本生成音视频)

curl -sS -X POST http://127.0.0.1:9098/v1/videos/sync \
  -F 'prompt=In a snowy blue-purple forest, Ori carefully walks past a sleeping giant.' \
  -F 'width=1344' -F 'height=768' -F 'aspect_ratio=16:9' -F 'fps=24' \
  -F 'num_inference_steps=21' -F 'flow_shift=12' -F 'seed=1101' \
  -F 'extra_params={"task":"t2va","duration":5.0,"audio_flow_shift":3.0,"sampler_mode":"res_multistep"}' \
  -o t2va.mp4

5.2 FL2VA(1 图首帧)

curl -sS -X POST http://127.0.0.1:9098/v1/videos/sync \
  -F 'prompt=A quiet cinematic night scene with a lighthouse, matching ambient sound.' \
  -F 'fps=24' -F 'num_inference_steps=21' -F 'flow_shift=12' -F 'seed=2101' \
  -F 'extra_params={"task":"fl2va","duration":5.0,"audio_flow_shift":3.0,"sampler_mode":"res_multistep"}' \
  -F "input_reference=@first-frame.png;type=image/png" \
  -o fl2va.mp4

5.3 FL2VA(2 图首帧+尾帧)

curl -sS -X POST http://127.0.0.1:9098/v1/videos/sync \
  -F 'prompt=A quiet cinematic night scene with a lighthouse.' \
  -F 'fps=24' -F 'num_inference_steps=21' -F 'flow_shift=12' -F 'seed=2201' \
  -F 'extra_params={"task":"fl2va","duration":5.0,"frame_indices":[0,-1],"audio_flow_shift":3.0,"sampler_mode":"res_multistep"}' \
  -F "input_references=@first-frame.png;type=image/png" \
  -F "input_references=@last-frame.png;type=image/png" \
  -o fl2va-firstlast.mp4

5.4 Ref2VA(图片参考)

curl -sS -X POST http://127.0.0.1:9098/v1/videos/sync \
  -F 'prompt=A white cat sits on a beige couch and slowly looks toward the camera.' \
  -F 'aspect_ratio=adaptive' -F 'short_edge=768' \
  -F 'fps=24' -F 'num_inference_steps=21' -F 'flow_shift=12' -F 'seed=3101' \
  -F 'extra_params={"task":"ref2va","duration":5.0,"audio_flow_shift":3.0,"sampler_mode":"res_multistep"}' \
  -F "input_reference=@picture1.png;type=image/png" \
  -o ref2va-img.mp4

5.5 Ref2VA(图片+音频)

python3 -m http.server 18080 --bind 127.0.0.1 --directory /path/to/audio
curl -sS -X POST http://127.0.0.1:9098/v1/videos/sync \
  -F 'prompt=A white cat with black mustache sits on a beige couch, lip-syncing to the reference audio.' \
  -F 'aspect_ratio=adaptive' -F 'short_edge=768' \
  -F 'fps=24' -F 'num_inference_steps=21' -F 'flow_shift=12' -F 'seed=3102' \
  -F 'extra_params={"task":"ref2va","duration":5.0,"audio_flow_shift":3.0,"sampler_mode":"res_multistep"}' \
  -F "input_reference=@picture1.png;type=image/png" \
  -F 'audio_reference={"audio_url":"http://127.0.0.1:18080/audio.mp3"}' \
  -o ref2va-audio.mp4

5.6 Turbo LoRA(请求级蒸馏)

# T2VA + fl2v Turbo 4 步
curl -sS -X POST http://127.0.0.1:9098/v1/videos/sync \
  -F 'prompt=In a snowy blue-purple forest, Ori carefully walks past a sleeping giant.' \
  -F 'width=1344' -F 'height=768' -F 'aspect_ratio=16:9' -F 'fps=24' \
  -F 'num_inference_steps=5' -F 'flow_shift=6' -F 'seed=1101' \
  -F 'extra_params={"task":"t2va","duration":5.0,"audio_flow_shift":3.0}' \
  -F 'lora={"name":"turbo4","local_path":"/path/to/minimax_h3_fl2v_turbo_4step_v1.0_768p_bf16.safetensors"}' \
  -o t2va-turbo.mp4

# Ref2VA + ref2v Turbo 8 步
curl -sS -X POST http://127.0.0.1:9098/v1/videos/sync \
  -F 'prompt=A white cat sits on a beige couch and slowly looks toward the camera.' \
  -F 'aspect_ratio=adaptive' -F 'short_edge=768' \
  -F 'fps=24' -F 'num_inference_steps=9' -F 'flow_shift=6' -F 'seed=3101' \
  -F 'extra_params={"task":"ref2va","duration":5.0,"audio_flow_shift":3.0}' \
  -F "input_reference=@picture1.png;type=image/png" \
  -F 'lora={"name":"turbo8","local_path":"/path/to/minimax_h3_ref2v_turbo_8step_v1.0_768p_bf16.safetensors"}' \
  -o ref2va-turbo.mp4

5.7 采样器选择(sampler_mode)

vllm-omni-h3-res-multistep-v0.28.0.patch 为 H3 增加二阶采样器选项,通过 extra_params 的 sampler_mode 字段选择:

值行为
euler(默认;不传字段同此)一阶 Euler,与 v0.28.0 原生路径逐字节一致
res_multistep二阶多步采样(对数 σ 坐标,与 DPM-Solver++(2M)/UniPC 同族);非法值直接拒绝(OmniClientError)

为什么能用更少步数:Euler 每步只按当前斜率走直线,步长变大(如 50→21 步)时离散化误差线性放大;res_multistep 每步额外参考上一步的 x0 预测做二阶修正——多看一步历史不增加网络前向(每步仍 1 次),全局误差从 O(h) 降到 O(h²),同等精度所需步数显著更少。首步与终段(无历史 / σ→0)自动退化 Euler,有单元契约测试覆盖。

推荐配置:num_inference_steps=21 + "sampler_mode":"res_multistep"(§5.1~§5.5 示例即此配置)。实测(910B3 4 卡,v0.28.0 + 同款补丁,15 格 = 3 prompts × 5 seeds):

指标Euler 21 步res_multistep 21 步
时延均值158.9 s158.7 s(比值 0.998,零代价)
ΔPSNR(对 Euler 21 步)—mean +0.26 dB,8/15 胜,95% CI [−0.43, +0.96](统计等价)

对 50 步 Euler 基线时延 −57.6%;进一步压时延可叠加 cache_dit / INT8(见 4.1 生产配置)。