[FEAT] Add MiniMax H3 joint audio-video generation - #23
Merged
Conversation
Port the MiniMax H3 joint audio-video DiT, text encoder, audio VAE, and video VAE components with checkpoint conversion and mixed-precision boundaries. Preserve checkpoint-declared FP32 values across dtype conversion and cover architecture, loading, conversion, and forward contracts with focused model unit tests. Verification: MiniMax H3 CPU suite passed (64 tests, 5 subtests); ruff check and format checks passed.
Implement canonical T2VA, FL2VA, and Ref2VA request planning, material preparation, packed joint denoising, independent audio/video scheduling, VAE processing, and presentation. Add local-checkpoint H100 runners, complete-audio muxing, Ulysses execution support, trajectory capture, and focused CPU plus distributed tests. Verification: MiniMax H3 CPU suite passed (64 tests, 5 subtests); ruff check and format checks passed.
Add reproducible SGLang and TeleFuser reference runners, frozen artifact capture, checkpoint loading validation, block-level probes, and stable trajectory-boundary comparison. Record aggregate and per-frame video metrics plus temporal waveform, spectral, envelope, and lag diagnostics with optional topology-derived acceptance thresholds. Verification: official 50-step T2VA, FL2VA, and Ref2VA reports passed their locked gates; MiniMax H3 CPU suite passed (64 tests, 5 subtests).
Document supported T2VA, FL2VA, and Ref2VA workflows, checkpoint partitions, local H100 runners, request contracts, output handling, limitations, and service compatibility. Add MiniMax H3 to the root supported-pipeline table and documentation index. Verification: documentation links and staged diff were inspected; git diff --cached --check passed.
lzx1413
marked this pull request as ready for review
August 4, 2026 10:39
Mark the MiniMax H3 pipeline test directory as a package so its common test module basenames do not collide with LingBot tests under pytest's default import mode. Verification: CPU CI collection selected 1007 tests without errors; MiniMax H3 CPU unit suite passed 48 tests; ruff check and git diff --check passed.
Expose every FL2VA keyframe mode, ordered JSON requests, configurable aspect and scheduler shifts, and optional FSDP in the H100 examples. Add frozen official FL2VA and Ref2VA inputs with provenance so the examples run without external media URLs. Verification: ruff check and format; 69 focused MiniMax H3 tests plus 5 subtests; all three example --help commands; bundled request admission validation.
Document T2VA and every FL2VA keyframe mode, default and custom Ref2VA inputs, ordered JSON conditions, duration derivation, trimming, aspect and flow controls, and Ulysses/FSDP invocation. Record the supported request limits and unsupported parallel and service surfaces. Verification: example commands checked against current argparse help and bundled request validation.
Track container, video-stream, and audio-stream durations independently. Resolve omitted Ref2VA target duration only from a verified audio stream and reject seeks beyond either the video or soundtrack boundary.\n\nUpdate aggregate reference-duration validation and add regression coverage for silent video, mismatched track lengths, soundtrack seeks, and ffprobe fact projection.\n\nVerified with:\n- .venv/bin/python -m pytest tests/unit/pipelines/minimax_h3/test_data.py tests/unit/pipelines/minimax_h3/test_material_io.py tests/unit/pipelines/minimax_h3/test_pipeline.py -q\n- ruff check on changed files\n- git diff --check
Remove unused batch-extra compatibility keys, quality profiles, component declarations, encoder routing summaries, branch metadata, and derived condition-mask state. Keep canonical validation as the request boundary and make plan resolution a focused data projection.\n\nCentralize task normalization and the canvas multiple while updating tests to assert the material plan consumed at runtime.\n\nVerified with:\n- .venv/bin/python -m pytest tests/unit/pipelines/minimax_h3/test_data.py tests/unit/pipelines/minimax_h3/test_canvas.py tests/unit/pipelines/minimax_h3/test_packed_sequence.py tests/unit/pipelines/minimax_h3/test_pipeline.py -q\n- ruff check on changed files\n- git diff --check
Give video_vae_config and audio_vae_config independent BaseStage ownership instead of rejecting different placements and silently running both models through the video stage configuration.\n\nKeep media preparation with the video stage while separating visual encode/decode from audio encode/decode lifecycles. Update pipeline composition and stage tests without changing the public pipeline configuration fields.\n\nVerified with:\n- .venv/bin/python -m pytest tests/unit/pipelines/minimax_h3/test_vae.py tests/unit/pipelines/minimax_h3/test_pipeline.py -q\n- ruff and ruff-format pre-commit hooks
Hoist static packed metadata and prompt transfers out of the denoising loop, reuse full-sequence work buffers and row-timestep storage, and avoid repeated device-to-host mask copies.\n\nKeep scheduler scalar validation while using the already validated internal tensor math in the hot path, removing repeated full-latent finite reductions and host synchronizations. Remove unused loader compatibility aliases and add a regression assertion that captured initial video and audio states remain populated.\n\nVerified with:\n- .venv/bin/python -m pytest tests/unit/pipelines/minimax_h3/test_scheduler.py tests/unit/pipelines/minimax_h3/test_pipeline.py tests/unit/pipelines/minimax_h3/test_trajectory_comparison.py -q\n- ruff check on changed files\n- git diff --check
Consolidate deterministic file, JSON, and model-config hashing used by the MiniMax H3 capture and comparison tools. This removes six duplicated implementations while preserving their existing private aliases and output formats.\n\nVerification:\n- ruff check on changed validation tools\n- ruff format --check on changed validation tools\n- focused artifact and trajectory comparison tests
Replace mutable attention defaults with explicit optional pack metadata and fail fast when unsupported VAE spatial sharding or parallel tiling is requested. Keeping unsupported modes out of runtime state makes the current execution contract explicit.\n\nVerification:\n- ruff check on changed model files\n- ruff format --check on changed model files\n- MiniMax H3 video VAE unit tests
Synchronize and measure media preparation, text encoding, visual and audio condition encoding, distributed denoising, and both VAE decode phases. Extend the parity runner with load, generation, shutdown, artifact, and total wall times so four-GPU example runs can be compared with SGLang using explicit timing boundaries. Verification: 20 focused pipeline and comparison tests passed; ruff, ruff-format, import, and diff checks passed.
Resolve shared validation helpers through the package namespace when imported and through the script directory when invoked with the documented python tools/validation command. Apply the same dual-entry behavior to the block probe's sibling comparison import. Verification: all six affected scripts completed --help through their direct filesystem entry points; ruff, ruff-format, and diff checks passed.
Expose PPL_CONFIG, get_pipeline, run, and run_with_file across the H3 examples. Add service manifests for FL2VA and Ref2VA, map Ref2VA to the standard s2v task, and move shared helpers into the importable pipeline package for dynamic loading.\n\nAdd example contract coverage and update helper tests for the package-local implementation.\n\nVerification: 79 MiniMax H3 tests passed; ruff and scoped pre-commit passed; real four-GPU FL2VA and Ref2VA serve requests completed successfully.
Document the standardized Python entrypoints, FL2VA and Ref2VA serve commands, request payloads, task mapping, ordered conditions, and supported output-duration range. Verification: scoped pre-commit passed and both documented service paths completed real four-GPU requests.
Add SP+TP resident execution for the DiT, TP text encoding, parallel VAE tiling, and fused Triton/ops paths for MiniMax H3. Reuse request-static layouts and denoising buffers, standardize four-GPU example defaults, and extend focused coverage for the optimized kernels and parallel contracts.\n\nVerification:\n- ruff check on changed MiniMax H3 and ops modules\n- 97 MiniMax H3 unit tests passed\n- four-H100 warmup and 50-step measured benchmark completed
Connect the parallel text encoder, visual VAE encoder, DiT, and video VAE decoder with WorkerTensorChannel so intermediate CUDA tensors no longer stage through the parent process or CPU. Preserve the existing direct-stage contracts, keep parent-consumed metadata separate, and close consumers before producer channels where possible.\n\nVerification:\n- ruff check and ruff format on changed files\n- 110 MiniMax H3 and tensor-channel unit tests passed\n- T2VA and FL2VA four-H100 warmup plus measured smoke runs passed\n- 50-step four-H100 measured benchmark completed in 79.34 seconds
Move the current MiniMax H3 usage, serving, multi-GPU, optimization, and benchmark guidance into the example README. Add H3 support and service news to both root READMEs, include H3 in the Chinese support table, and remove the duplicate dedicated docs page.\n\nVerification:\n- git diff --check\n- MiniMax H3 example and pipeline contract tests: 23 passed
Keep text hidden states on the direct CUDA IPC path while routing token tag control metadata through the CPU transport path. Validate packed modality tags before constructing AdaLN indices so corrupted metadata fails with a clear contract error instead of causing an illegal kernel access. Verification: 122 MiniMax H3 and example-runner tests passed; four-H100 two-step SDPA generation passed.
Register a deterministic 768p five-second T2VA workload using four GPUs, 50 denoising steps, and the repository SDPA regression policy. Extend the example runner to forward duration and consume standard file entrypoints so joint audio-video MP4 outputs remain intact for baseline validation. Document baseline creation and comparison workflows in English and Chinese testing guides and the MiniMax H3 example README. Verification: 122 tests passed; four-H100 baseline generation completed in 307.1 seconds; comparison passed with PSNR infinity and SSIM 1.0000; both MP4 artifacts contain H.264 video and AAC 32 kHz audio.
Validate indexed modulation tensor metadata and parameter row compatibility before dispatch. Mask out-of-range Triton indices so malformed packed layouts cannot trigger illegal device memory reads. Add CPU contract coverage and CUDA tests for out-of-range indices and row-strided parameters.
Cover the FL2VA and Ref2VA service contracts in the shared example parity suite. Require the four-GPU T2VA regression to validate audio stream metadata, duration, and decoded waveform similarity in addition to video frames. Document combined SP and TP support and the new audio regression controls in English and Chinese. Verified with 1368 unit tests and a four-H100 50-step generation matching the accepted baseline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds production-quality MiniMax H3 joint audio-video generation to TeleFuser.
It integrates the released MiniMax H3 DiT, Qwen3-VL text encoder, audio VAE, and video VAE components and supports
T2VA, FL2VA, and Ref2VA from the original local checkpoint partitions. The pipeline produces 24 FPS video with
synchronized 32 kHz stereo audio and supports local Python execution and standard
telefuser serveentrypoints.The PR also adds resident four-GPU inference using DiT SP2+TP2, text-encoder TP4, parallel video-VAE tiling,
optimized Triton/public-ops paths, and direct CUDA tensor handoff between independently spawned worker groups.
Motivation
TeleFuser did not previously support MiniMax H3 or its joint audio-video task contracts.
A faithful integration requires more than loading checkpoints. Processor behavior, ordered heterogeneous
conditioning, packed joint token layout, independent video/audio schedulers, mixed-precision boundaries, VAE
decoding, and final audio-video muxing must remain aligned with the released implementation.
Full 50-step validation also exposed precision-sensitive parameters that must remain FP32 during checkpoint loading.
The integration preserves those values and validates intermediate and final generation boundaries against pinned
SGLang references.
For production multi-GPU use, the initial replicated/offloaded path also left substantial performance on the table.
This PR therefore adds resident TP/SP execution, fused kernels, reusable request-static buffers, parallel VAE tiling,
and worker-to-worker CUDA tensor transport.
Type of Change
Changes Made
telefuser.opsdispatch with optionaltf-kernelacceleration and native PyTorch fallbacks for unsupported devices, dtypes, and compile mode.WorkerTensorChannel, avoiding parent-process and CPU staging for CUDA intermediates.PPL_CONFIG,get_pipeline,run, andrun_with_fileentrypoints plus manifests fortelefuser serve.Testing
pytest tests/)Focused automated validation:
ruffandruff-formathooks passed for the finalized commits.Manual H100 validation:
Test commands:
Checklist
ruff)pre-commit run --all-files)pytest tests/)[TYPE] Brief descriptionCommit-time hooks passed, but
pre-commit run --all-filesand the complete repository-widepytest tests/suitewere not rerun after the final changes.
Related Issues
N/A
Additional Notes
FL2VAandRef2VApartitions.work_dirs/are intentionally excluded from Git.tf-kernelacceleration is used only when compatible; public ops retain native fallbacks.GPU Architecture Support
The new fused Triton and resident distributed paths were validated end to end on H100. Native fallbacks exist for
unsupported kernel conditions, but SM80 and SM100+ were not validated as part of this PR.
Performance Impact
This PR adds resident and fused performance paths while preserving correctness and SGLang alignment.
On the frozen 768p, five-second, 50-step T2VA request using four H100 GPUs and matched SP2+TP2 topology:
TeleFuser reached practical runtime parity with the pinned local SGLang build while using approximately 7.6% less
sampled peak memory on GPU0 in this run. The TeleFuser DiT denoising phase took 76.41 seconds, including 4.12 seconds
of recorded SP/TP communication.
The final worker tensor-channel change removes parent/CPU staging but did not materially change wall time versus the
immediately preceding TeleFuser result (
79.25 sversus79.34 s); this difference is measurement noise. Theremaining runtime is dominated by DiT computation and per-layer TP/SP collectives.
These measurements are specific to the frozen request, local checkpoints, dependency versions, four-H100 topology,
and warm resident profile. They are not general performance guarantees.