MiniMax-H3 ncnn Vulkan
:exclamation: :exclamation: :exclamation: More features and optimizations in progress
ncnn implementation of MiniMax-H3 for video and stereo audio generation from text, keyframes or multimodal references.
h3-ncnn-vulkan uses ncnn project as the universal neural network inference framework.
Features
|
|
minimax-h3 text-to-video 832x480, 124 frames, 14GiB RAM budget
| dit transformer 2nd step(s/it) less is better | RX9060XT | RTX3060 |
|---|---|---|
| stable-diffusion.cpp (vulkan) 20261127 | 83.81 | 375.59 |
| h3-ncnn-vulkan 20261201 | 51.15 | 101.46 |
minimax-h3 FL2VA 832x480, 56 frames, 14GiB RAM budget
| dit transformer step(s/it) less is better | RX9060XT |
|---|---|
| stable-diffusion.cpp (vulkan) 20261127 | 46.19 |
| h3-ncnn-vulkan 20261201 rough-mode 0 | 25.50 |
| h3-ncnn-vulkan 20261201 rough-mode 1 | 23.54 |
| h3-ncnn-vulkan 20261201 rough-mode 2 | 22.53 |
| h3-ncnn-vulkan 20261201 rough-mode 3 | 19.43 |
Download
Download the Linux x86-64 (glibc 2.28 or newer), macOS universal (Apple silicon and Intel), or Windows x86-64 ZIP from GitHub Releases. For a local build, see Build from Source.
The release workflow builds all three packages from source and collects them in a draft release. Release workflow
prepare model files
Place the downloaded models/ directory next to h3-ncnn-vulkan (h3-ncnn-vulkan.exe on Windows). Run the examples from the package root. To use the command as written, add the package root to your PATH in the current shell:
- Linux and macOS:
export PATH="$PWD:$PATH" - Windows (PowerShell):
$env:Path = "$PWD;$env:Path"
The default model path is models/h3. Set -m to use a different model directory.
h3-ncnn-vulkan
models/
h3/
LICENSE
NOTICE
processor/
text_encoder/
vae/
audio_vae/
transformer/
Download the files for text-to-video-and-audio (T2VA) from the package root. The default 50-point schedule uses the prepared BF16 modulation bank. This set takes about 128 GB. h3 model folder(huggingface) or h3 model folder(modelscope)
hf download nihui-szyl/h3-ncnn --local-dir models \
--include 'h3/LICENSE' \
--include 'h3/NOTICE' \
--include 'h3/processor/*' \
--include 'h3/text_encoder/*' \
--include 'h3/vae/decoder.ncnn.*' \
--include 'h3/audio_vae/decoder.ncnn.*' \
--include 'h3/transformer/fl2va/transformer-core.ncnn.*' \
--include 'h3/transformer/fl2va/fixed-build/modulations.ncnn.*' \
--include 'h3/transformer/fl2va/fixed-modulations-bf16-steps50-none.bin'Keep the fixed-build files. The runtime uses them to validate the prepared bank and to compute modulations for other schedules. The first generation example uses this download.
Additional model files for FL2VA, Ref2VA and LoRA
For FL2VA with one or two image keyframes, add the vision encoder, spatial VAE encoder and video bank. This adds about 2.9 GB to the T2VA download.
hf download nihui-szyl/h3-ncnn --local-dir models \
--include 'h3/vision/*' \
--include 'h3/vae/encoder_spatial.ncnn.*' \
--include 'h3/transformer/fl2va/fixed-modulations-bf16-steps50-video.bin'For the Ref2VA example with an image and audio, add the Ref2VA core, producer and matching bank alongside the encoders. This adds about 70 GB to the T2VA download.
hf download nihui-szyl/h3-ncnn --local-dir models \
--include 'h3/vision/*' \
--include 'h3/vae/encoder_spatial.ncnn.*' \
--include 'h3/audio_vae/encoder.ncnn.*' \
--include 'h3/transformer/ref2va/transformer-core.ncnn.*' \
--include 'h3/transformer/ref2va/fixed-build/modulations.ncnn.*' \
--include 'h3/transformer/ref2va/fixed-modulations-bf16-steps50-both.bin'Use the bank that matches your references as described under Modulation cache. An audio reference needs audio_vae/encoder.ncnn.*. A video reference needs vae/encoder_temporal.ncnn.*.
pi-H3 also needs the shared transformer/pi-h3.safetensors. The optional two- and four-forward banks in transformer/fl2va/ cover text-only and keyframe inputs. The LoRA adapters themselves are available from their publishers. LoRA
The complete model folder takes about 206 GB.
hf download nihui-szyl/h3-ncnn --local-dir models --include 'h3/*'About MiniMax-H3
MiniMax-H3 generates video and audio together. This implementation supports text to video and audio (T2VA), first and last frames to video and audio (FL2VA), and image, video or audio references (Ref2VA).
T2VA and FL2VA share the DiT in transformer/fl2va/. Ref2VA uses transformer/ref2va/.
Usages
requirements
- A Vulkan-capable GPU and driver.
- Disk space for the model files used by the selected workflow.
- Additional disk space for streamed weights. Set
H3_WEIGHT_TMPDIRto a disk-backed directory with tens of GiB free when paging. - RAM and VRAM for the requested resolution, frame count, prompt and references.
The table gives estimated planning budgets with disk weight streaming, rounded up to the next multiple of 128 MiB.
| Output resolution | Frames | Duration | RAM budget (MiB) | VRAM budget (MiB) |
|---|---|---|---|---|
| 640 × 352 | 56 | 2.33 s | 1408 | 1408 |
| 640 × 352 | 124 | 5.17 s | 1408 | 2304 |
| 640 × 352 | 243 | 10.13 s | 1408 | 3712 |
| 832 × 480 | 56 | 2.33 s | 1408 | 2048 |
| 832 × 480 | 124 | 5.17 s | 1408 | 3584 |
| 832 × 480 | 243 | 10.13 s | 1408 | 5760 |
| 1024 × 1024 | 124 | 5.17 s | 1664 | 7424 |
| 1280 × 736 | 56 | 2.33 s | 1664 | 3584 |
| 1280 × 736 | 124 | 5.17 s | 1664 | 6784 |
| 1280 × 736 | 243 | 10.13 s | 1664 | 12416 |
| 1920 × 1088 | 56 | 2.33 s | 3072 | 6784 |
| 1920 × 1088 | 124 | 5.17 s | 3200 | 13952 |
| 1920 × 1088 | 243 | 10.13 s | 3200 | 26496 |
| 640 × 352 | 489 (joined) | 20.38 s | 1536 | 3072 |
| 1280 × 736 | 489 (joined) | 20.38 s | 1792 | 9984 |
The estimates use the prompt in the memory example below, 24 fps, the default 50 scheduler points, a portable BF16 modulation bank, rough mode 0 and WebM output. Single-segment rows use T2VA. Joined rows use FL2VA with four image keyframes and segments of 158, 158 and 175 frames.
The DiT fuses the gate and up projections in each feed-forward block. The planner selects how many token rows to process at once and which paged weights to keep between tiles. AdaLN processes up to 1024 token rows at a time. Attention processes up to 1024 query rows at a time. Each row attends to all keys and values. For long sequences, packed heads are unpacked in groups of up to eight. On devices using the standard attention kernel, the tile size adapts to the key sequence length to keep the score buffer within a 128 MiB target.
The planner uses the ncnn graph, tensor sizes and allocation lifetimes on the selected Vulkan device, including DiT tiles, video VAE tiles and the modulation producer when a bank needs baking. The OS and Vulkan driver need additional capacity. With the bundled ncnn revision, mapped weight pages can stay resident during disk paging, so process RAM can exceed the planning budget.
Example Command
Text to video and audio
h3-ncnn-vulkan -p "A red ceramic teapot slowly rotates on a pale oak table in daylight." \
-s 384,256 -f 56 -o teapot.webmFirst and last frames to video and audio
h3-ncnn-vulkan -t fl2va -i first.png -i last.png \
-p "The red ceramic teapot slowly turns cobalt blue." \
-s 384,256 -f 124 -o keyframes.webmGenerate a longer video with intermediate keyframes
h3-ncnn-vulkan -t fl2va -i A.png -i B.png -i C.png -i D.png \
-f 73 -f 90 -f 107 \
-p "The teapot turns to the left." \
-p "The teapot continues turning as it moves closer." \
-p "The teapot completes the turn in close-up." -o joined.webmPass one frame count per pair of adjacent keyframes. Use one shared prompt or one prompt per segment. The writer counts each shared boundary once, so this example produces 268 frames. All segments share one canvas and optional audio reference. Each model is loaded once per stage, and adjacent segments reuse their shared keyframe encodings.
Multimodal references
h3-ncnn-vulkan -t ref2va -i teapot.png --reference-audio tone.wav \
-p "Using <Picture 1> as the reference, show the teapot rotating slowly. Use <Audio 1> as the sound reference." \
--reference-short-edge 512 -s 384,256 -f 124 -o reference.webmSet size, frame count, scheduler steps, seed and GPU
h3-ncnn-vulkan -s 640,352 -f 124 -l 50 -r 2026 -g 0 \
-p "A red ceramic teapot rotates on a table." -o teapot.webmEstimate memory with explicit budgets, in MiB
h3-ncnn-vulkan --estimate-memory --ram-budget 16384 --vram-budget 32768 \
-p "A red ceramic teapot rotates on a table." -s 1280,736 -f 124 -o teapot.webmGenerate with the same parameters
h3-ncnn-vulkan --ram-budget 16384 --vram-budget 32768 \
-p "A red ceramic teapot rotates on a table." -s 1280,736 -f 124 -o teapot.webmA budget of 0 uses the available capacity automatically. Larger budgets keep more weights resident and improve throughput. The estimate reports the selected stage peaks and the overall requirements with disk paging or resident weights. For joined FL2VA, it includes intermediate results held across segments.
Optional rough K/V reuse
h3-ncnn-vulkan -t fl2va -i first.png --rough-mode 2 \
-p "The red ceramic teapot slowly turns cobalt blue." \
-s 384,256 -f 124 -o rough.webmRough modes reuse K/V and can change movement and sound. Active rows attend to the full K/V sequence. --kv-cache-mib caps the cache for the clip at 6144 MiB by default.
| Mode | Cached K/V rows | Refresh forwards |
|---|---|---|
| 0 | None | Every forward |
| 1 | Text | 1, 3, 5, … |
| 2 | Text and references | 1, 3, 5, … |
| 3 | Text and references | First forward only |
LoRA
Load an adapter with --lora. Repeat the option to combine adapters and give --lora-scale values in the same order. Unspecified strengths default to 1. Merged adapters combine updates in FP32 during loading. Pika Flex Turbo evaluates its low-rank projections in Vulkan.
h3-ncnn-vulkan -t fl2va -i teapot.png -i teapot.png \
-p "A smooth full orbit around the stationary teapot." \
-s 640,352 -f 73 -l 29 \
--lora minimax_h3_flf2v_lora_v1.safetensors -o orbit.webmCombine Orbit with pi-H3 in the same run. pi-H3 sets the sampling schedule.
h3-ncnn-vulkan -t fl2va -i subject.png -i subject.png \
-p "A smooth 360 degree camera orbit around the stationary subject." \
-s 384,384 -f 124 -l 3 \
--lora minimax_h3_flf2v_lora_v1.safetensors \
--lora pi_h3_2step_adapter/diffusion_pytorch_model.safetensors -o orbit-pi.webmSupported adapters and sampling presets
Use pi-H3 for a text-only generation
h3-ncnn-vulkan -p "A red ceramic teapot with steam rising in daylight." \
-s 384,256 -f 73 \
--lora pi_h3_4step_adapter/diffusion_pytorch_model.safetensors -o pi-h3.webm| Adapter | Workflow | Sampling |
|---|---|---|
| 360 Orbit | FL2VA | Set -l 29 for 28 DiT forwards. Use the same reference for both keyframes. |
| Character Swap V1 / V1.5, Fight Flow V1 / V2 | Ref2VA | H3 schedule. For Character Swap, pass the source clip with --reference-video and the new character with -i. |
| Sentinel7 Extreme Realism | FL2VA | H3 schedule. Includes audio input and output projections. |
| Larry H3 Turbo | T2VA / FL2VA | Dual-clock Euler. V4 defaults to 6 DiT forwards. Earlier 4-step weights default to 4. |
| Pika H3 Flex Turbo | Match the FL2VA or Ref2VA filename | Simple Euler with the file's 2, 4 or 8 forward preset. FL2VA uses video shift 6. |
| pi-H3 2-step / 4-step VAE adapters | T2VA / FL2VA fixed build | pi-H3 Euler with 2 or 4 DiT forwards and strength 1. |
Keep the original Pika filename and pi-H3 folder name to select their presets automatically. The pi-H3 VAE adapters use the existing video VAE. The DWD checkpoints require a separate pixel refiner.
Adapter and sampler references are available from the publishers. Orbit, Character Swap, Fight Flow, Larry Turbo, Pika Flex Turbo, pi-H3, Extreme Realism
Modulation cache
The model download includes portable BF16 modulation banks for the default -l 50. Filenames end in none, video, audio or both, according to the input references. The optional pi-H3 banks in transformer/fl2va/ cover text-only generation and FL2VA with one or both keyframes, at -l 3 and -l 5.
Matching banks can be copied between machines. The loader checks model fingerprints, sampling preset and reference modalities. Requests without a matching bank use the modulation producer and cache the result under fixed-build/banks/.
Precompute a bank for another schedule
Use --bake-modulations to precompute a portable bank for a base H3 schedule or supported pi-H3 preset. Specify the workflow and reference type.
h3-ncnn-vulkan -t fl2va -l 17 --bake-modulations video
h3-ncnn-vulkan -t ref2va -l 17 --bake-modulations both
h3-ncnn-vulkan -t fl2va --lora pi_h3_2step_adapter/diffusion_pytorch_model.safetensors --bake-modulations videoFull Usages
Usage: h3-ncnn-vulkan [options]
-h show this help
-p TEXT prompt (one for the video or one per FL2VA segment)
-o PATH lossy .webm or lossless .mkv (default: output.webm)
-i PATH FL2VA keyframe or Ref2VA image reference (repeat in order)
-s WIDTH,HEIGHT output dimensions, multiples of 32
-f N frames at 24 fps, rounded up (repeat per FL2VA segment)
-l N scheduler points, including zero (default: 50 or adapter preset)
-r N sampling seed (default: 42)
-m DIR ncnn model directory (default: models/h3)
-g N Vulkan device index (default: automatic)
-t TYPE t2va, fl2va, ref2va (default: t2va)
--last-image PATH optional final FL2VA keyframe
--reference-video PATH WebM/MKV video reference, including its audio stream
--reference-audio PATH WAV or WebM/MKV audio reference for fl2va or ref2va
--reference-short-edge N ref2va image short edge (default: 2048)
--reference-video-short-edge N ref2va video short edge (default: 768)
--lora PATH H3 LoRA .safetensors file (repeat to combine)
--lora-scale VALUE adapter strengths in --lora order (default: 1)
--bake-modulations TYPE build a bank only: none, video, audio, both
--rough-mode 0|1|2|3 exact, alternate text, alternate full, freeze full (default: 0)
--kv-cache-mib N Vulkan K/V cache ceiling (default: 6144)
--ram-budget MiB process RAM budget (0=auto, default)
--vram-budget MiB Vulkan memory budget (0=auto, default)
--estimate-memory calculate the memory plan without running inference- Use
-s WIDTH,HEIGHTto set the output dimensions. Each side is a multiple of 32 from 32 to 4096 pixels. The default is 124 frames at 24 fps. The VAE rounds the frame count up to17 * n + 5, with supported output lengths of 22 to 345 frames per segment. -lcounts scheduler points including the final zero. The default 50 points run 49 DiT forwards, and 17 points run 16.- FL2VA accepts either keyframe or both. It also accepts one experimental
--reference-audiowith or without keyframes. Refer to it as<Audio 1>in the prompt. Speaker similarity can vary. - Ref2VA accepts up to 9 images, 3 videos and 3 audio files. Pass references in prompt order. Number
<Picture i>,<Video i>and<Audio i>independently from 1. Audio embedded in a reference video receives its own audio label. - Images can be PNG, JPEG or WebP. Reference videos can be WebM or MKV with VP8/VP9 and optional Opus or PCM. Audio references can be mono/stereo PCM WAV or Opus/PCM tracks in WebM or MKV.
- The output filename extension selects the encoding.
| Extension | Video | Stereo audio |
|---|---|---|
.webm | VP9 4:2:0 | Opus, 48 kHz |
.mkv | Lossless VP9 RGB 4:4:4 | FP32 PCM, 32 kHz |
Build from Source
- Initialize the submodules in the source checkout.
git submodule update --init --recursive --depth 1- Build and install with CMake.
cmake -S src -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel 8
cmake --install build --prefix "$PWD/build/package"The standard CMake install puts the executable in build/package/bin/. The release ZIPs instead put it at the package root.
The build requires a C/C++ compiler, CMake, Git, Ninja, Make, NASM, diffutils, Perl and Vulkan development headers. CMake builds ncnn and the static media libraries from the pinned submodules under src/. RTTI and C++ exceptions are disabled by default (NCNN_DISABLE_RTTI=ON, NCNN_DISABLE_EXCEPTION=ON).
On Windows, use MSYS2 UCRT64 with GCC, CMake, Ninja, Make, NASM, diffutils and Perl for the bundled build. On macOS, pass -DVulkan_LIBRARY=/path/to/libMoltenVK.a to link MoltenVK.
Use -DUSE_SYSTEM_NCNN=ON for an installed ncnn with Vulkan and batch support. Select system image libraries with USE_SYSTEM_JPEG, USE_SYSTEM_PNG, USE_SYSTEM_WEBP or USE_SYSTEM_ZLIB. System PNG uses system zlib. For prebuilt static codecs, set H3_MEDIA_PREFIX to the installation prefix.
Sample Videos
The examples below use this project's Vulkan pipeline, the base MiniMax H3 model, and the 50-point BF16 modulation banks. Each video runs at 24 fps and includes its generated stereo audio. Expand a command to see the full prompt, output size and seed.
Copy the videos directory to the package root to run the examples with reference inputs.
Text to video and audio
Tram Arrives in the Rain · 1280 × 736 · 192 frames · 8 s
expand for full prompt and command
h3-ncnn-vulkan \
-s 1280,736 -f 192 -l 50 -r 42 --rough-mode 0 \
-p "integrated_multimodal_description: [Shot 1] A cinematic night street in light rain, viewed from beside a quiet tram stop at pavement height. A cream-and-teal vintage tram enters slowly from the left, its warm windows reflected in the puddles. It rings one clear bell as it passes the foreground streetlamp and eases toward the stop. [Shot 2] At 00:04.000 the camera cuts to a close-up of the near wheel and its reflection. The wheel rolls steadily for a moment, then comes to a complete stop as the brakes hiss. Droplets continue falling into the puddle as the camera holds.
overall_soundscape: Steady light rain and a low rail rumble. One distinct bell as the tram passes the streetlamp, then a brief brake hiss timed to the wheel stopping. The rumble fades and the rain remains.
non_diegetic_music: None." -o rain-tram.webmhttps://github.com/user-attachments/assets/a9362e39-453b-45b9-8243-6b884a483cb4
First and last frames to video and audio
A Little Victory · 768 × 768 · 124 frames · 5.17 s
expand for full prompt and command | |||
First frame![]() | Last frame![]() | ➡️ |
https://github.com/user-attachments/assets/f9229f79-cd16-47dd-88cd-cf80d8246b92 |
Multimodal references to video and audio
Felt Robot Plays the Xylophone · 1280 × 736 · 158 frames · 6.58 s
expand for full prompt and commandUse the Ref2VA model files and add the temporal video encoder ( | |||
Picture 1 · robot appearance![]() | Video 1 · mallet motion![]() Audio 1 · wooden notes | ➡️ |
https://github.com/user-attachments/assets/5950956e-59ef-42be-b67b-ae1ac27bd604 |
Original MiniMax-H3 Project
Other Open-Source Code Used
- Neural network inference and Vulkan shader compilation. ncnn, glslang
- Image decoders, encoder layout and BPE tokenizer. h3image-ncnn-vulkan, qwenimage-ncnn-vulkan
- Image codecs. libjpeg-turbo, libpng, libwebp, zlib-ng
- Video and audio codecs and containers. libvpx, libopus, libwebm
The standalone package includes third-party license notices.
License
Source code is licensed under Apache-2.0. Project license
The checkpoint and converted weights are subject to the terms for access, use and redistribution in the MiniMax H3 Community License. Model license



