--- license: apache-2.0 library_name: diffusers tags: - modular-diffusers - minimax-h3 - video-generation --- # MiniMax-H3 RefMod Portable reference-conditioning files for MiniMax-H3 `ref2va`, as [Modular Diffusers](https://huggingface.co/docs/diffusers/modular_diffusers/overview) blocks. This is the diffusers-modular equivalent of the ComfyUI "RefMod": encode a reference once, save the result to a small `.safetensors`, and inject it straight back on later requests instead of re-encoding the media. ## What it is A `ref2va` request conditions on an ordered list of references. `MiniMaxH3Ref2VAReferenceEncoderStep` turns their pixels into the `condition_latents` the transformer prepends to its packed sequence. That VAE encode is deterministic (the posterior is sampled under a fixed `keyframe_encode_seed`) and independent of the prompt, so it is pure, reusable work. RefMod caches it. Two blocks (both in `block.py`): - `MiniMaxH3SaveRefModStep` - serialize `condition_latents` (+ `audio_condition_latents`) to a `.safetensors`. - `MiniMaxH3LoadRefModStep` - read one back into `condition_latents` / `audio_condition_latents`, dropping in where `MiniMaxH3Ref2VAReferenceEncoderStep` would run. The default block of this repo (its `auto_map`) is `MiniMaxH3LoadRefModStep`. ## What it carries, and what it does not - It carries the **VAE condition latents**: one `(1, C, T, H, W)` tensor per image/video reference, plus one `(num_audio_latents * 2, audio_channels)` tensor per reference soundtrack. These are stored exactly as the live encoder leaves them (normalized, fp16-valued, in float32), so a save/load round-trip is **bitwise-lossless**. - It does **not** carry the Qwen3-VL conditioning. In MiniMax-H3 a reference also appears to the text encoder as a `` / `