linoyts HF Staff commited on
Commit
c7d2637
Β·
verified Β·
1 Parent(s): 10cc094

Document the combined workflow shipped in this repo

Browse files
Files changed (1) hide show
  1. README.md +38 -20
README.md CHANGED
@@ -84,25 +84,42 @@ video, audio, rate = out["videos"][0], out["audio"][0], out["sampling_rate"]
84
 
85
  ### Keyframes and references in the same generation
86
 
87
- The model itself supports it β€” MiniMax-H3 denoises one packed sequence, and keyframe conditioning rows and reference
88
- conditioning rows can both sit in it. ComfyUI exposes this natively: chain its `MiniMaxH3ReferenceToVideo` into
89
- `MiniMaxH3AddGuide` and one sampler run carries both.
90
-
91
- `diffusers` does **not** expose it. Its auto-blocks dispatch either/or β€” `select_block` checks `references` first and
92
- returns the `ref2va` branch β€” so a request carrying both is accepted and the **keyframes are silently dropped**. There
93
- is no error and no warning; you get a reference-only generation.
94
-
95
- Combining them therefore needs one extra piece on top of `diffusers`: a layout step that packs
96
- `[text | keyframe conditions | reference blocks | targets]` into one sequence, with the keyframe anchors shifted by
97
- the references' total time span (the references push the target timeline out). Porting
98
- [ComfyUI's `PackedLayout`](https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/ldm/minimax/model.py) is the
99
- straightforward way to get it, and the denoising loop needs no change at all, since the conditioning rows are simply
100
- the leading rows of the sequence.
101
-
102
- Measured on this checkpoint with such a layout in place: a combined request (first frame + last frame + an image
103
- reference) agrees with the real `ref2va` partition at video-latent cosine **0.972** β€” closer than any reference-only
104
- request reaches, because keyframes anchoring both ends leave the delta less to carry. Adding an audio reference on top
105
- moves the video only 0.965 while rewriting the soundtrack to 0.403, i.e. each conditioning does its own job.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  ### Few-step generation β€” keep the turbo LoRA live
108
 
@@ -167,4 +184,5 @@ approach established by [Kijai](https://huggingface.co/Kijai/MiniMax-H3-experime
167
  [MiniMaxAI](https://huggingface.co/MiniMaxAI/MiniMax-H3). Related community work on the same question:
168
  [lihaoyun6](https://huggingface.co/lihaoyun6/MiniMax-H3-Ref-Patch) (exact-diff-only patch),
169
  [smhfacct](https://huggingface.co/smhfacct/Minimax-H3-fl2va-ref2va-hybrid-models) (AdaLN block swap),
170
- [PulpCut](https://huggingface.co/PulpCut/MiniMax-H3-Ref2VA-Turbo-INT8-ConvRot) (turbo merged into Ref2VA).
 
 
84
 
85
  ### Keyframes and references in the same generation
86
 
87
+ `workflow="combined"` β€” this repo ships the blocks for it:
88
+
89
+ ```python
90
+ pipe = ModularPipeline.from_pretrained(REPO, workflow="combined", trust_remote_code=True)
91
+ pipe.load_components(dtype=torch.bfloat16, trust_remote_code=True)
92
+
93
+ out = pipe(
94
+ prompt="She lifts the teacup and takes a slow sip, then smiles; warm kitchen light",
95
+ references=[MiniMaxH3ImageReference.from_file("subject.png")], # who / what
96
+ image=Image.open("first.png"), last_image=Image.open("last.png"), # where it starts and ends
97
+ height=544, width=960, num_frames=124, num_inference_steps=20,
98
+ generator=torch.Generator("cpu").manual_seed(42),
99
+ )
100
+ ```
101
+
102
+ MiniMax-H3 denoises **one packed sequence**, and that sequence can hold keyframe conditioning rows and reference
103
+ conditioning rows at the same time. `diffusers`' shipped blocks cannot express it: their conditional steps dispatch
104
+ either/or β€” `select_block` checks `references` first β€” so a request carrying both is accepted and the **keyframes are
105
+ silently dropped**, with no error and no warning.
106
+
107
+ `MiniMaxH3CombinedBlocks` (in `combined_blocks.py`) is the stock blockset with three of its conditional steps replaced
108
+ by ones that know a fourth shape. It reserves `[text | keyframe conditions | reference blocks | target audio | target
109
+ video]`, and because the references push the target timeline out, the keyframe anchors ride on the timeline their
110
+ spans leave behind. The `t2va`, `fl2va` and `ref2va` workflows are untouched and take exactly the same path as before;
111
+ the denoising loop needed no change at all, since the conditioning rows are simply the leading rows of the sequence.
112
+
113
+ Two things keep it honest: the layout reproduces **both** shipped `diffusers` builders bit for bit in their degenerate
114
+ cases β€” no keyframes gives the `ref2va` layout, no references gives the `fl2va` one, `position_ids` compared in
115
+ float64 β€” and the stock prepare-latents step asserts that the conditioning rows encoded equal the rows the layout
116
+ reserved, so a wrong layout raises instead of quietly degrading.
117
+
118
+ Measured on this checkpoint β€” with this layout, driven through the same underlying steps, before it was packaged as
119
+ the blockset above: a combined request (first frame + last frame + an image reference) agrees with the real
120
+ `ref2va` partition at video-latent cosine **0.972**, closer than any reference-only request reaches, because keyframes
121
+ anchoring both ends leave the delta less to carry. Adding an audio reference on top moves the video only 0.965 while
122
+ rewriting the soundtrack to 0.403 β€” each conditioning doing its own job.
123
 
124
  ### Few-step generation β€” keep the turbo LoRA live
125
 
 
184
  [MiniMaxAI](https://huggingface.co/MiniMaxAI/MiniMax-H3). Related community work on the same question:
185
  [lihaoyun6](https://huggingface.co/lihaoyun6/MiniMax-H3-Ref-Patch) (exact-diff-only patch),
186
  [smhfacct](https://huggingface.co/smhfacct/Minimax-H3-fl2va-ref2va-hybrid-models) (AdaLN block swap),
187
+ [PulpCut](https://huggingface.co/PulpCut/MiniMax-H3-Ref2VA-Turbo-INT8-ConvRot) (turbo merged into Ref2VA). The
188
+ packed-sequence order a combined request uses follows ComfyUI's implementation of this model.