Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(minimax-h3): allow audio-only Ref2VA reference sets

Lincoln Stein9111c9cc55d6
diff --git a/docs/src/content/docs/Users Guide/05.Video Generation/minimax-h3.mdx b/docs/src/content/docs/Users Guide/05.Video Generation/minimax-h3.mdx
index 7cb68085a1..55520a2922 100644
--- a/docs/src/content/docs/Users Guide/05.Video Generation/minimax-h3.mdx
+++ b/docs/src/content/docs/Users Guide/05.Video Generation/minimax-h3.mdx
@@ -19,7 +19,7 @@ media's video, audio, or both video and audio.
MiniMax H3 ships as two task transformers that share every other component. **FL2VA** — *first/last-frame to video with audio* — covers text-to-video, first frame, last frame, both, and extend. **Ref2VA** — *reference to video with audio* — conditions a new clip on **reference media**: up to 3 videos and 9 images, in an order you choose (order changes the result). Every generation from either includes a **jointly generated stereo soundtrack**, muxed into the MP4 as AAC.
-The panel switches task by transformer: select the Ref2VA single-file transformer as the **Model** and the conditioning sections become the ordered **References** list; select the FL2VA transformer to get the five frame/extend modes back. A video reference can contribute its image track, its soundtrack, or both — soundtrack-only references must be paired with at least one visual reference. Image references default to a high-detail 2048 px encoding ("Max"); the "Match generation size" option is several times faster at some fidelity cost.
+The panel switches task by transformer: select the Ref2VA single-file transformer as the **Model** and the conditioning sections become the ordered **References** list; select the FL2VA transformer to get the five frame/extend modes back. A video reference can contribute its image track, its soundtrack, or both; soundtrack-only references can be used on their own. Image references default to a high-detail 2048 px encoding ("Max"); the "Match generation size" option is several times faster at some fidelity cost.
What makes it different from Wan in practice:
diff --git a/invokeai/app/invocations/minimax_h3/minimax_h3_reference.py b/invokeai/app/invocations/minimax_h3/minimax_h3_reference.py
index 12870f44d5..e9f0d9504b 100644
--- a/invokeai/app/invocations/minimax_h3/minimax_h3_reference.py
+++ b/invokeai/app/invocations/minimax_h3/minimax_h3_reference.py
@@ -125,8 +125,7 @@ class MiniMaxH3VideoReferenceInvocation(BaseInvocation):
"""Describes one video reference for MiniMax H3 Ref2VA.
'Audio only' conditions on the video's soundtrack alone (the standalone audio-reference
- kind). At least one reference of the request must contribute visuals, and a conditioning
- choice that includes audio requires the video to actually carry a soundtrack.
+ kind). A conditioning choice that includes audio requires the video to actually carry a soundtrack.
"""
video: VideoField = InputField(description="The reference video.")
diff --git a/invokeai/app/services/workflow_records/default_workflows/Reference to Video - MiniMax H3.json b/invokeai/app/services/workflow_records/default_workflows/Reference to Video - MiniMax H3.json
index 333842e2e3..70d60aae02 100644
--- a/invokeai/app/services/workflow_records/default_workflows/Reference to Video - MiniMax H3.json
+++ b/invokeai/app/services/workflow_records/default_workflows/Reference to Video - MiniMax H3.json
@@ -5,7 +5,7 @@
"version": "1.1.0",
"contact": "",
"tags": "minimax h3, text to video, video, audio",
- "notes": "Condition a new clip on reference media: wire up to 3 Video Reference and up to 9 Image Reference nodes through chained Collect nodes into BOTH the Reference Conditioning node and the Prompt node - the same ordered references must reach both, and reference ORDER changes the result. A video reference can contribute its image track, its soundtrack, or both (soundtrack-only references must be paired with at least one visual reference).\n\nNumber of Frames appears twice: the Denoise node's dropdown and the integer field feeding the Prompt and Reference Conditioning nodes. They must match; the run stops with a clear error if they do not.\n\nSelect the Ref2VA transformer (e.g. 'MiniMax H3 Ref2VA Transformer (int8, pruned)') in the model loader's Transformer field - the FL2VA transformer cannot consume references.\n\nEach InvokeAI install assigns its own internal model IDs, so every model field ships blank -- pick your installed models in the form before invoking.",
+ "notes": "Condition a new clip on reference media: wire up to 3 Video Reference and up to 9 Image Reference nodes through chained Collect nodes into BOTH the Reference Conditioning node and the Prompt node - the same ordered references must reach both, and reference ORDER changes the result. A video reference can contribute its image track, its soundtrack, or both; soundtrack-only references can be used on their own.\n\nNumber of Frames appears twice: the Denoise node's dropdown and the integer field feeding the Prompt and Reference Conditioning nodes. They must match; the run stops with a clear error if they do not.\n\nSelect the Ref2VA transformer (e.g. 'MiniMax H3 Ref2VA Transformer (int8, pruned)') in the model loader's Transformer field - the FL2VA transformer cannot consume references.\n\nEach InvokeAI install assigns its own internal model IDs, so every model field ships blank -- pick your installed models in the form before invoking.",
"exposedFields": [
{
"nodeId": "9c0f3e11-2a3b-4c5d-8e6f-7a8b9c0d1e02",
diff --git a/invokeai/backend/minimax_h3/packing.py b/invokeai/backend/minimax_h3/packing.py
index d9940f55ca..242759a2dd 100644
--- a/invokeai/backend/minimax_h3/packing.py
+++ b/invokeai/backend/minimax_h3/packing.py
@@ -86,7 +86,8 @@ MINIMAX_H3_KEYFRAME_NOISE_AUG = 0.999
MINIMAX_H3_KEYFRAME_ENCODE_SEED = 42
# Reference caps of the `ref2va` task, per the reference implementation: at most 9 image, 3 video and 3 audio
-# references, and at most 12 in total. At least one reference must be visual (image or video).
+# references, and at most 12 in total. Upstream also rejects a set of only audio references; this port deliberately
+# accepts one, which packs no visual condition rows (the generated audio and video follow the reference soundtracks).
MINIMAX_H3_MAX_IMAGE_REFERENCES = 9
MINIMAX_H3_MAX_VIDEO_REFERENCES = 3
MINIMAX_H3_MAX_AUDIO_REFERENCES = 3
@@ -152,8 +153,6 @@ def validate_reference_kinds(kinds: Sequence[str]) -> None:
raise ValueError(f"A reference must be an 'image', a 'video' or an 'audio', got {kind!r}.")
if not kinds:
raise ValueError("Reference-to-video needs at least one reference; use the `t2va` workflow instead.")
- if set(kinds) == {"audio"}:
- raise ValueError("An audio reference cannot be used alone; add at least one image or video reference.")
counts = {kind: sum(1 for k in kinds if k == kind) for kind in ("image", "video", "audio")}
caps = {
"image": MINIMAX_H3_MAX_IMAGE_REFERENCES,
diff --git a/invokeai/frontend/api/openapi.json b/invokeai/frontend/api/openapi.json
index d570de879f..413421e655 100644
--- a/invokeai/frontend/api/openapi.json
+++ b/invokeai/frontend/api/openapi.json
@@ -82715,7 +82715,7 @@
"category": "conditioning",
"class": "invocation",
"classification": "prototype",
- "description": "Describes one video reference for MiniMax H3 Ref2VA.\n\n'Audio only' conditions on the video's soundtrack alone (the standalone audio-reference\nkind). At least one reference of the request must contribute visuals, and a conditioning\nchoice that includes audio requires the video to actually carry a soundtrack.",
+ "description": "Describes one video reference for MiniMax H3 Ref2VA.\n\n'Audio only' conditions on the video's soundtrack alone (the standalone audio-reference\nkind). A conditioning choice that includes audio requires the video to actually carry a soundtrack.",
"node_pack": "invokeai",
"properties": {
"id": {
diff --git a/invokeai/frontend/api/schema.ts b/invokeai/frontend/api/schema.ts
index a3fd52a96d..d8aed68285 100644
--- a/invokeai/frontend/api/schema.ts
+++ b/invokeai/frontend/api/schema.ts
@@ -35711,8 +35711,7 @@ export type components = {
* @description Describes one video reference for MiniMax H3 Ref2VA.
*
* 'Audio only' conditions on the video's soundtrack alone (the standalone audio-reference
- * kind). At least one reference of the request must contribute visuals, and a conditioning
- * choice that includes audio requires the video to actually carry a soundtrack.
+ * kind). A conditioning choice that includes audio requires the video to actually carry a soundtrack.
*/
MiniMaxH3VideoReferenceInvocation: {
/**
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
index d684cef57f..e519d2301a 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
@@ -1578,7 +1578,7 @@ describe('reference mode policy', () => {
settingsFor(model, { componentSourceModel: h3Model(), ...overrides });
expect(getVideoValidationReasons(model, withRefTransformer({}))).toContain(
- 'Reference-to-video needs at least one image or video reference.'
+ 'Reference-to-video needs at least one reference.'
);
expect(
getVideoValidationReasons(
@@ -1601,9 +1601,7 @@ describe('reference mode policy', () => {
],
})
)
- ).toContain(
- 'At least one reference must contribute visuals — add an image, or set a video reference to include video.'
- );
+ ).toEqual([]);
expect(getVideoValidationReasons(model, withRefTransformer({ references: [imageReference] }))).toEqual([]);
});
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
index 885c532160..3337481804 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
@@ -2245,7 +2245,7 @@ export const getVideoValidationReasons = (model: MainModelConfig, settings: Vide
if (!config.modes.includes(mode)) {
if (referenceOnly && settings.references.length === 0) {
// Explain the missing reference rather than implying a defective text-to-video model.
- reasons.push('Reference-to-video needs at least one image or video reference.');
+ reasons.push('Reference-to-video needs at least one reference.');
} else {
reasons.push(`${model.name} does not support ${VIDEO_MODE_DESCRIPTIONS[mode]}.`);
}
@@ -2257,15 +2257,6 @@ export const getVideoValidationReasons = (model: MainModelConfig, settings: Vide
const caps = config.references;
const videoCount = settings.references.filter((reference) => reference.kind === 'video').length;
const imageCount = settings.references.length - videoCount;
- const allAudioOnly =
- settings.references.length > 0 &&
- settings.references.every((reference) => reference.kind === 'video' && reference.conditioning === 'audio');
-
- if (allAudioOnly) {
- reasons.push(
- 'At least one reference must contribute visuals — add an image, or set a video reference to include video.'
- );
- }
if (caps && videoCount > caps.maxVideos) {
reasons.push(`At most ${caps.maxVideos} video references are supported.`);
}
diff --git a/tests/app/invocations/test_minimax_h3_reference_nodes.py b/tests/app/invocations/test_minimax_h3_reference_nodes.py
index 57cb05e627..c64a695301 100644
--- a/tests/app/invocations/test_minimax_h3_reference_nodes.py
+++ b/tests/app/invocations/test_minimax_h3_reference_nodes.py
@@ -63,9 +63,9 @@ class TestMediaField:
[MiniMaxH3ReferenceMediaField(image=ImageField(image_name="a"), video=VideoField(video_name="b"))]
)
- def test_normalize_rejects_all_audio(self):
- with pytest.raises(ValueError, match="cannot be used alone"):
- normalize_reference_list([_video_ref(conditioning="audio")])
+ def test_normalize_accepts_all_audio(self):
+ references = [_video_ref(conditioning="audio")]
+ assert normalize_reference_list(references) == references
def test_normalize_rejects_caps(self):
with pytest.raises(ValueError, match="At most 3 video"):
diff --git a/tests/backend/minimax_h3/test_ref2va_packing.py b/tests/backend/minimax_h3/test_ref2va_packing.py
index 3bbf79590f..779e604db8 100644
--- a/tests/backend/minimax_h3/test_ref2va_packing.py
+++ b/tests/backend/minimax_h3/test_ref2va_packing.py
@@ -69,9 +69,8 @@ class TestValidateReferenceKinds:
with pytest.raises(ValueError, match="at least one reference"):
validate_reference_kinds([])
- def test_rejects_all_audio(self):
- with pytest.raises(ValueError, match="cannot be used alone"):
- validate_reference_kinds(["audio", "audio"])
+ def test_accepts_all_audio(self):
+ validate_reference_kinds(["audio", "audio"])
def test_rejects_unknown_kind(self):
with pytest.raises(ValueError, match="got 'movie'"):
@@ -302,9 +301,16 @@ class TestRef2VADenoiseState:
# ...and visual reference rows at >= 0.999.
assert torch.all(row_timesteps[state.video_indices[:6]] >= 0.999)
- def test_rejects_all_audio(self):
- with pytest.raises(ValueError, match="cannot be used alone"):
- _build_ref_state(0, kinds=("audio",))
+ def test_audio_only_references(self):
+ state = _build_ref_state(0, kinds=("audio",))
+
+ # No visual condition rows: the video stream is the generated target alone.
+ assert state.layout.num_condition_video_rows == 0
+ assert state.video_rows.shape == (8, 96)
+ sequence_length = state.layout.sequence_length
+ assert state.video_indices.tolist() == list(range(sequence_length - 8, sequence_length))
+ assert state.layout.num_condition_audio_rows == 6
+ assert torch.equal(state.audio_rows[:6], torch.full((6, 32), 0.5))
def test_rejects_row_shape_mismatch(self):
refs = [MiniMaxH3EncodedReference(kind="image", video_rows=torch.zeros(5, 96), latent_shape=(1, 6, 2))]