minimax_h3 ¶
FastVideo-native MiniMax H3 joint audio-video diffusion transformer.
Classes¶
fastvideo.models.dits.minimax_h3.MiniMaxH3AdaLayerNormModulation ¶
MiniMaxH3AdaLayerNormModulation(time_embed_dim: int, hidden_size: int, quant_config: QuantizationConfig | None = None, prefix: str = '', apply_silu: bool = True)
Bases: Module
Produce six modulation tables for every (timestep, modality) pair.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3AdaLayerNormOut ¶
MiniMaxH3AdaLayerNormOut(hidden_size: int, time_embed_dim: int, eps: float, quant_config: QuantizationConfig | None = None, prefix: str = '', apply_silu: bool = True)
Bases: Module
Final RMSNorm with per-timestep row modulation.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3Attention ¶
MiniMaxH3Attention(hidden_size: int, num_attention_heads: int, attention_head_dim: int, qk_norm_eps: float, supported_attention_backends: tuple[AttentionBackendEnum, ...], quant_config: QuantizationConfig | None, prefix: str, fuse_qknorm_rope: bool = False, fa4_packed_varlen: bool = False)
Bases: Module
Full self-attention over one sequence-parallel packed document.
Source code in fastvideo/models/dits/minimax_h3.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
fastvideo.models.dits.minimax_h3.MiniMaxH3FeedForward ¶
MiniMaxH3FeedForward(hidden_size: int, ffn_dim: int, quant_config: QuantizationConfig | None = None, prefix: str = '', fuse_swiglu: bool = False)
Bases: Module
Bias-free H3 SwiGLU with value-first packed halves.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3RotaryPosEmbed ¶
Bases: Module
Three-axis rotary frequencies over packed (t, h, w) coordinates.
Source code in fastvideo/models/dits/minimax_h3.py
Methods:¶
fastvideo.models.dits.minimax_h3.MiniMaxH3RotaryPosEmbed.forward ¶
forward(position_ids: Tensor) -> tuple[Tensor, Tensor]
Build rotary tensors on the device that owns the packed positions.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3TokenRefiner ¶
MiniMaxH3TokenRefiner(hidden_size: int, num_attention_heads: int, attention_head_dim: int, ffn_dim: int, num_layers: int, norm_eps: float, qk_norm_eps: float, final_norm_eps: float, supported_attention_backends: tuple[AttentionBackendEnum, ...], quant_config: QuantizationConfig | None, prefix: str)
Bases: Module
Two-block text refiner used before packing the modalities.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3TokenRefinerBlock ¶
MiniMaxH3TokenRefinerBlock(hidden_size: int, num_attention_heads: int, attention_head_dim: int, ffn_dim: int, norm_eps: float, qk_norm_eps: float, supported_attention_backends: tuple[AttentionBackendEnum, ...], quant_config: QuantizationConfig | None, prefix: str)
Bases: Module
Plain pre-norm Transformer block for the projected text stream.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3Transformer3DModel ¶
MiniMaxH3Transformer3DModel(config: MiniMaxH3Config, hf_config: dict[str, Any])
Bases: BaseDiT
Joint H3 Transformer over one padless text/audio/video document.
The layout builder validates semantic rows before denoising. Sequence- parallel padding is transport-only and DistributedAttention trims it before attention.
Source code in fastvideo/models/dits/minimax_h3.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | |
Methods:¶
fastvideo.models.dits.minimax_h3.MiniMaxH3Transformer3DModel.forward ¶
forward(hidden_states: Tensor, audio_hidden_states: Tensor, encoder_hidden_states: Tensor, timestep: Tensor, timestep_indices: Tensor, token_tags: Tensor, position_ids: Tensor, video_indices: Tensor, audio_indices: Tensor, text_indices: Tensor) -> tuple[Tensor, Tensor]
Predict video and audio velocities from one caller-defined packed layout.
Source code in fastvideo/models/dits/minimax_h3.py
857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 | |
fastvideo.models.dits.minimax_h3.MiniMaxH3Transformer3DModel.materialize_non_persistent_buffers ¶
Rebuild analytic RoPE state on the checkpoint loader device.
RoPE frequencies are absent from the checkpoint, so meta-device model construction and device moves must derive the buffer from architecture fields before the first forward pass.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3Transformer3DModel.prepare_for_compile ¶
Pipeline hook, called once right before torch.compile wraps the blocks.
Resolve each loaded VSA compression gate eagerly. Generic and training compile retain their established attention dispatch; only the inference loader's separate prepare_for_regional_compile hook may preselect the inference-only sm_100a path.
The inference-only Triton fusions expose fake-backed custom operators, so Dynamo can keep them active as opaque nodes inside each fullgraph block instead of tracing into their launcher implementation.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3Transformer3DModel.prepare_for_regional_compile ¶
prepare_for_regional_compile() -> str | None
Resolve state used only by inference regional fullgraph compile.
Source code in fastvideo/models/dits/minimax_h3.py
fastvideo.models.dits.minimax_h3.MiniMaxH3TransformerBlock ¶
MiniMaxH3TransformerBlock(hidden_size: int, num_attention_heads: int, attention_head_dim: int, ffn_dim: int, time_embed_dim: int, norm_eps: float, qk_norm_eps: float, supported_attention_backends: tuple[AttentionBackendEnum, ...], quant_config: QuantizationConfig | None, prefix: str, adaln_apply_silu: bool = True, fuse_modulate: bool = False, fuse_qknorm_rope: bool = False, fuse_swiglu: bool = False, fa4_packed_varlen: bool = False)
Bases: Module
Packed self-attention and feed-forward branches with row-indexed AdaLN.