Image-Text-to-Video
Diffusers
Safetensors
MiniMax H3
modular-diffusers
ref2va
fl2va
Merge
synchronized-audio-video
experimental
Instructions to use diffusers-modular/MiniMax-H3-Pruned-Ref-Delta-Fused-r1024 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use diffusers-modular/MiniMax-H3-Pruned-Ref-Delta-Fused-r1024 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("diffusers-modular/MiniMax-H3-Pruned-Ref-Delta-Fused-r1024", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: minimax-h3-community-license-agreement
|
| 4 |
+
license_link: https://huggingface.co/MiniMaxAI/MiniMax-H3/blob/main/LICENSE
|
| 5 |
+
base_model:
|
| 6 |
+
- MiniMaxAI/MiniMax-H3
|
| 7 |
+
- Comfy-Org/MiniMax-H3
|
| 8 |
+
base_model_relation: merge
|
| 9 |
+
library_name: diffusers
|
| 10 |
+
pipeline_tag: image-text-to-video
|
| 11 |
+
tags:
|
| 12 |
+
- minimax-h3
|
| 13 |
+
- modular-diffusers
|
| 14 |
+
- ref2va
|
| 15 |
+
- fl2va
|
| 16 |
+
- merge
|
| 17 |
+
- synchronized-audio-video
|
| 18 |
+
- experimental
|
| 19 |
+
inference: false
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# MiniMax-H3, one transformer for references *and* keyframes
|
| 23 |
+
|
| 24 |
+
MiniMax-H3 ships **two** 37.5 GB transformer partitions: `fl2va` for first/last-frame conditioning and `ref2va`
|
| 25 |
+
for reference conditioning. This is **one** checkpoint that serves both, so a deployment holds 37.5 GB instead of
|
| 26 |
+
75 GB. It is the pruned `fl2va` partition with a rank-1024 approximation of the `ref2va β fl2va` weight delta
|
| 27 |
+
**fused into the weights**.
|
| 28 |
+
|
| 29 |
+
> [!WARNING]
|
| 30 |
+
> Experimental and mechanically derived β the delta was extracted from two released checkpoints by SVD, not
|
| 31 |
+
> trained. This is **not** `transformer_ref`: against the real thing it reaches video-latent cosine 0.875 / 0.897 /
|
| 32 |
+
> 0.691 on three matched reference requests, short of the 0.99 that would make it a drop-in replacement. Use it when
|
| 33 |
+
> one-partition deployment is worth that gap.
|
| 34 |
+
|
| 35 |
+
> [!IMPORTANT]
|
| 36 |
+
> Governed by the [MiniMax H3 Community License Agreement](https://huggingface.co/MiniMaxAI/MiniMax-H3/blob/main/LICENSE),
|
| 37 |
+
> which carries territory exclusions and redistribution conditions. The upstream `LICENSE` is included and this card
|
| 38 |
+
> is the modification notice.
|
| 39 |
+
|
| 40 |
+
## Inference
|
| 41 |
+
|
| 42 |
+
Both workflows resolve to the weights in this repo, and each loads only its own slot:
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
import torch
|
| 46 |
+
from diffusers import ComponentsManager, ModularPipeline
|
| 47 |
+
|
| 48 |
+
REPO = "diffusers-modular/MiniMax-H3-Pruned-Ref-Delta-Fused-r1024"
|
| 49 |
+
|
| 50 |
+
manager = ComponentsManager()
|
| 51 |
+
pipe = ModularPipeline.from_pretrained(REPO, workflow="ref2va", components_manager=manager,
|
| 52 |
+
trust_remote_code=True)
|
| 53 |
+
pipe.load_components(dtype=torch.bfloat16, trust_remote_code=True)
|
| 54 |
+
manager.enable_auto_cpu_offload(device="cuda") # 37.5 GB DiT + 62 GB conditioner + two VAEs
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
**References** (`workflow="ref2va"`) β image, video and/or audio, in the order they are passed:
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
from diffusers.modular_pipelines.minimax_h3 import MiniMaxH3ImageReference
|
| 61 |
+
|
| 62 |
+
out = pipe(
|
| 63 |
+
prompt="The woman from the reference stands in a snowy park at dusk, catching snowflakes and laughing.",
|
| 64 |
+
references=[MiniMaxH3ImageReference.from_file("subject.png")],
|
| 65 |
+
height=544, width=960, num_frames=124, num_inference_steps=20,
|
| 66 |
+
generator=torch.Generator("cpu").manual_seed(42),
|
| 67 |
+
)
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
**Keyframes** (`workflow="fl2va"`) β a first and/or last frame:
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from PIL import Image
|
| 74 |
+
|
| 75 |
+
out = pipe( # same repo, reloaded with workflow="fl2va"
|
| 76 |
+
prompt="She lifts the teacup and takes a slow sip, then smiles; quiet kitchen room tone.",
|
| 77 |
+
image=Image.open("first.png"), last_image=Image.open("last.png"),
|
| 78 |
+
height=544, width=960, num_frames=124, num_inference_steps=20,
|
| 79 |
+
generator=torch.Generator("cpu").manual_seed(42),
|
| 80 |
+
)
|
| 81 |
+
video, audio, rate = out["videos"][0], out["audio"][0], out["sampling_rate"]
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
One generation carries **one** shape: the blocks dispatch on their inputs and `references` wins, so passing both
|
| 85 |
+
silently drops the keyframes.
|
| 86 |
+
|
| 87 |
+
### Few-step generation β keep the turbo LoRA live
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
pipe.load_lora_weights("larryvrh/MiniMax-H3-Turbo-Lora", adapter_name="turbo",
|
| 91 |
+
load_into_transformer_ref=True) # `load_into_transformer_ref` only for ref2va
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
**Do not fuse it.** A distill LoRA's deltas are 2β5e-4 of the weights they modify, and folding them into bf16 keeps
|
| 95 |
+
only **0.67β0.79** β a third of turbo's AdaLN modulation is lost to rounding. Left live it costs ~7β15% wall time.
|
| 96 |
+
For the same reason, an AoT-compiled transformer cannot be combined with a live adapter: the graph is captured from
|
| 97 |
+
the base modules and runs straight past it.
|
| 98 |
+
|
| 99 |
+
Requires `diffusers` with `MiniMaxH3LoraLoaderMixin` (PR
|
| 100 |
+
[#14408](https://github.com/huggingface/diffusers/pull/14408)) and `trust_remote_code=True` β the pruned layout
|
| 101 |
+
ships a `MiniMaxH3PrunedTransformer3DModel` whose AdaLN is 8 wide, where the stock class expects 2688.
|
| 102 |
+
|
| 103 |
+
## How it was made
|
| 104 |
+
|
| 105 |
+
1. **Take the difference between the twins.** `ref2va β fl2va`, tensor by tensor. Both partitions are architecturally
|
| 106 |
+
identical, so this is what makes one able to use references.
|
| 107 |
+
2. **Compress it.** [ethanfel's](https://huggingface.co/ethanfel/MiniMax-H3-Pruned-Ref2VA-Delta-LoRAs-Experimental)
|
| 108 |
+
randomized-SVD extraction at **rank 1024** (9.4 GB), applied at strength 1.0.
|
| 109 |
+
3. **Apply the parts that cannot be compressed exactly.** 267 patches: 211 RMSNorm deltas, 56 biases, and
|
| 110 |
+
`adaln_t_table` β the timestep coordinate table, which differs between the partitions and which the earlier
|
| 111 |
+
rank-256 extractions omit.
|
| 112 |
+
4. **Fuse.** `fuse_lora`, then unload the adapter, leaving an ordinary checkpoint. The delta is 0.02β1.9 of the
|
| 113 |
+
weights it lands in, so it survives a bf16 fold at 1.00 (unlike a distill LoRA β see above).
|
| 114 |
+
5. **Keep the AdaLN affine map.** `adaln_basis` / `adaln_mean` ship as buffers, so LoRAs trained on the released
|
| 115 |
+
2688-wide AdaLN still project onto this 8-wide one.
|
| 116 |
+
|
| 117 |
+
Verified by re-downloading this repo and generating: bit-identical (`torch.equal` on video and audio latents) to the
|
| 118 |
+
local build it was made from.
|
| 119 |
+
|
| 120 |
+
## Measured
|
| 121 |
+
|
| 122 |
+
Video-latent cosine against the true `ref2va` partition, generated on the same GPU (identical weights on a
|
| 123 |
+
different GPU only agree to 0.959β0.987, so cross-machine anchors are not usable at this precision). Three
|
| 124 |
+
seed-matched requests: photoreal image reference, stylized image reference, video reference.
|
| 125 |
+
|
| 126 |
+
| applied to pruned FL2VA | size | photoreal | stylized | video ref |
|
| 127 |
+
|---|---|---|---|---|
|
| 128 |
+
| **rank-1024 delta (this repo)** | 9.4 GB | **0.875** | **0.897** | **0.691** |
|
| 129 |
+
| rank-256 delta | 2.4 GB | 0.772 | 0.798 | 0.527 |
|
| 130 |
+
| AdaLN-only, exact | 95 MiB | 0.678 | 0.803 | 0.505 |
|
| 131 |
+
| nothing | 0 | 0.668 | 0.795 | 0.480 |
|
| 132 |
+
|
| 133 |
+
Rank is what matters, and the bulk is load-bearing: the exact AdaLN half β the tempting 95 MiB shortcut β lands on
|
| 134 |
+
the no-delta baseline, so the trunk attention and MLP deltas are carrying the result.
|
| 135 |
+
|
| 136 |
+
**Keyframes still work.** Against the *pristine* `fl2va` partition on the same first+last-frame request, this
|
| 137 |
+
checkpoint reaches video cosine **0.930** and is visually indistinguishable. Audio is the weaker half (0.662, and
|
| 138 |
+
it runs louder). Few-step, with turbo live: 64β179 s per 5 s clip against 174β478 s for 20 steps on the true
|
| 139 |
+
partition, at the VRAM of a single partition.
|
| 140 |
+
|
| 141 |
+
## Credit
|
| 142 |
+
|
| 143 |
+
Delta extraction [ethanfel](https://huggingface.co/ethanfel/MiniMax-H3-Pruned-Ref2VA-Delta-LoRAs-Experimental);
|
| 144 |
+
approach established by [Kijai](https://huggingface.co/Kijai/MiniMax-H3-experimental); pruned repack
|
| 145 |
+
[Comfy-Org](https://huggingface.co/Comfy-Org/MiniMax-H3); turbo LoRA
|
| 146 |
+
[larryvrh](https://huggingface.co/larryvrh/MiniMax-H3-Turbo-Lora); base model and license
|
| 147 |
+
[MiniMaxAI](https://huggingface.co/MiniMaxAI/MiniMax-H3). Related community work on the same question:
|
| 148 |
+
[lihaoyun6](https://huggingface.co/lihaoyun6/MiniMax-H3-Ref-Patch) (exact-diff-only patch),
|
| 149 |
+
[smhfacct](https://huggingface.co/smhfacct/Minimax-H3-fl2va-ref2va-hybrid-models) (AdaLN block swap),
|
| 150 |
+
[PulpCut](https://huggingface.co/PulpCut/MiniMax-H3-Ref2VA-Turbo-INT8-ConvRot) (turbo merged into Ref2VA).
|