Skip to content

[FEAT] Add MiniMax H3 joint audio-video generation - #23

Merged
lzx1413 merged 24 commits into
mainfrom
minimax-h3
Aug 5, 2026
Merged

[FEAT] Add MiniMax H3 joint audio-video generation#23
lzx1413 merged 24 commits into
mainfrom
minimax-h3

Conversation

@lzx1413

@lzx1413 lzx1413 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

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 serve entrypoints.

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • Other

Changes Made

  • Added MiniMax H3 DiT, Qwen3-VL text encoder, audio VAE, and video VAE implementations with strict released-checkpoint conversion and explicit BF16/FP32 boundaries.
  • Added canonical T2VA, first/last/first-last FL2VA, and ordered Ref2VA request handling with published material-count and duration validation.
  • Added packed joint video/audio denoising, independent modality schedules, condition noise augmentation, synchronized decoding, and MP4 muxing.
  • Added one-GPU sequential offload plus resident multi-GPU execution using Ulysses SP, DiT TP, text-encoder TP/FSDP2, and TP-based video-VAE tiling.
  • Added the default four-GPU SP2+TP2 DiT, TP4 text encoder, TP4 video VAE, and resident audio VAE profile.
  • Added fused BF16 Triton kernels for indexed modulation, Q/K normalization plus NeoX RoPE, SwiGLU, and Ulysses relayout.
  • Extended public telefuser.ops dispatch with optional tf-kernel acceleration and native PyTorch fallbacks for unsupported devices, dtypes, and compile mode.
  • Added reusable denoising buffers, request-static layouts, optimized scheduler updates, and raw phase, memory, and communication timing metrics.
  • Connected text encoder → DiT, visual VAE encoder → DiT, and DiT → video VAE decoder with WorkerTensorChannel, avoiding parent-process and CPU staging for CUDA intermediates.
  • Added standardized PPL_CONFIG, get_pipeline, run, and run_with_file entrypoints plus manifests for telefuser serve.
  • Added bundled default FL2VA and Ref2VA inputs with provenance metadata.
  • Added SGLang/TeleFuser reference runners, loading probes, trajectory capture, artifact comparison, and stable boundary diagnostics.
  • Added model, pipeline, distributed, ops, tensor-channel, checkpoint-contract, and parity tests.
  • Added support-table entries, example documentation, and a MiniMax H3 integration and validation guide.

Testing

  • Unit tests pass (pytest tests/)
  • Manual testing performed
  • Benchmarks added/updated (if applicable)

Focused automated validation:

  • MiniMax H3 model, pipeline, ops, and tensor-channel suite: 110 passed.
  • T2VA, FL2VA, and Ref2VA request, packed-layout, scheduler, VAE, and pipeline contracts passed.
  • TP/SP/FSDP configuration, checkpoint conversion, dtype preservation, and forward-contract tests passed.
  • Artifact and trajectory comparison regression tests passed.
  • Commit-time ruff and ruff-format hooks passed for the finalized commits.

Manual H100 validation:

  • Frozen official T2VA, FL2VA, and Ref2VA requests using original condition media, seed 0, and release-default 50-step schedules.
  • Pinned SGLang and TeleFuser frames, waveforms, latents, and MP4 outputs.
  • Processor/encoder, condition VAE, initial noise, packed layout, DiT predictions, scheduler outputs, final latents, and decode boundaries.
  • T2VA passed all reference-derived topology checks.
  • FL2VA and Ref2VA passed locked frame and waveform thresholds.
  • Visual, audio, and conditioning results for all three tasks were manually approved.
  • T2VA and FL2VA direct tensor-channel paths completed warmup and measured runs on four H100 GPUs.
  • Standard local and serve entrypoints were manually exercised.

Test commands:

.venv/bin/python -m pytest \
  tests/unit/pipelines/minimax_h3 \
  tests/unit/models/test_minimax_h3_audio_vae.py \
  tests/unit/models/test_minimax_h3_dit.py \
  tests/unit/models/test_minimax_h3_encoder.py \
  tests/unit/models/test_minimax_h3_video_vae.py \
  tests/unit/worker/test_tensor_channel.py -q

ruff check \
  telefuser/models/minimax_h3* \
  telefuser/pipelines/minimax_h3 \
  telefuser/ops \
  telefuser/kernel/triton \
  tools/validation/*minimax_h3* \
  tests/unit/models/test_minimax_h3* \
  tests/unit/pipelines/minimax_h3

ruff format --check \
  telefuser/models/minimax_h3* \
  telefuser/pipelines/minimax_h3 \
  tools/validation/*minimax_h3* \
  tests/unit/models/test_minimax_h3* \
  tests/unit/pipelines/minimax_h3

git diff --check origin/main...HEAD

Checklist

  • Code follows the project's coding standards (ruff)
  • Pre-commit hooks pass (pre-commit run --all-files)
  • All tests pass (pytest tests/)
  • New tests added for new functionality
  • Documentation updated
  • Commit messages are clear and descriptive
  • PR title follows the convention: [TYPE] Brief description

Commit-time hooks passed, but pre-commit run --all-files and the complete repository-wide pytest tests/ suite
were not rerun after the final changes.

Related Issues

N/A

Additional Notes

  • The checkpoint root must contain the original FL2VA and Ref2VA partitions.
  • T2VA uses the FL2VA partition without visual conditions.
  • The integration targets MiniMax H3 Base and does not imply support for hosted Context-IR or Regenerate-2K services.
  • Existing two-step outputs are smoke tests only; production acceptance used the complete 50-step schedule.
  • Generated parity and benchmark artifacts under work_dirs/ are intentionally excluded from Git.
  • No new environment variables, shared service-schema fields, or public framework configuration fields are introduced.
  • Optional tf-kernel acceleration is used only when compatible; public ops retain native fallbacks.
  • Bidirectional DiT/VAE CUDA IPC may emit a PyTorch shutdown warning while worker processes exit; generation completes and GPU memory is released.

GPU Architecture Support

  • SM80 (Ampere, Ada Lovelace)
  • SM90 (Hopper H100)
  • SM100+ (Blackwell)

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:

Backend Measured wall time Peak sampled GPU0 memory
SGLang 79.37 s 67.8 GiB
TeleFuser 79.34 s 62.7 GiB

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 s versus 79.34 s); this difference is measurement noise. The
remaining 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.

lzx1413 added 4 commits August 4, 2026 10:35
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 lzx1413 changed the title [FEAT] Add MiniMax H3 and high-throughput LingBot streaming [FEAT] Add MiniMax H3 joint audio-video generation Aug 4, 2026
@lzx1413
lzx1413 requested a review from Kaimary August 4, 2026 10:39
@lzx1413
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.
@lzx1413 lzx1413 mentioned this pull request Aug 4, 2026
28 tasks
lzx1413 added 19 commits August 4, 2026 13:12
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.
@lzx1413
lzx1413 merged commit a680135 into main Aug 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant