minimax_h3_pipeline ¶
End-to-end MiniMax-H3 joint audio-video generation on Apple Silicon MLX.
Phased runtime that keeps one heavyweight component resident at a time:
- Condition — streamed Qwen3-VL text encoding (or a verified prompt embedding cache);
- Denoise — pre-quantized H3 DiT (one of int8/int6/int4 resident), dual rectified-flow schedulers (video shift 12 / audio shift 3), served from the persisted AdaLN ladder;
- Decode — MLX H3 video VAE and audio VAE, sequentially;
- Mux — H.264 24 fps + AAC 32 kHz stereo MP4 via ffmpeg.
MLX-native memory cleanup (mx.clear_cache) runs between every phase. The MLX path itself does not call PyTorch.
Classes¶
fastvideo.mlx_runtime.minimax_h3_pipeline.FastSpatialPlan dataclass ¶
FastSpatialPlan(target_height: int, target_width: int, stage1_height: int, stage1_width: int, canvas_height: int, canvas_width: int, scale: int, upsample_mode: str, sharpen: float)
Reduced-canvas geometry for spatial fast mode (RIFE's spatial twin).
fastvideo.mlx_runtime.minimax_h3_pipeline.FastTemporalPlan dataclass ¶
Sparse video geometry for RIFE fast mode with full-duration audio.
fastvideo.mlx_runtime.minimax_h3_pipeline.MiniMaxH3MLXPipeline ¶
MiniMaxH3MLXPipeline(*, model_root: str | Path, mlx_dit_checkpoint: str | Path, vae_dtype: str = 'fp32', prompt_cache_dir: str | Path | None = None, conditioner_dir: str | Path | None = None, tokenizer_dir: str | Path | None = None, metal_wired_limit_gib: float | None = None, video_decode_backend: str = 'h3-vae', taeh3_checkpoint: str | Path | None = None, taeh3_chunk_size: int = 5)
Text-to-video-with-audio generation through the native MLX runtime.
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
Methods:¶
fastvideo.mlx_runtime.minimax_h3_pipeline.MiniMaxH3MLXPipeline.decode_audio ¶
decode_audio(audio_rows: ndarray, *, num_frames: int) -> ndarray
Normalized packed audio rows -> stereo waveform (2, S) fp32 in [-1, 1].
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
fastvideo.mlx_runtime.minimax_h3_pipeline.MiniMaxH3MLXPipeline.decode_video ¶
decode_video(video_rows: ndarray, *, height: int, width: int, num_frames: int, tiled: bool = True) -> ndarray
Normalized packed rows -> (T, H, W, 3) uint8 frames.
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
fastvideo.mlx_runtime.minimax_h3_pipeline.MiniMaxH3MLXPipeline.denoise ¶
denoise(text_rows: ndarray, token_tags: ndarray, *, height: int, width: int, num_frames: int, audio_num_frames: int | None = None, video_temporal_scale: float = 1.0, seed: int, num_steps: int = 4, dit: Any | None = None, vsa_config: MiniMaxH3VSAConfig | None = None) -> tuple[ndarray, ndarray]
Denoise joint latents; returns (normalized video rows, audio rows).
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
fastvideo.mlx_runtime.minimax_h3_pipeline.MiniMaxH3MLXPipeline.encode_prompt ¶
Returns (hidden states (S, hidden), token tags). Uses the cache or the streamed conditioner.
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
fastvideo.mlx_runtime.minimax_h3_pipeline.MiniMaxH3MLXPipeline.mux ¶
mux(frames: ndarray, waveform: ndarray, output_path: str | Path, fps: int = MINIMAX_H3_FPS, sample_rate: int = 32000) -> Path
H.264 video + AAC stereo audio, A/V durations within one frame.
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
fastvideo.mlx_runtime.minimax_h3_pipeline.MiniMaxH3MLXPipeline.resolve_geometry staticmethod ¶
resolve_geometry(height: int, width: int, num_frames: int, *, enforce_duration: bool = True) -> dict[str, int]
Explicit canvases pass through (positive multiples of 32); the aspect-ratio resolver only applies when dimensions are omitted.
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
Functions:¶
fastvideo.mlx_runtime.minimax_h3_pipeline.plan_fast_spatial ¶
plan_fast_spatial(height: int, width: int, *, scale: int = 2, upsample_mode: str = DEFAULT_PIXEL_UPSAMPLE_MODE, sharpen: float = DEFAULT_FAST_SPATIAL_SHARPEN) -> FastSpatialPlan
Choose the smallest H3-valid canvas that covers target / scale.
H3 geometry rounds up to the 32px model grid and center-crops after decode — the same convention plain 720p generation uses via _model_canvas_size — so no size the full-resolution path accepts is rejected here. The return trip to the target size runs in pixel space after the VAE decode, never on latents; see :mod:fastvideo.mlx_runtime.frame_upsample for why.
Source code in fastvideo/mlx_runtime/minimax_h3_pipeline.py
fastvideo.mlx_runtime.minimax_h3_pipeline.plan_fast_temporal ¶
plan_fast_temporal(target_frames: int, factor: int = 2) -> FastTemporalPlan
Choose the smallest H3-valid source sequence that covers the target timeline.