Spaces:
Running on Zero
Running on Zero
Commit ·
28abc33
1
Parent(s): 6f1b8ed
Document complete optimization stack
Browse files
README.md
CHANGED
|
@@ -13,33 +13,33 @@ suggested_hardware: zero-a10g
|
|
| 13 |
|
| 14 |
# MiniMax-H3 Ultra Fast — local conditioner + pruned NVFP4 on Blackwell
|
| 15 |
|
| 16 |
-
Joint video and synchronized sound from MiniMax-H3,
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
-
|
| 43 |
|
| 44 |
The source model is [`MiniMaxAI/MiniMax-H3`](https://huggingface.co/MiniMaxAI/MiniMax-H3). The pruned NVFP4
|
| 45 |
checkpoint is
|
|
@@ -146,10 +146,6 @@ exact original denoiser, set `H3_ENGINE=bf16`; this restores the 61.7 GiB unquan
|
|
| 146 |
| `H3_CONDITIONER` | `multimodalart/qwen3vl-conditioner` | Prompt-upsampling and local-load fallback service. |
|
| 147 |
| `H3_PLACEMENT` | `lazy` (`nvfp4`) | Move the compact transformer and VAEs on the first GPU call, then keep them resident. |
|
| 148 |
| `H3_ATTENTION` | `_native_cudnn` | Attention backend for both the main stack and text refiner. |
|
| 149 |
-
| `H3_EASYCACHE_THRESHOLD` | `0.10` | Balanced-mode maximum accumulated estimated change before a full denoiser evaluation. |
|
| 150 |
-
| `H3_EASYCACHE_START` | `0.15` | Fraction of the schedule before which every step is evaluated. |
|
| 151 |
-
| `H3_EASYCACHE_END` | `0.95` | Fraction of the schedule after which every step is evaluated. |
|
| 152 |
-
| `H3_EASYCACHE_SUBSAMPLE` | `8` | Generated-video row stride used by the inexpensive change estimator. |
|
| 153 |
| `H3_FIRST_BLOCK_THRESHOLD` | `0.08` | Balanced-mode normalized first-block residual threshold, matching NVIDIA's H3 preset. |
|
| 154 |
| `H3_FIRST_BLOCK_DENSE_START` | `3` | Dense warmup steps retained before FirstBlockCache may reuse blocks 2–50. |
|
| 155 |
| `H3_FIRST_BLOCK_DENSE_END` | `2` | Dense tail steps retained after FirstBlockCache reuse is disabled. |
|
|
@@ -174,6 +170,21 @@ exact original denoiser, set `H3_ENGINE=bf16`; this restores the 61.7 GiB unquan
|
|
| 174 |
No secret is required. All model artifacts are public. Normal requests use one local GPU booking; a prompt-upsampling
|
| 175 |
request forwards the requesting user's ZeroGPU identity to the remote rewriter/conditioner.
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
## Attribution
|
| 178 |
|
| 179 |
This is an optimized derivative of the original
|
|
@@ -185,3 +196,5 @@ ComfyUI (Apache-2.0). FirstBlockCache and Sol-Attn are adapted from NVIDIA's Apa
|
|
| 185 |
[`MiniMax-H3 Sol-Engine`](https://github.com/NVlabs/Sana/tree/sol-engine/models/minimax_h3) release. The quantized checkpoint and its conversion notes are from
|
| 186 |
[`lilcheaty/MiniMax-H3-NVFP4`](https://huggingface.co/lilcheaty/MiniMax-H3-NVFP4). MiniMax-H3 weights remain governed
|
| 187 |
by the MiniMax-H3 Community License Agreement.
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# MiniMax-H3 Ultra Fast — local conditioner + pruned NVFP4 on Blackwell
|
| 15 |
|
| 16 |
+
Joint video and synchronized sound from MiniMax-H3, rebuilt for a single 96 GB Blackwell ZeroGPU worker.
|
| 17 |
+
|
| 18 |
+
## Active optimization stack
|
| 19 |
+
|
| 20 |
+
| layer | optimization |
|
| 21 |
+
|---|---|
|
| 22 |
+
| Weights | 12.5 GB pruned NVFP4 transformer: 20.1B effective parameters instead of 33.1B/61.7 GiB BF16. |
|
| 23 |
+
| Compute | Native CUDA 13 NVFP4 tensor-core GEMMs through `comfy-kitchen`; higher-precision norms, embeddings and output heads. |
|
| 24 |
+
| Residency | Transformer, conditioner and both VAEs remain GPU-resident during generation—no layerwise CPU offload. |
|
| 25 |
+
| Conditioner | Local 15.7 GB Qwen3-VL NVFP4-AWQ checkpoint containing only the 50 language layers H3 uses; no normal cross-Space encode round trip. |
|
| 26 |
+
| AdaLN | 13.04B projection parameters replaced by a 1,025-point timestep curve; one table conversion per block, segment-wise in-place modulation/gating. |
|
| 27 |
+
| Attention projections | One fused QKV matrix and one fused in-place Q/K RMSNorm + partial split-half RoPE kernel per block. |
|
| 28 |
+
| Attention | cuDNN dense attention for short/medium sequences; NVIDIA Sol-Attn Triton routing only above 24,576 packed tokens. |
|
| 29 |
+
| Sol-Attn quality guard | First 10 steps and first 2 blocks stay dense; text, conditioning video and generated audio remain exact KV/query rows. |
|
| 30 |
+
| Step reuse | 28-step Balanced uses NVIDIA H3 FirstBlockCache at `0.08`, with 3 dense warmup and 2 dense tail steps. |
|
| 31 |
+
| Aggressive mode | Ultra Fast keeps its scheduler trajectory but forecasts the joint video/audio residual between bounded exact anchors. |
|
| 32 |
+
| Exact mode | Disables block reuse and sparse attention while retaining the lossless kernel/layout optimizations. |
|
| 33 |
+
| MLP | Fused gate/up checkpoint layout, in-place SiLU×up, native NVFP4 down projection. |
|
| 34 |
+
| Output | Final RMSNorm and video/audio heads run only on retained generated rows; discarded conditioning rows bypass FP32 projection. |
|
| 35 |
+
| Request-static work | Text refinement, RoPE, segment metadata and keyframe patch projections are cached once per request. |
|
| 36 |
+
| Memory traffic | Packed buffers skip redundant zero-fill; cached segment rows avoid repeated CUDA-scalar indexing; hot dispatch lookups are hoisted. |
|
| 37 |
+
| Decode/output | Video and audio VAEs remain full precision; muxing stays outside the denoiser. |
|
| 38 |
+
| Reliability | Automatic retry replaces unhealthy ZeroGPU workers on transient ECC/CUDA initialization failures. |
|
| 39 |
+
|
| 40 |
+
This is inference-work caching, not prompt-to-video result caching: every prompt and seed starts with fresh latents
|
| 41 |
+
and request-local state. On a warm 960×544, 56-frame, 28-step comparison, Balanced reduced 27 full DiT evaluations
|
| 42 |
+
to 20 plus 7 cached block-stack reuses, taking denoise + decode from 35 seconds to 23 seconds (~1.52×).
|
| 43 |
|
| 44 |
The source model is [`MiniMaxAI/MiniMax-H3`](https://huggingface.co/MiniMaxAI/MiniMax-H3). The pruned NVFP4
|
| 45 |
checkpoint is
|
|
|
|
| 146 |
| `H3_CONDITIONER` | `multimodalart/qwen3vl-conditioner` | Prompt-upsampling and local-load fallback service. |
|
| 147 |
| `H3_PLACEMENT` | `lazy` (`nvfp4`) | Move the compact transformer and VAEs on the first GPU call, then keep them resident. |
|
| 148 |
| `H3_ATTENTION` | `_native_cudnn` | Attention backend for both the main stack and text refiner. |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
| `H3_FIRST_BLOCK_THRESHOLD` | `0.08` | Balanced-mode normalized first-block residual threshold, matching NVIDIA's H3 preset. |
|
| 150 |
| `H3_FIRST_BLOCK_DENSE_START` | `3` | Dense warmup steps retained before FirstBlockCache may reuse blocks 2–50. |
|
| 151 |
| `H3_FIRST_BLOCK_DENSE_END` | `2` | Dense tail steps retained after FirstBlockCache reuse is disabled. |
|
|
|
|
| 170 |
No secret is required. All model artifacts are public. Normal requests use one local GPU booking; a prompt-upsampling
|
| 171 |
request forwards the requesting user's ZeroGPU identity to the remote rewriter/conditioner.
|
| 172 |
|
| 173 |
+
## How the optimizations fit together
|
| 174 |
+
|
| 175 |
+
The largest structural win happens before sampling: NVFP4 makes the pruned transformer small enough to stay beside
|
| 176 |
+
the local conditioner and full-precision VAEs on one worker. That removes both per-layer host transfers and the old
|
| 177 |
+
remote conditioning handoff. Fused layouts then reduce launches and wide activation traffic inside every block.
|
| 178 |
+
|
| 179 |
+
Balanced attacks repeated denoising work without reducing the requested 28 scheduler steps. It always evaluates the
|
| 180 |
+
first transformer block, compares that block's residual with the previous exact step, and only reuses the cached
|
| 181 |
+
residual of blocks 2–50 when the official H3 signal is below threshold. Exact keeps this probe disabled. Sol-Attn is
|
| 182 |
+
orthogonal: it sparsifies expensive long-sequence target-video attention, but is gated off wherever cuDNN is faster.
|
| 183 |
+
|
| 184 |
+
Several plausible changes were benchmarked and deliberately not shipped: concurrent VAE decoding, combined AdaLN
|
| 185 |
+
banks, PyTorch 2.13, and always-on Triton AdaLN kernels were slower, unsupported by ZeroGPU, or too expensive at cold
|
| 186 |
+
start. The deployed path favors measured end-to-end latency rather than accumulating optimization flags.
|
| 187 |
+
|
| 188 |
## Attribution
|
| 189 |
|
| 190 |
This is an optimized derivative of the original
|
|
|
|
| 196 |
[`MiniMax-H3 Sol-Engine`](https://github.com/NVlabs/Sana/tree/sol-engine/models/minimax_h3) release. The quantized checkpoint and its conversion notes are from
|
| 197 |
[`lilcheaty/MiniMax-H3-NVFP4`](https://huggingface.co/lilcheaty/MiniMax-H3-NVFP4). MiniMax-H3 weights remain governed
|
| 198 |
by the MiniMax-H3 Community License Agreement.
|
| 199 |
+
|
| 200 |
+
H/t to **blanchon** for pointing me to NVIDIA Sana/Sol-Engine.
|