HyperFlow H3 Flash 是Video Rebirth的压缩、少步数版本,基于MiniMax-H3。它可同时生成视频和同步立体声音频。
展示·权重(Hugging Face)·ComfyUI 节点·GGUF 配置指南·适用于完整尺寸 MiniMax-H3 的 8 步 LoRA
- 输出:5.2–15 秒视频,24 fps(默认 1344×768),附带 32 kHz 立体声音轨。
- 采样:4、6(默认)或 8 步,不使用无分类器引导(CFG)。
- 速度(5.2 秒片段,6 步):4× B200 上 8.7 秒,1× H200 上 36 秒,1× RTX 5090 上 92 秒。
- 在 4× Blackwell GPU 上实时运行: NVIDIA SOL-H3在 4× B 系列 GPU 上实时运行 HyperFlow H3 Flash。SOL-H3 是我们的推理加速合作伙伴,从第 0 天起即支持该模型。
- 模型规模:13.7B(
fl2va)或 13.9B(ref2va)参数,不到约 31B 的 MiniMax-H3 transformer 的一半。 - 最小占用:
Q4_K_M为9.1 GB(Q8_0为 14.9 GB)。它可在配备16 GB 系统内存的 PC 中的 24 GB 和 32 GB GPU 上运行。16 GB GPU 尚未测量。
支持的任务
| 任务 | 输入 | ComfyUI 模板 | GGUF | Python INT8 |
|---|---|---|---|---|
t2va |
文本提示词 | hyperflow_t2v |
是 | 是 |
fl2va |
提示词 + 首帧,或首帧和末帧 | hyperflow_i2v,hyperflow_flf2v |
是 | 是 |
ref2va |
提示词 + 最多 12 个参考 | hyperflow_ref2v |
仅图像 | 图像、视频和音频 |
选择运行时
决策规则:在系统内存为 64 GB 或更少的 PC 上使用GGUF。在数据中心 GPU 上,或在系统内存至少 69 GiB 的 24 GB+ RTX GPU 上使用INT8 convrot。
所有权重均位于VideoRebirthAI/hyperflow-h3-flash。
| GGUF | INT8 convrot | |
|---|---|---|
| 运行时 | ComfyUI、Unsloth Studio、stable-diffusion.cpp(配置指南) | 此 Python 包(hyperflow-h3-flashCLI 和diffusers) |
| 精度与大小 | Q3_K_M至Q8_0(7.2–15.2 GB) |
W8A8 INT8 + 低秩(约 16 GB) |
| Hub 文件夹 | fl2va_gguf/,ref2va_gguf/ |
fl2va_int8_convrot/,ref2va_int8_convrot/ |
ref2va输入 |
图像 | 图像、视频和音频 |
| 目标 GPU | 消费级 RTX GPU(在 24 GB 和 32 GB 上测量) | H100 / H200 / B200 / B300(1–8 个 GPU),或 24 GB+ RTX GPU |
| 系统内存 | 16 GB+ | 无卸载时约 16 GiB;卸载时 ≥ 69 GiB(fp8文本编码器)或 ≥ 91 GiB(bf16) |
GGUF 运行时(ComfyUI、Unsloth Studio、stable-diffusion.cpp)
| 量化 | fl2va_gguf/ |
ref2va_gguf/ |
使用场景 |
|---|---|---|---|
Q4_K_M |
9.1 GB | 9.2 GB | 24 GB GPU 的推荐默认值 |
Q8_0 |
14.9 GB | 15.2 GB | 在显存和系统内存足够时最接近完整精度 |
Q3_K_M |
7.2 GB | 7.4 GB | 最小占用(Q4_K_S,Q5_K_M,和Q6_K也可用) |
完整配置指南:integrations/README.md。快速开始:
- ComfyUI(
Video-Rebirth/ComfyUI-HyperFlow-Flash):- 克隆ComfyUI-GGUF和ComfyUI-HyperFlow-Flash到
ComfyUI/custom_nodes/。 - 下载 15.7 GB 的
qwen3vl_32b_minimax_h3_nvfp4_awq文本编码器。 - 在 16 GB 或 32 GB PC 上,使用以下命令启动 ComfyUI
python main.py --fast-disk。 - 打开工作流 > 浏览模板 > ComfyUI-HyperFlow-Flash并选择
hyperflow_t2v,hyperflow_i2v,hyperflow_flf2v,或hyperflow_ref2v。
- 克隆ComfyUI-GGUF和ComfyUI-HyperFlow-Flash到
- Unsloth Studio(安装指南):
- 将
SD_CLI_PATH指向已打补丁的sd-cli二进制文件并运行unsloth studio。 - 加载
VideoRebirthAI/hyperflow-h3-flash(fl2va_gguf/或ref2va_gguf/)。 - Studio 会自动下载配套的文本编码器和 VAE。它以
CFG = 1运行内置的 6 步调度。
- 将
- stable-diffusion.cpp(
integrations/stable-diffusion.cpp/):应用hyperflow-two-time.patch到上游提交3be2378。该补丁添加了双时间(t, r)嵌入器、低秩线性层、来自 GGUF 元数据的默认 6 步调度,以及针对长片段的 32 位 matmul token 拆分。
Python 包(INT8 convrot)
安装
pip install git+https://github.com/Video-Rebirth/hyperflow-h3-flash pip install "hyperflow-h3-flash[hopper] @ git+https://github.com/Video-Rebirth/hyperflow-h3-flash" #H100 / H200:FlashAttention-3 pip install "hyperflow-h3-flash[fp8] @ git+https://github.com/Video-Rebirth/hyperflow-h3-flash" #--text-encoder-precision fp8
- 要求:Python 3.10+、带 CUDA 和 Triton 的 PyTorch 2.6+(
pip install triton-windows在原生 Windows 上),一块 Ampere 或更新的 NVIDIA GPU,以及diffusers >= 0.40。多 GPU(--gpus> 1)需要 Linux 或 WSL2(在 WSL2 上提高memory=中的%UserProfile%\.wslconfig)。 - 首次运行下载:约 90 GB,使用
--text-encoder-precision fp8时约 68 GB。这包括 MiniMax-H3 文本编码器、VAE,以及针对所选任务的 16 GB HyperFlow INT8 transformer。62 GB 的基础 transformer 永远不会被下载。 - 首次运行编译:Triton INT8 内核在首次使用时编译(约 1 分钟)。
命令行
运行hyperflow-h3-flash或python -m hyperflow_h3_flash:
#文本生成视频 + 音频(t2va) hyperflow-h3-flash --prompt "一位厨师将一碗冒着热气的拉面滑过木质柜台;雨点敲打着窗户。" \ --output ramen.mp4 #首帧,或首帧 + 尾帧(fl2va) hyperflow-h3-flash --prompt "..." --image first.png --output clip.mp4 hyperflow-h3-flash --prompt "..." --image first.png --last-image last.png --output clip.mp4 #按提示词顺序的参考图像、视频(带音轨)和音频片段(ref2va) hyperflow-h3-flash --prompt "<Picture 1> 走过 <Picture 2> 的场景……" \ --reference person.png --reference scene.png --output clip.mp4 #15 秒片段,跨 4 块 GPU 的上下文并行(或 --gpus auto,最多使用 4 块可见 GPU) hyperflow-h3-flash --prompt "..." --num-frames 360 --gpus 4 #4 步(速度)、6 步(默认)或 8 步(质量) hyperflow-h3-flash --prompt "..." --steps 4
| 选项 | 取值 / 默认值 | 描述 |
|---|---|---|
--steps |
4,6(默认),8 |
采样步数:4用于速度,6均衡,8用于质量。Sigma 网格位于schedule.py。 |
--num-frames |
124–362(默认124) |
24 fps 下的帧数(5.2到15 s)。向上取整到17n + 5(360变为362)。 |
--height,--width |
32 的倍数 | 默认:短边 768。遵循--image宽高比,或对t2va使用 16:9。 |
--reference |
可重复的路径 | ref2va输入匹配<Picture i>、<Video i>和<Audio i>按提示词顺序。限制:9 张图像、3 个视频、3 个音频片段,共 12 个。 |
--gpus(--num-gpus) |
1,2,4,7,8,auto |
多 GPU 上下文和 VAE 分块并行。在torchrun下自动重新启动。 |
--offload |
auto(默认),none,model,stream |
GPU 内存放置。参见卸载模式。 |
--text-encoder-precision |
bf16(默认),fp8 |
fp8加载Qwen/Qwen3-VL-32B-Instruct-FP8。卸载时节省约 22 GiB 系统内存。需要[fp8]额外项。 |
--fp8-gemm |
triton(默认),deepgemm |
的 GEMM 后端fp8文本编码器。deepgemm需要 Hopper 或更新架构。 |
--attention |
auto(默认),sdpa,fa3 |
在 Hopper 上使用 FlashAttention-3(fa3)当kernels已安装时。否则使用 PyTorchsdpa。 |
--block-chunk |
0(默认),16384,…… |
将 transformer 块的每个逐 token 操作切片,以限制 VRAM 激活占用。16384可在 24 GB VRAM 中容纳 15 s 混合ref2va。 |
--weights,--subfolder,--base-model |
Hub ID 或本地路径 | 覆盖 transformer 仓库、任务子文件夹或基础MiniMaxAI/MiniMax-H3快照。 |
examples/benchmark.py在以下条件下对每个流水线阶段和每 GPU 峰值内存计时torchrun。
Python API
import torch from diffusers.utils.export_utils import encode_video from hyperflow_h3_flash import load_pipeline pipe = load_pipeline("t2va") # "fl2va":传入 image=...(以及 last_image=...);"ref2va":传入 references=[...] out = pipe( prompt="一位厨师将一碗冒着热气的拉面滑过木质柜台。", num_frames=124, num_inference_steps=6, # 4、6 或 8 generator=torch.Generator().manual_seed(0), output=["videos", "audio", "sampling_rate"], ) encode_video( out["videos"][0], fps=24, output_path="ramen.mp4", audio=out["audio"][0], audio_sample_rate=out["sampling_rate"], )
- 多 GPU 在以下条件下
torchrun:调用torch.distributed.init_process_group("nccl")并传入device=f"cuda:{local_rank}"到load_pipeline。流水线在各 rank 间分片执行,并在每个 rank 上返回完整输出。 - 独立 transformer(
AutoModel):每个 INT8 Hub 文件夹都附带自包含的模型代码。无需安装此包即可加载:from diffusers import AutoModel,然后AutoModel.from_pretrained("VideoRebirthAI/hyperflow-h3-flash", subfolder="fl2va_int8_convrot", trust_remote_code=True, torch_dtype=torch.bfloat16)。
卸载模式
--offload设置 GPU 内存放置。auto(默认)根据每 GPU VRAM 选择模式:
--offload |
保留在 GPU VRAM 中 | auto阈值(1 GPU / 多 GPU) |
系统 RAM(bf16/fp8文本编码器) |
|---|---|---|---|
none |
所有组件 | ≥ 90 GiB / ≥ 65 GiB | ~16 GiB |
model |
一次一个活动组件 | ≥ 60 GiB / ≥ 45 GiB | ~91 GiB / ~69 GiB |
stream |
一次活动 VAE + 一个 transformer 块或文本编码器层 | < 60 GiB / < 45 GiB | ~91 GiB / ~69 GiB |
stream在同一 GPU 上仅比none慢约 2%。model和stream将卸载的权重保留在一个固定的主机内存分配中。- 加载器会丢弃条件提取点以上未使用的 Qwen3-VL 层。这节省约 14 GB。
--text-encoder-precision fp8再节省约 22 GiB。 - 在容器中,从
/sys/fs/cgroup/memory.max读取内存限制,而不是从free。
基准测试
所有运行均为端到端,在1344×768 和 6 步:文本编码、transformer 以及视频和音频 VAE 解码。每个a / b单元格是5.2 s / 15 s片段(124 / 362 帧)的总时间。
消费级 RTX GPU:t2va
| GPU | GGUF,≥ 64 GB RAM | GGUF,32 GB RAM | GGUF,16 GB RAM | INT8,≥ 69 GiB RAM |
|---|---|---|---|---|
| RTX 5090(32 GB) | 99 s / 575 s | 118 s / 618 s | 130 s / 615 s | 92 s / 551 s |
| RTX 4090(24 GB) | 157 s / 830 s | 151 s / 815 s | 153 s / 812 s | 130 s / 750 s |
| RTX 3090(24 GB) | 315 s / 1835 s | 318 s / 1869 s | 325 s / 1866 s | 266 s / 1684 s |
| 峰值 VRAM | 5090:28 / 27 GiB;24 GB:23 / 22 GiB | 相同 | 相同 | 12.0–12.5 / 21.8–22.4 GiB |
- GGUF 配置:ComfyUI,
Q4_K_M,以及 15.7 GB 的nvfp4文本编码器。32 GB 和 16 GB 的 PC 使用--fast-disk,模型放在 NVMe 上(主机内存)。在 ≥ 64 GB 的 PC 上,峰值 RSS 为 34–37 GiB。在 32 GB 的 PC 上,匿名 RSS 约为 8–16 GiB;在 16 GB 的 PC 上约为 8 GiB。 - INT8 配置:
hyperflow-h3-flash --offload stream。它需要 ≥ 91 GiB 的系统内存,并搭配bf16文本编码器;或者搭配fp8时约需 69 GiB。15 s 的 RTX 5090 运行使用了fp8。 - INT8 transformer 快 10–20%。GGUF 所需的系统内存不到一半。transformer 占用了超过 80% 的时间,且受算力限制。ComfyUI 在运行时对
Q4_K_M权重进行反量化。 - 在 16 GB 和 32 GB 的 PC 上使用
--fast-disk。它从操作系统文件页缓存中流式读取非驻留权重。若不使用它,当 VRAM 溢出时,ComfyUI-GGUF 会把 9 GB 的 transformer 复制到固定内存中。此时 16 GB 的 PC 在 15 s 片段上会耗尽内存。在 32 GB 的 PC 上,RTX 3090 和 5090 会分别变慢 13% 和 21%(文本编码耗时 27–31 s,而非 7–9 s)。 - 32 GB 的 VRAM 可同时容纳两个模型。在 RTX 5090 上,文本编码器和 transformer 会同时驻留在 VRAM 中(文本编码耗时 0.8 s)。在 24 GB 的 GPU 上,ComfyUI 会在各阶段之间交换它们(文本编码耗时 10–16 s)。
- 关键帧任务(
i2v,flf2v):参见GGUF 指南:性能。
消费级 RTX GPU:ref2va
| GPU | INT8,2 张图像 | INT8,混合 | GGUFmatch,2 张图像 |
GGUFmax,2 张图像 |
|---|---|---|---|---|
| RTX 5090(32 GB) | 266 s / 914 s | 503 s / 1318 s | 135 s / 660 s | 295 s / 995 s² |
| RTX 4090(24 GB) | 319 s / 1167 s | 630 s / 1702 s¹ | 194 s / 885 s | 398 s / 1275 s² |
| RTX 3090(24 GB) | 726 s / 2763 s | 1441 s / 4033 s¹ | 401 s / 2059 s | 885 s / 2995 s² |
| 峰值 VRAM | 19.5–19.8 / 23.3–25.6 GiB | 19.6–20.2 / 22.8–28.5 GiB | 5090:31 GiB;24 GB:22 GiB(5.2 s) | 5090:30 GiB;24 GB:21 GiB(5.2 s) |
- 参考:用以下方式生成的两张 768p 静帧
t2va(一个人和一个街市)。混合是一张静帧、一段 5.2 s 的带音轨参考视频,以及一段音频片段。 - INT8 配置:100–125 GB 系统内存(进程 RSS 为 80–88 GiB)。¹ 在 24 GB 的 GPU 上,15 s 的混合运行需要
--block-chunk 16384。若不使用它,它们会耗尽 VRAM。 - GGUF 配置:在 ≥ 64 GB 内存上运行 ComfyUI,搭配
hyperflow_ref2v_api.json以及nvfp4文本编码器。ref_image_sizematch(默认)会将每个参考缩放到输出的像素面积,并保持其宽高比。max仅在短边超过 2048 时才缩小。max运行使用了放大到 3584×2048 的静帧,即 INT8 流程所用的尺寸。²max在 15 s 时需要python main.py --disable-cuda-malloc。默认的cudaMallocAsync分配器会失败,报错为CUDA error: invalid argument。 - 每个参考都会给每一步增加 token。在 2048 短边下,一张图像会增加约 14,300 个 token(约七个 768p 潜帧)。片段本身在 5.2 s 时为 37,710 个 token,在 15 s 时为 109,062 个。注意力开销随 token 数量的平方增长。因此在 5.2 s 时,INT8 transformer 在两张图像下耗时是原来的 2.6–2.9 倍,在混合集合下是 5.2–5.8 倍。
t2va在两张图像下耗时是原来的 2.6–2.9 倍,在混合集合下是 5.2–5.8 倍。 - GGUF
match是最快的图像参考路径。它增加了 24–36% 到t2v在 5.2 s 时增加 24–36%,在 15 s 时增加 7–15%。在相同参考尺寸下(max),GGUF 在 5.2 s 时比 INT8 慢 11–25%,在 15 s 时慢 8–9%。 --fast-disk也适用于ref2v。32 GB 和 16 GB 的 PC 在三块 GPU 上都运行了 5.2 s 和 15 s 的片段,在 15 s 时与 ≥ 64 GB RAM 的差距在 4% 以内。参见GGUF 指南:主机 RAM。
数据中心 GPU(INT8)
| GPU | --offload |
5.2 s | 15 s | 峰值 VRAM / GPU(5.2 s / 15 s) | 系统 RAM / GPU |
|---|---|---|---|---|---|
| 1× H200(141 GB) | none |
36 s | 229 s | 80 / 91 GiB | 16 GiB |
| 2× H200(141 GB) | none |
24 s | 119 s | — / 71 GiB | 16 GiB |
| 4× H200(141 GB) | none |
12.6 s(16 s SDPA) | 66 s | 47 / 59 GiB | 16 GiB |
| 4× B200 | none |
8.7 s | — | 46 GiB | 16 GiB |
- 实时推理:该表测量的是此软件包。要在 4× B 系列 GPU 上实现实时,请使用NVIDIA SOL-H3。
- INT8 GEMM 后端:4× H200 这一行使用默认的 Triton 内核(12.6 s)。
int8_gemm="sgl"(通过以下方式使用 CUTLASS INT8sgl-kernel)测得 12.3 s。 - 4-GPU 阶段耗时(5.2 s):文本编码器 0.11–0.16 s。6 步 transformer 在 4× H200 上为 7.8–7.9 s,在 4× B200 上为 5.0 s。视频 VAE 解码 3.3–4.0 s。
- 1088p(1920×1088,362 帧):在 1× H200 上为 743 s(106 GiB VRAM)。在 4× H200 上为 220 s(68 GiB VRAM/GPU)。
架构与硬件说明
工作原理
HyperFlow H3 Flash 以三种方式改变了 MiniMax-H3 transformer:
- 结构化剪枝与低秩分解:
| 分区 | Hub 文件夹 | 替换 | 被丢弃的块 | 分解后的线性层 | 参数 |
|---|---|---|---|---|---|
fl2va(服务于t2va和fl2va) |
fl2va_int8_convrot/,fl2va_gguf/ |
transformer |
50 个中的 3 个(块 6、21、22) | 102 | 13.7B |
ref2va |
ref2va_int8_convrot/,ref2va_gguf/ |
transformer_ref |
50 个中的 1 个(块 9) | 114 | 13.9B |
- 旋转 W8A8 INT8 量化(
convrot):180 个线性层在块对角 Hadamard 旋转之后被量化为 W8A8 INT8。 - 双时间
(t, r)条件化:每个 token 都会接收当前噪声水平t和步端点r。这使得无需 CFG 即可进行 4 到 8 步采样。条件化 token 保持在其锚定噪声水平(r = t)。
多 GPU 与内核调度(hyperflow-h3-flash)
-
序列与 VAE 并行(
--gpus N):Ulysses 上下文并行将打包后的 transformer 序列拆分到 $N$ 块 GPU 上。各 rank 并行编码关键帧和参考帧,并解码空间视频 VAE 分块。随后它们进行 all-gather 并混合各分块,以逐位匹配单 GPU 输出。 -
文本编码器放置:使用
--offload none以及bf16文本编码器时,FSDP2 将 50 GiB 的文本编码器分片到多块 GPU 上。这将 4 GPU 的峰值显存从 91 GiB 降至 59 GiB/GPU。当进行卸载或使用fp8时,rank 0 运行文本编码器并广播嵌入(约 2 MB)。 - INT8 GEMM 调度:
| GPU 架构 | 内核后端 |
|---|---|
Ampere、Ada、Hopper、消费级 Blackwell(sm_80–sm_90,sm_120) |
在 99 KiB 共享内存限制内融合的 Triton 内核(或在 Hopper 上通过sgl-kernel使用 CUTLASS INT8) |
数据中心 Blackwell(sm_100) |
cuBLASLtINT8 |
B300(sm_103) |
BF16 张量核心,使用fp32累加(INT8 张量吞吐在sm_103上受限;需要 PyTorch 2.8+ 及sm_103Triton 支持) |
- 可复现性:相同的种子、GPU 架构、GPU 数量和注意力后端会产生逐位相同的片段。
text_encoder_fsdp和vae_parallel保持逐位输出。
开发
make install #创建 .venv 并以可编辑模式安装包含开发工具的包 make 测试 #在微型模型上运行单元测试(无 GPU 时 CUDA 测试会跳过) make lint #ruff 检查 + 格式检查
仓库布局
.
├── src/hyperflow_h3_flash/ # Python package (INT8 runtime)
│ ├── cli.py # `hyperflow-h3-flash` CLI entry point
│ ├── __main__.py # `python -m hyperflow_h3_flash` entry point
│ ├── hostmem.py # Host RAM estimate before loading
│ ├── pipeline.py # `load_pipeline`: loads models, trims unused text-encoder layers, configures offload/multi-GPU
│ ├── blocks.py # Modular Pipeline blocks swapped into the official MiniMax-H3 workflows
│ ├── transformer.py # `HyperFlowH3FlashTransformer3DModel`: dropped blocks, low-rank linears, two-time (t, r) conditioning
│ ├── int8.py # Hadamard-rotated W8A8 linear layers (Triton, cuBLASLt, CUTLASS, and B300 BF16 kernels)
│ ├── schedule.py # 4-, 6-, and 8-step sigma grids and per-token (t, r) pairs
│ ├── offload.py # Single-GPU memory placement (`none`, `model`, `stream`)
│ └── distributed.py # Multi-GPU execution (torchrun launch, Ulysses attention, FSDP2 / rank-0 text encoder, parallel VAE)
├── integrations/ # GGUF runtimes for consumer GPUs
│ ├── README.md # Step-by-step setup guide for ComfyUI, Unsloth Studio, and stable-diffusion.cpp
│ ├── ComfyUI-HyperFlow-Flash/ # Custom nodes (`loader_nodes.py`, `model_patch.py`, `gguf_io.py`; GPL-3.0)
│ │ └── example_workflows/ # Four UI workflows (`hyperflow_t2v`, `hyperflow_i2v`, `hyperflow_flf2v`, `hyperflow_ref2v`) and API versions in `api/`
│ └── stable-diffusion.cpp/ # `hyperflow-two-time.patch` for upstream commit `3be2378` (MIT)
├── examples/ # `benchmark.py` (per-stage timings and peak memory)
├── tests/ # Unit tests on tiny models (CUDA tests skip without a GPU)
├── Makefile # `make install`, `make test`, and `make lint`
├── pyproject.toml # Package metadata and optional extras (`hopper`, `sgl`, `fp8`, `dev`)
├── LICENSE # Apache License 2.0
└── THIRD_PARTY_NOTICES.md # Notices for components adapted from `diffusers`
许可证
- 仓库代码: Apache License 2.0,但
integrations/ComfyUI-HyperFlow-Flash(GPL-3.0)和integrations/stable-diffusion.cpp(MIT)除外。 - 第三方声明:改编自
diffusers的组件保留其声明于THIRD_PARTY_NOTICES.md中。 - 模型权重:MiniMax-H3 的模型衍生作品,依据 MiniMax H3 社区许可协议分发。CLI 和
load_pipeline在首次运行时下载它们,使用即表示接受该协议。该协议不涵盖在欧盟、英国、韩国或美国的使用(未经 MiniMax 授权),并且包含可接受使用政策。有关许可条款和声明,请参阅模型卡。