Skip to content

minimax_h3_conditioner

Streamed Qwen3-VL prompt conditioner for MiniMax-H3 on Apple Silicon MLX.

Produces exactly the conditioning the H3 DiT consumes: the language-model hidden states after the first 50 language-model layers plus the per-token modality tags for text prompts.

Memory contract for the 36 GiB tier: the released conditioner is ~66 GB of BF16 and never becomes resident. Tensors are read per-key from the safetensors shards and only the pieces a given forward needs are materialized:

  • token embedding table row-gathered per batch (full table never copied);
  • one decoder layer (~1 GB BF16) resident at a time, computed in FP32, released before the next layer loads; The forward pass uses MLX. Tokenization uses the Transformers tokenizer API.

Classes

fastvideo.mlx_runtime.minimax_h3_conditioner.StreamedMiniMaxH3TextConditioner

StreamedMiniMaxH3TextConditioner(component_dir: str | Path, tokenizer_dir: str | Path | None = None)

Layer-streaming Qwen3-VL text stack -> H3 conditioning hidden states.

Source code in fastvideo/mlx_runtime/minimax_h3_conditioner.py
def __init__(self, component_dir: str | Path, tokenizer_dir: str | Path | None = None):
    self.component_dir = Path(component_dir)
    self.config = ConditionerConfig.from_config_json(self.component_dir / "config.json")
    self.index = _ShardIndex(self.component_dir)
    self.tokenizer = self._load_tokenizer(tokenizer_dir)

Methods:

fastvideo.mlx_runtime.minimax_h3_conditioner.StreamedMiniMaxH3TextConditioner.encode_prompt
encode_prompt(prompt: str) -> tuple[ndarray, ndarray]

prompt -> (hidden states (S, hidden), token tags (S,)) both fp32.

Source code in fastvideo/mlx_runtime/minimax_h3_conditioner.py
def encode_prompt(self, prompt: str) -> tuple[np.ndarray, np.ndarray]:
    """prompt -> (hidden states (S, hidden), token tags (S,)) both fp32."""
    token_ids = self.tokenize(prompt)
    return self.encode_tokens(token_ids)

Functions: