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(webv2): make the H3 transformer the video panel's top model selection

Lincoln Stein4e0b64a1694c
diff --git a/invokeai/frontend/webv2/src/features/video/core/graph.test.ts b/invokeai/frontend/webv2/src/features/video/core/graph.test.ts
index b698a75641..448ed53f83 100644
--- a/invokeai/frontend/webv2/src/features/video/core/graph.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/graph.test.ts
@@ -433,30 +433,42 @@ describe('compileVideoGraph — MiniMax H3', () => {
expect(nodeOfType(backendGraph, 'core_metadata').generation_mode).toBe('minimax_h3_extend_video');
});
- it('passes the single-file overrides to the loader and the metadata', () => {
- const transformer = { ...h3Model('h3-int8'), format: 'checkpoint' };
+ it('maps a single-file main onto the loader: component source as model, checkpoint as override', () => {
+ const checkpoint = { ...h3Model('h3-int8'), format: 'checkpoint' };
const encoder = { base: 'minimax-h3', key: 'h3-te', name: 'H3 TE int8', type: 'qwen3_vl_encoder' as const };
- const settings = settingsFor(model, { h3TextEncoderModel: encoder, h3TransformerModel: transformer });
- const { backendGraph } = compileVideoGraph(settings, model);
+ const settings = settingsFor(checkpoint, { componentSourceModel: model, h3TextEncoderModel: encoder });
+ const { backendGraph } = compileVideoGraph(settings, checkpoint);
expect(nodeOfType(backendGraph, 'minimax_h3_model_loader')).toMatchObject({
+ model: { key: model.key },
text_encoder_model: { key: 'h3-te' },
transformer_model: { key: 'h3-int8' },
});
expect(nodeOfType(backendGraph, 'core_metadata')).toMatchObject({
+ minimax_h3_component_source: { key: model.key },
minimax_h3_text_encoder_model: { key: 'h3-te' },
- minimax_h3_transformer_model: { key: 'h3-int8' },
+ model: { key: 'h3-int8' },
});
});
+ it('a full Diffusers main is the loader model directly, with no overrides recorded', () => {
+ const { backendGraph } = compileVideoGraph(settingsFor(model), model);
+ const loader = nodeOfType(backendGraph, 'minimax_h3_model_loader');
+ const metadata = nodeOfType(backendGraph, 'core_metadata');
+
+ expect(loader).toMatchObject({ model: { key: model.key } });
+ expect(loader.transformer_model).toBeUndefined();
+ expect(metadata.minimax_h3_component_source).toBeUndefined();
+ });
+
it('refuses to compile fractional or off-grid frame counts', () => {
expect(() => compileVideoGraph(settingsFor(model, { numFrames: 100 }), model)).toThrow(/17·n \+ 5/);
});
});
describe('compileVideoGraph — MiniMax H3 Ref2VA', () => {
- const model = h3Model();
- const ref2vaTransformer: MainModelConfig = {
+ const componentSource = h3Model();
+ const model: MainModelConfig = {
base: 'minimax-h3',
format: 'checkpoint',
key: 'h3-ref2va-ckpt',
@@ -465,7 +477,7 @@ describe('compileVideoGraph — MiniMax H3 Ref2VA', () => {
variant: 'ref2va',
};
const referenceSettings = settingsFor(model, {
- h3TransformerModel: ref2vaTransformer,
+ componentSourceModel: componentSource,
references: [
{
clip: { endFrame: 47, fps: 24, height: 480, numFrames: 48, startFrame: 2, video_name: 'ref.mp4', width: 832 },
@@ -533,14 +545,20 @@ describe('compileVideoGraph — MiniMax H3 Ref2VA', () => {
]);
});
- it('refuses to compile references on an fl2va transformer', () => {
- const fl2vaSettings = { ...referenceSettings, h3TransformerModel: null };
+ it('refuses to compile references on an fl2va model', () => {
+ expect(() => compileVideoGraph({ ...referenceSettings, componentSourceModel: null }, componentSource)).toThrow(
+ /reference-conditioned/
+ );
+ });
- expect(() => compileVideoGraph(fl2vaSettings, model)).toThrow(/reference-conditioned/);
+ it('refuses to compile a single-file main with no component source', () => {
+ expect(() => compileVideoGraph({ ...referenceSettings, componentSourceModel: null }, model)).toThrow(
+ /Model Components/
+ );
});
it('fl2va graphs are unchanged by the ref2va machinery', () => {
- const { backendGraph } = compileVideoGraph(settingsFor(model), model);
+ const { backendGraph } = compileVideoGraph(settingsFor(componentSource), componentSource);
expect(nodesOfType(backendGraph, 'minimax_h3_reference_conditioning')).toHaveLength(0);
expect(nodesOfType(backendGraph, 'collect')).toHaveLength(0);
diff --git a/invokeai/frontend/webv2/src/features/video/core/graph.ts b/invokeai/frontend/webv2/src/features/video/core/graph.ts
index 0ea35a6807..08fc250944 100644
--- a/invokeai/frontend/webv2/src/features/video/core/graph.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/graph.ts
@@ -414,13 +414,25 @@ const buildMiniMaxH3VideoGraph = (settings: VideoSettings, model: MainModelConfi
throw new Error('Video dimensions could not be derived from the current settings.');
}
+ // A single-file H3 checkpoint carries only the transformer: the loader's
+ // main model is the Diffusers install from the Model Components slot, with
+ // the checkpoint riding the transformer-override input. A Diffusers main at
+ // top is the loader's main directly. Validation requires the slot for
+ // checkpoint mains, so the throw is a backstop for direct callers.
+ const isSingleFileMain = model.format !== 'diffusers';
+ const componentSource = isSingleFileMain ? settings.componentSourceModel : null;
+
+ if (isSingleFileMain && !componentSource) {
+ throw new Error('A single-file MiniMax H3 transformer needs a Diffusers install selected under Model Components.');
+ }
+
const graph: BackendGraphContract = { edges: [], id: createId('minimax_h3_video_graph'), nodes: {} };
const { positivePrompt, seed } = addPromptAndSeedNodes(graph);
const modelLoader = addNode(graph, {
id: 'model_loader',
- model,
+ model: componentSource ?? model,
text_encoder_model: settings.h3TextEncoderModel ?? undefined,
- transformer_model: settings.h3TransformerModel ?? undefined,
+ transformer_model: isSingleFileMain ? model : undefined,
type: 'minimax_h3_model_loader',
});
const activeLoras = getActiveCompatibleLoras(settings, model);
@@ -532,7 +544,7 @@ const buildMiniMaxH3VideoGraph = (settings: VideoSettings, model: MainModelConfi
const metadata = addVideoMetadata({
extras: {
- ...(settings.h3TransformerModel ? { minimax_h3_transformer_model: settings.h3TransformerModel } : {}),
+ ...(componentSource ? { minimax_h3_component_source: componentSource } : {}),
...(settings.h3TextEncoderModel ? { minimax_h3_text_encoder_model: settings.h3TextEncoderModel } : {}),
...(mode === 'reference'
? {
diff --git a/invokeai/frontend/webv2/src/features/video/core/types.ts b/invokeai/frontend/webv2/src/features/video/core/types.ts
index c35bccd2c4..09ec62cd98 100644
--- a/invokeai/frontend/webv2/src/features/video/core/types.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/types.ts
@@ -111,9 +111,19 @@ export interface VideoSettings {
wanT5EncoderModel: ModelIdentifierConfig | null;
/** The low-noise expert of a Wan 2.2 A14B mixture-of-experts pair. */
wanLowNoiseModel: MainModelConfig | null;
- /** Optional Diffusers main model used as a component source for split/quantized Wan models. */
+ /**
+ * Diffusers main model used as a component source for single-file mains:
+ * split/quantized Wan models, and single-file MiniMax H3 transformers
+ * (which take tokenizer/processor/VAEs from it).
+ */
componentSourceModel: MainModelConfig | null;
- /** Optional single-file MiniMax H3 transformer override (e.g. the pruned int8 repack). */
+ /**
+ * LEGACY — pre model-positions persisted shape only. The single-file H3
+ * transformer used to be an override slot; it is the top model selection
+ * now. `syncVideoWidgetValuesWithModels` promotes a stored value onto
+ * `model` (keeping the old main as `componentSourceModel`); nothing writes
+ * this field any more.
+ */
h3TransformerModel: MainModelConfig | null;
/** Optional single-file MiniMax H3 Qwen3-VL text-encoder override. */
h3TextEncoderModel: ModelIdentifierConfig | null;
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 9e2aae4d70..ec75615ba7 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
@@ -17,11 +17,10 @@ import {
getVideoModelSelectionResult,
getVideoModes,
getVideoPromptPolicy,
- getVideoTransformerSelectionResult,
getVideoValidationReasons,
getWanExpertWiringWarning,
- resolveEffectiveVideoModel,
isSupportedVideoModel,
+ isVideoModelSelectable,
isValidVideoNumFrames,
snapVideoNumFrames,
WAN_LIGHTNING_ACCELERATOR,
@@ -82,10 +81,23 @@ describe('isSupportedVideoModel', () => {
expect(isSupportedVideoModel(wanModel('ti2v_5b', 'checkpoint'))).toBe(true);
});
- it('accepts MiniMax H3 mains only in Diffusers format', () => {
+ it('accepts MiniMax H3 mains in Diffusers and single-file checkpoint formats', () => {
expect(isSupportedVideoModel(h3Model('diffusers'))).toBe(true);
- // Single-file H3 checkpoints are transformer overrides, not selectable mains.
- expect(isSupportedVideoModel(h3Model('checkpoint'))).toBe(false);
+ // The single-file transformer checkpoint IS the model identity now.
+ expect(isSupportedVideoModel(h3Model('checkpoint'))).toBe(true);
+ expect(isSupportedVideoModel({ ...h3Model('gguf_quantized'), format: 'gguf_quantized' })).toBe(false);
+ });
+
+ it('offers only runnable identity-bearing H3 models in the top selector', () => {
+ // Checkpoints of either task variant and full FL2VA Diffusers installs are
+ // selectable; a components-only folder belongs in the Model Components
+ // slot, and a Ref2VA folder's transformer weights are not folder-loadable.
+ expect(isVideoModelSelectable(h3Model('checkpoint'))).toBe(true);
+ expect(isVideoModelSelectable({ ...h3Model('checkpoint'), variant: 'ref2va' })).toBe(true);
+ expect(isVideoModelSelectable(h3Model('diffusers'))).toBe(true);
+ expect(isVideoModelSelectable({ ...h3Model('diffusers'), components_only: true })).toBe(false);
+ expect(isVideoModelSelectable({ ...h3Model('diffusers'), variant: 'ref2va' })).toBe(false);
+ expect(isVideoModelSelectable(wanModel('ti2v_5b', 'checkpoint'))).toBe(true);
});
it('rejects non-video bases and non-main types', () => {
@@ -631,46 +643,72 @@ describe('component section policy', () => {
).not.toContain('wanLowNoiseModel');
});
- it('requires both single-file overrides for a components-only MiniMax H3 install', () => {
- // The slim "MiniMax H3 Components" folder carries tokenizer/processor/VAEs
- // but no transformer or text-encoder weights (backend `components_only`):
- // without the gate, Invoke enables and the loader fails mid-generation.
- const componentsOnly = { ...h3Model(), components_only: true };
- const bare = settingsFor(componentsOnly);
+ it('requires a component source (and a conditional text encoder) for a single-file H3 main', () => {
+ // The single-file checkpoint carries only the transformer; the loader
+ // sources tokenizer/processor/VAEs from a Diffusers install in the Model
+ // Components slot. A components-only source has no text-encoder weights,
+ // so the single-file Qwen3-VL encoder becomes required with it.
+ const checkpoint = h3Model('checkpoint');
+ const bare = settingsFor(checkpoint);
+ const componentsOnly = { ...h3Model('diffusers', 'h3-components'), components_only: true };
+ const encoder = { base: 'minimax-h3', key: 'h3-te-int8', name: 'H3 Text Encoder', type: 'qwen3_vl_encoder' };
- expect(getVideoComponentSectionPolicy(componentsOnly, bare).defaultOpen).toBe(true);
+ expect(getVideoComponentSectionPolicy(checkpoint, bare).defaultOpen).toBe(true);
+ expect(getVideoComponentSectionPolicy(checkpoint, bare).slots.map((slot) => slot.key)).toEqual([
+ 'componentSourceModel',
+ 'h3TextEncoderModel',
+ ]);
- const reasons = getVideoValidationReasons(componentsOnly, bare);
+ expect(getVideoValidationReasons(checkpoint, bare)).toContainEqual(
+ expect.stringContaining('select a Diffusers MiniMax H3 install under Model Components')
+ );
- expect(reasons).toContainEqual(expect.stringContaining('select a single-file Transformer'));
- expect(reasons).toContainEqual(expect.stringContaining('select a single-file Text encoder'));
+ // A full Diffusers source alone satisfies both slots.
+ expect(getVideoValidationReasons(checkpoint, settingsFor(checkpoint, { componentSourceModel: h3Model() }))).toEqual(
+ []
+ );
- // Both overrides selected → the gate opens.
- const filled = settingsFor(componentsOnly, {
- h3TextEncoderModel: { base: 'minimax-h3', key: 'h3-te-int8', name: 'H3 Text Encoder', type: 'qwen3_vl_encoder' },
- h3TransformerModel: {
- base: 'minimax-h3',
- format: 'checkpoint',
- key: 'h3-tf-int8',
- name: 'H3 Transformer',
- type: 'main',
- },
- });
+ // A components-only source still needs the single-file encoder.
+ expect(
+ getVideoValidationReasons(checkpoint, settingsFor(checkpoint, { componentSourceModel: componentsOnly }))
+ ).toContainEqual(expect.stringContaining('select a single-file Text encoder'));
+ expect(
+ getVideoValidationReasons(
+ checkpoint,
+ settingsFor(checkpoint, { componentSourceModel: componentsOnly, h3TextEncoderModel: encoder })
+ )
+ ).toEqual([]);
- expect(getVideoValidationReasons(componentsOnly, filled)).toEqual([]);
+ // The source slot lists only Diffusers H3 installs.
+ const slot = getVideoComponentSectionPolicy(checkpoint, bare).slots[0];
+ const ctx = { model: checkpoint, selectedComponents: bare, settings: bare };
- // One override alone is not enough.
- expect(getVideoValidationReasons(componentsOnly, { ...filled, h3TextEncoderModel: null })).toContainEqual(
- expect.stringContaining('select a single-file Text encoder')
- );
+ expect(slot?.filter?.(h3Model(), ctx)).toBe(true);
+ expect(slot?.filter?.(componentsOnly, ctx)).toBe(true);
+ expect(slot?.filter?.(h3Model('checkpoint', 'other-ckpt'), ctx)).toBe(false);
+ expect(slot?.filter?.(wanModel('i2v_a14b', 'diffusers'), ctx)).toBe(false);
- // A full Diffusers install keeps both slots optional.
+ // A full Diffusers install at top needs nothing.
const full = h3Model();
expect(getVideoValidationReasons(full, settingsFor(full))).toEqual([]);
expect(getVideoComponentSectionPolicy(full, settingsFor(full)).defaultOpen).toBe(false);
});
+ it('steers a legacy components-only H3 main at top toward the checkpoint-as-model shape', () => {
+ const componentsOnly = { ...h3Model(), components_only: true };
+
+ expect(getVideoValidationReasons(componentsOnly, settingsFor(componentsOnly))).toEqual([
+ expect.stringContaining('Select a single-file MiniMax H3 transformer as the model'),
+ ]);
+ // The Ref2VA folder install cannot folder-load its transformer weights.
+ const ref2vaFolder = { ...h3Model(), variant: 'ref2va' };
+
+ expect(getVideoValidationReasons(ref2vaFolder, settingsFor(ref2vaFolder))).toEqual([
+ expect.stringContaining('Select a single-file Ref2VA transformer as the model'),
+ ]);
+ });
+
it('offers the component-source slot only for single-file mains, never listing the main itself', () => {
const diffusers = wanModel('i2v_a14b', 'diffusers');
@@ -746,28 +784,13 @@ describe('component section policy', () => {
expect(reasons).not.toContain('Video needs a Wan T5 Encoder for Wan models.');
});
- it('offers only optional single-file overrides for MiniMax H3', () => {
+ it('offers only the optional text-encoder override for a full Diffusers H3 main', () => {
const model = h3Model();
const policy = getVideoComponentSectionPolicy(model, settingsFor(model));
expect(policy.defaultOpen).toBe(false);
- expect(policy.slots.map((slot) => slot.key)).toEqual(['h3TransformerModel', 'h3TextEncoderModel']);
+ expect(policy.slots.map((slot) => slot.key)).toEqual(['h3TextEncoderModel']);
expect(policy.slots.every((slot) => !slot.required)).toBe(true);
-
- const transformerSlot = policy.slots[0];
- const ctx = { model, selectedComponents: settingsFor(model), settings: settingsFor(model) };
-
- expect(transformerSlot?.filter?.(h3Model('checkpoint'), ctx)).toBe(true);
- expect(transformerSlot?.filter?.(h3Model('diffusers'), ctx)).toBe(false);
- });
-
- it('keeps Ref2VA transformers pickable - the variant switches the panel to the reference mode', () => {
- const model = h3Model();
- const policy = getVideoComponentSectionPolicy(model, settingsFor(model));
- const transformerSlot = policy.slots[0];
- const ctx = { model, selectedComponents: settingsFor(model), settings: settingsFor(model) };
-
- expect(transformerSlot?.filter?.({ ...h3Model('checkpoint'), variant: 'ref2va' }, ctx)).toBe(true);
});
});
@@ -927,7 +950,9 @@ describe('getVideoModelSelectionResult', () => {
describe('getVideoValidationReasons', () => {
it('blocks unsupported models', () => {
- expect(getVideoValidationReasons(h3Model('checkpoint'), settingsFor())).toEqual([
+ const sdxl = { base: 'sdxl', format: 'checkpoint', key: 'sdxl', name: 'SDXL', type: 'main' } as MainModelConfig;
+
+ expect(getVideoValidationReasons(sdxl, settingsFor())).toEqual([
'Video needs a supported video model before it can be invoked.',
]);
});
@@ -1046,7 +1071,7 @@ describe('getVideoModelAvailabilityReasons', () => {
});
// ---------------------------------------------------------------------------
-// Ref2VA: effective variant, reference mode, transitions
+// Ref2VA: model-borne variant, reference mode, transitions
const ref2vaTransformer = (key = 'h3-ref2va-ckpt'): MainModelConfig => ({
...h3Model('checkpoint', key),
@@ -1062,32 +1087,14 @@ const fl2vaTransformer = (key = 'h3-fl2va-ckpt'): MainModelConfig => ({
const imageReference = { detail: 'max', image: { height: 4, image_name: 'ref.png', width: 4 }, kind: 'image' } as const;
-describe('resolveEffectiveVideoModel', () => {
- it('overrides the H3 variant with the selected transformer checkpoint', () => {
- const model = h3Model();
- const settings = settingsFor(model, { h3TransformerModel: ref2vaTransformer() });
-
- expect(resolveEffectiveVideoModel(model, settings)?.variant).toBe('ref2va');
- expect(resolveEffectiveVideoModel(model, settingsFor(model))?.variant).toBe('fl2va');
- });
-
- it('never touches non-H3 models', () => {
- const model = wanModel('t2v_a14b', 'diffusers');
-
- expect(resolveEffectiveVideoModel(model, settingsFor(model, { h3TransformerModel: ref2vaTransformer() }))).toBe(
- model
- );
- });
-});
-
describe('reference mode policy', () => {
- it('a ref2va transformer switches the panel to the reference-only mode set', () => {
- const model = h3Model();
- const settings = settingsFor(model, { h3TransformerModel: ref2vaTransformer() });
+ it('a ref2va transformer at top switches the panel to the reference-only mode set', () => {
+ const model = ref2vaTransformer();
+ const settings = settingsFor(model);
expect(getVideoModelPolicy(model, settings).modes).toEqual(['reference']);
expect(getVideoModelPolicy(model, settings).references).toEqual({ maxImages: 9, maxVideos: 3 });
- expect(getVideoModelPolicy(model, settingsFor(model)).references).toBeNull();
+ expect(getVideoModelPolicy(h3Model(), settingsFor(h3Model())).references).toBeNull();
});
it('an unknown variant still falls back to fl2va, but ref2va never does', () => {
@@ -1098,9 +1105,11 @@ describe('reference mode policy', () => {
});
it('validates the reference rules', () => {
- const model = h3Model();
+ const model = ref2vaTransformer();
+ // A full Diffusers source keeps the component slots satisfied, so only
+ // the reference rules under test can produce reasons.
const withRefTransformer = (overrides: Partial<VideoSettings>) =>
- settingsFor(model, { h3TransformerModel: ref2vaTransformer(), ...overrides });
+ settingsFor(model, { componentSourceModel: h3Model(), ...overrides });
expect(getVideoValidationReasons(model, withRefTransformer({}))).toContain(
'Reference-to-video needs at least one image or video reference.'
@@ -1132,7 +1141,7 @@ describe('reference mode policy', () => {
expect(getVideoValidationReasons(model, withRefTransformer({ references: [imageReference] }))).toEqual([]);
});
- it('rejects references on an fl2va-effective panel', () => {
+ it('rejects references on an fl2va panel', () => {
const model = h3Model();
const reasons = getVideoValidationReasons(model, settingsFor(model, { references: [imageReference] }));
@@ -1140,31 +1149,40 @@ describe('reference mode policy', () => {
});
});
-describe('getVideoTransformerSelectionResult', () => {
+describe('H3 task switches through the top model selection', () => {
it('clears frame media when switching to a ref2va transformer, and references on the way back', () => {
- const model = h3Model();
+ const flModel = h3Model();
const first = { height: 4, image_name: 'kf.png', width: 4 };
- const toRef = getVideoTransformerSelectionResult({
- currentSettings: settingsFor(model, { firstFrameImage: first, modelKey: model.key }),
- model,
- models: [model],
- transformer: ref2vaTransformer(),
+ const toRef = getVideoModelSelectionResult({
+ currentSettings: settingsFor(flModel, { firstFrameImage: first, modelKey: flModel.key }),
+ model: ref2vaTransformer(),
+ models: [flModel],
});
expect(toRef.settings.firstFrameImage).toBeNull();
- expect(toRef.settings.h3TransformerModel?.variant).toBe('ref2va');
expect(toRef.clearedLabels).toContain('First frame');
- const backToFl = getVideoTransformerSelectionResult({
+ const backToFl = getVideoModelSelectionResult({
currentSettings: { ...toRef.settings, references: [imageReference] },
- model,
- models: [model],
- transformer: fl2vaTransformer(),
+ model: fl2vaTransformer(),
+ models: [flModel],
});
expect(backToFl.settings.references).toEqual([]);
expect(backToFl.clearedLabels).toContain('References');
});
+
+ it('a checkpoint-to-checkpoint switch keeps a compatible component source', () => {
+ const source = h3Model();
+ const from = settingsFor(fl2vaTransformer(), { componentSourceModel: source, modelKey: fl2vaTransformer().key });
+ const result = getVideoModelSelectionResult({
+ currentSettings: from,
+ model: ref2vaTransformer(),
+ models: [source],
+ });
+
+ expect(result.settings.componentSourceModel?.key).toBe(source.key);
+ });
});
describe('ref2va accelerator auto-pick', () => {
@@ -1184,9 +1202,9 @@ describe('ref2va accelerator auto-pick', () => {
expect(findMiniMaxH3TurboLora([FL2VA_TURBO], { variant: 'ref2va' })).toBeNull();
});
- it('the accelerator toggle resolves through the effective variant (4-step ref2v turbo)', () => {
- const model = h3Model();
- const settings = settingsFor(model, { h3TransformerModel: ref2vaTransformer() });
+ it('the accelerator toggle resolves through the model-borne variant (4-step ref2v turbo)', () => {
+ const model = ref2vaTransformer();
+ const settings = settingsFor(model);
const result = getAcceleratorToggleResult(settings, model, [model, REF2V_TURBO, FL2VA_TURBO], true);
expect(result.missingLoras).toBe(false);
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
index 3fde3a77c6..8ca0a4a01d 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
@@ -248,16 +248,34 @@ export const VIDEO_GENERATION: Record<
export const SUPPORTED_VIDEO_BASES = Object.keys(VIDEO_GENERATION) as SupportedVideoBase[];
/**
- * MiniMax H3 mains must be the Diffusers folder install — the loader sources
- * five of its six submodels from it; single-file H3 checkpoints are only usable
- * as the transformer override slot.
+ * A model the video panel can reason about at all: any Wan main, and MiniMax
+ * H3 mains in both shapes — the Diffusers folder install and the single-file
+ * transformer checkpoint. For H3 the checkpoint IS the model identity (its
+ * task variant decides the panel's mode); the Diffusers install supplies the
+ * five other submodels, either as the model itself (full install) or through
+ * the component-source slot (checkpoint main).
*/
export const isSupportedVideoModel = <T extends { base: string; type: string; format?: string }>(
model: T
): model is T & MainModelConfig =>
- model.type === 'main' && (model.base === 'wan' || (model.base === 'minimax-h3' && model.format === 'diffusers'));
+ model.type === 'main' &&
+ (model.base === 'wan' ||
+ (model.base === 'minimax-h3' && (model.format === 'diffusers' || model.format === 'checkpoint')));
-export const isVideoModelSelectable = <T extends ModelConfig>(model: T): boolean => isSupportedVideoModel(model);
+/**
+ * What the top model selector offers — like the image Generate panel, the top
+ * pick is what decides the panel's UI, so it lists the identity-bearing models:
+ * H3 single-file transformers (either task variant) and full Diffusers
+ * installs. Excluded, though still "supported" for stored/recalled state:
+ * a components-only folder (no transformer weights — it belongs in the Model
+ * Components slot) and a Ref2VA Diffusers folder (its `transformer_ref`
+ * weights are not folder-loadable; the single-file checkpoint is the runnable
+ * form, with the folder serving as the component source).
+ */
+export const isVideoModelSelectable = <T extends ModelConfig>(model: T): boolean =>
+ isSupportedVideoModel(model) &&
+ !isComponentsOnlyH3Main(model) &&
+ !(model.base === 'minimax-h3' && model.format === 'diffusers' && model.variant === 'ref2va');
/**
* A slim MiniMax H3 folder install: tokenizer/processor/VAEs only, no
@@ -271,26 +289,6 @@ export const isComponentsOnlyH3Main = (model: MainModelConfig): boolean =>
// that re-opens the fail-mid-generation hole this helper exists to close.
model.base === 'minimax-h3' && model.format === 'diffusers' && model.components_only === true;
-/**
- * The model whose variant decides the panel's policy. For MiniMax H3 the TASK lives on the
- * transformer: selecting a single-file Ref2VA transformer switches the whole panel to the
- * reference mode, whatever the (components) main model's variant says. Everything that maps a
- * model to a VideoVariantConfig and has the settings at hand must resolve through this first.
- */
-export const resolveEffectiveVideoModel = <T extends MainModelConfig | undefined>(
- model: T,
- settings: Pick<VideoSettings, 'h3TransformerModel'> | null | undefined
-): T => {
- if (!model || model.base !== 'minimax-h3') {
- return model;
- }
- const variant = settings?.h3TransformerModel?.variant;
- if (typeof variant === 'string' && variant.length > 0 && variant !== model.variant) {
- return { ...model, variant };
- }
- return model;
-};
-
const getVideoVariantConfig = (
model: Pick<MainModelConfig, 'base' | 'type' | 'variant' | 'format'> | undefined
): VideoVariantConfig | null => {
@@ -471,13 +469,12 @@ export interface VideoModelPolicy {
}
export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings: VideoSettings): VideoModelPolicy => {
- // The transformer override can redefine the task (fl2va vs ref2va): the panel policy
- // always comes from the effective model.
- const effectiveModel = resolveEffectiveVideoModel(model, settings);
- const config = getVideoConfig(effectiveModel);
+ // The H3 task (fl2va vs ref2va) lives on the selected model itself: a
+ // single-file transformer checkpoint carries its own variant.
+ const config = getVideoConfig(model);
return {
- aspectRatioOptions: getVideoAspectRatioOptions(effectiveModel),
+ aspectRatioOptions: getVideoAspectRatioOptions(model),
defaults: config.defaults,
fps: config.fps,
frames: config.frames,
@@ -485,7 +482,7 @@ export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings
minSteps: config.minSteps,
modes: config.modes,
pixelMultiple: config.pixelMultiple,
- prompt: getVideoPromptPolicy(effectiveModel, settings),
+ prompt: getVideoPromptPolicy(model, settings),
references: config.references ?? null,
targetResolutions: config.targetResolutions,
ui: {
@@ -776,8 +773,7 @@ export const getAcceleratorToggleResult = (
models: readonly ModelConfig[],
enabled: boolean
): AcceleratorToggleResult => {
- const effectiveModel = resolveEffectiveVideoModel(model, settings);
- const config = getVideoConfig(effectiveModel);
+ const config = getVideoConfig(model);
// Remove exactly the entries a previous toggle added — never a user's own
// LoRA that happens to share a Lightning/Turbo-style name.
const previousKeys = new Set(settings.acceleratorLoraKeys);
@@ -798,7 +794,7 @@ export const getAcceleratorToggleResult = (
};
}
- const entries = findAcceleratorLoraEntries(effectiveModel, models);
+ const entries = findAcceleratorLoraEntries(model, models);
if (!entries) {
// Never leave the flag claiming a fast path that has no LoRAs behind it.
@@ -860,10 +856,9 @@ export const getAcceleratorLoraChangeResult = (
models: readonly ModelConfig[],
loras: GenerateLora[]
): AcceleratorLoraChangeResult => {
- // The transformer override can redefine the task (fl2va vs ref2va), and the two tasks
- // have different accelerators: judge the list against the EFFECTIVE model.
- const effectiveModel = resolveEffectiveVideoModel(model, settings);
- const config = getVideoConfig(effectiveModel);
+ // The two H3 tasks (fl2va vs ref2va) have different accelerators; the task
+ // lives on the selected model's own variant.
+ const config = getVideoConfig(model);
const next: VideoSettings = { ...settings, loras };
// Nothing to repair, and nothing this function is allowed to start.
@@ -872,13 +867,11 @@ export const getAcceleratorLoraChangeResult = (
}
// The recorded set is still running: leave everything the user tuned alone.
- if (isRecordedAcceleratorIntact(next, effectiveModel, models, config)) {
+ if (isRecordedAcceleratorIntact(next, model, models, config)) {
return { acceleratorLoras: null, outcome: 'unchanged', settings: next };
}
- const replacement = config.accelerator
- ? findAcceleratorAmong(effectiveModel, getEnabledLoraModels(next), models)
- : null;
+ const replacement = config.accelerator ? findAcceleratorAmong(model, getEnabledLoraModels(next), models) : null;
if (replacement && config.accelerator) {
return {
@@ -1094,46 +1087,81 @@ export const getVideoComponentSectionPolicy = (
return createComponentPolicy(model.format !== 'diffusers', slots);
}
- // MiniMax H3: a full Diffusers install bundles everything, so both slots
- // are optional single-file overrides (e.g. the int8 repacks). A slim
- // "components-only" install (tokenizer/processor/VAEs without transformer
- // or text-encoder weights — the backend probe records `components_only`)
- // REQUIRES both overrides: without this gate Invoke enables and the loader
- // fails minutes into the run.
- const componentsOnly = isComponentsOnlyH3Main(model);
+ // MiniMax H3. The top model selection carries the task identity (its variant
+ // decides the panel's generation mode); this section supplies what that
+ // selection does not bundle:
+ // - a single-file transformer checkpoint at top REQUIRES a Diffusers H3
+ // install in the Model Components slot (tokenizer/processor/VAEs come from
+ // it — full and components-only installs both qualify), plus the
+ // single-file Qwen3-VL encoder when that install is components-only;
+ // - a full Diffusers install at top bundles everything, so only the optional
+ // text-encoder override is offered.
+ if (model.format === 'diffusers') {
+ // A components-only install can still sit at top as legacy stored state
+ // (it is no longer selectable); validation steers the user to pick a
+ // single-file transformer as the model, and the encoder slot stays
+ // required so the panel keeps showing what the install cannot provide.
+ const componentsOnly = isComponentsOnlyH3Main(model);
+
+ return createComponentPolicy(componentsOnly, [
+ {
+ filter: (candidate) => candidate.type === 'qwen3_vl_encoder' && candidate.base === 'minimax-h3',
+ helpText: componentsOnly
+ ? 'Required: this install has no text-encoder weights, so the text encoder must come from a single-file Qwen3-VL checkpoint.'
+ : 'Optional single-file Qwen3-VL encoder used in place of the main model’s text encoder.',
+ key: 'h3TextEncoderModel',
+ label: 'Text encoder (single file)',
+ missingMessage: `${model.name} is a components-only install — select a single-file Text encoder.`,
+ modelTypes: ['qwen3_vl_encoder'],
+ required: componentsOnly ? () => true : undefined,
+ valueKind: 'component',
+ },
+ ]);
+ }
- return createComponentPolicy(componentsOnly, [
+ return createComponentPolicy(true, [
{
- // Both task variants stay pickable: selecting a Ref2VA transformer is HOW the panel
- // switches to reference-conditioned generation (the variant drives the effective
- // policy — see resolveEffectiveVideoModel).
filter: (candidate) =>
- candidate.type === 'main' && candidate.base === 'minimax-h3' && candidate.format === 'checkpoint',
- helpText: componentsOnly
- ? 'Required: this main model is a components-only install, so the transformer must come from a single-file checkpoint (e.g. pruned int8). Its task variant (FL2VA vs Ref2VA) decides the panel’s generation mode.'
- : 'Optional single-file transformer (e.g. pruned int8) used in place of the main model’s transformer. Its task variant (FL2VA vs Ref2VA) decides the panel’s generation mode.',
- key: 'h3TransformerModel',
- label: 'Transformer (single file)',
- missingMessage: `${model.name} is a components-only install — select a single-file Transformer.`,
+ candidate.type === 'main' && candidate.base === 'minimax-h3' && candidate.format === 'diffusers',
+ helpText:
+ 'Required: a Diffusers MiniMax H3 install (full or components-only) provides the tokenizer, processor, and VAEs the single-file transformer does not carry.',
+ key: 'componentSourceModel',
+ label: 'Model components',
+ missingMessage: `${model.name} is a single-file transformer — select a Diffusers MiniMax H3 install under Model Components.`,
modelTypes: ['main'],
- required: componentsOnly ? () => true : undefined,
+ required: () => true,
valueKind: 'main',
},
{
filter: (candidate) => candidate.type === 'qwen3_vl_encoder' && candidate.base === 'minimax-h3',
- helpText: componentsOnly
- ? 'Required: this main model is a components-only install, so the text encoder must come from a single-file Qwen3-VL checkpoint.'
- : 'Optional single-file Qwen3-VL encoder used in place of the main model’s text encoder.',
+ helpText:
+ 'Required when the Model Components install is components-only (no text-encoder weights); a full install provides its own.',
key: 'h3TextEncoderModel',
label: 'Text encoder (single file)',
- missingMessage: `${model.name} is a components-only install — select a single-file Text encoder.`,
+ missingMessage:
+ 'The selected Model Components install has no text-encoder weights — select a single-file Text encoder.',
modelTypes: ['qwen3_vl_encoder'],
- required: componentsOnly ? () => true : undefined,
+ required: (ctx) => !isH3TextEncoderSatisfied(ctx),
valueKind: 'component',
},
]);
};
+/** The H3 Diffusers install a checkpoint main draws its components from, if a valid one is selected. */
+const getH3ComponentSource = (ctx: VideoComponentPolicyContext): MainModelConfig | null => {
+ const source = ctx.settings.componentSourceModel;
+
+ return source && source.base === 'minimax-h3' && source.format === 'diffusers' ? source : null;
+};
+
+// A full Diffusers source carries text-encoder weights; a components-only one
+// does not, so the single-file Qwen3-VL override becomes required.
+const isH3TextEncoderSatisfied = (ctx: VideoComponentPolicyContext): boolean => {
+ const source = getH3ComponentSource(ctx);
+
+ return source !== null && !isComponentsOnlyH3Main(source);
+};
+
const getVideoComponentPolicyContext = (
model: MainModelConfig,
settings: VideoSettings
@@ -1294,11 +1322,10 @@ export const getVideoSettingsWithModelDefaults = (
].map((lora) => (isLoraCompatibleWithModel(lora.model, model) ? lora : { ...lora, isEnabled: false })),
modelKey: model.key,
numFrames: modelDefaults.numFrames,
- // Resetting nulls the transformer override, and the override is what makes Ref2VA
- // references consumable - keeping them would leave an orphaned list for the widget
- // sync to sweep away silently. Clearing here keeps the reset's effects in one place.
- // (Frame/source conditioning media stay untouched: they remain valid under the
- // default FL2VA policy.)
+ // A reset clears the references list along with the components: on an
+ // FL2VA model the orphaned list would otherwise linger for the widget
+ // sync to sweep away silently. (Frame/source conditioning media stay
+ // untouched: they remain valid under the FL2VA policy.)
references: modelDefaults.references,
steps: modelDefaults.steps,
targetResolution: modelDefaults.targetResolution,
@@ -1334,12 +1361,7 @@ export const getVideoModelSelectionResult = ({
model: MainModelConfig;
models: readonly ModelConfig[];
}): VideoModelSelectionResult => {
- // The transformer override can redefine the task (fl2va vs ref2va), so the policy comes
- // from the EFFECTIVE model. The override itself is reconciled at the end of this
- // transition; if it is dropped there, the caller re-runs selection through
- // getVideoTransformerSelectionResult on the next change anyway.
- const effectiveModel = resolveEffectiveVideoModel(model, currentSettings);
- const config = getVideoConfig(effectiveModel);
+ const config = getVideoConfig(model);
// A record without a modelKey was healed from a store the panel never
// seeded (a fresh project, or a pre-open "Send to Video" payload): its
// sampling values are the model-agnostic healing fallbacks, not user
@@ -1385,7 +1407,7 @@ export const getVideoModelSelectionResult = ({
addClearedLabel(clearedLabels, 'Target resolution');
}
- const snappedFrames = snapVideoNumFrames(effectiveModel, next.numFrames);
+ const snappedFrames = snapVideoNumFrames(model, next.numFrames);
if (snappedFrames !== next.numFrames) {
next.numFrames = snappedFrames;
@@ -1410,8 +1432,8 @@ export const getVideoModelSelectionResult = ({
// aimed at the other expert family) is the toggle re-applied — and when the
// new model has no accelerator, or its LoRAs are not installed, the fast
// path turns off, restoring the model's own steps/CFG.
- if (!isRecordedAcceleratorIntact(next, effectiveModel, models, config)) {
- const targetEntries = config.accelerator ? findAcceleratorLoraEntries(effectiveModel, models) : null;
+ if (!isRecordedAcceleratorIntact(next, model, models, config)) {
+ const targetEntries = config.accelerator ? findAcceleratorLoraEntries(model, models) : null;
const result = getAcceleratorToggleResult(next, model, models, targetEntries !== null);
Object.assign(next, result.settings);
@@ -1455,29 +1477,6 @@ export const getVideoModelSelectionResult = ({
return { clearedLabels, settings: next };
};
-/**
- * Canonical transition for the H3 transformer slot. The transformer decides the TASK
- * (fl2va's five modes vs ref2va's reference mode), so changing it must run the same
- * media/accelerator/frames reconciliation a model selection runs — with the new override
- * already in place so the effective policy is the new task's.
- */
-export const getVideoTransformerSelectionResult = ({
- currentSettings,
- model,
- models,
- transformer,
-}: {
- currentSettings: VideoSettings;
- model: MainModelConfig;
- models: readonly ModelConfig[];
- transformer: MainModelConfig | null;
-}): VideoModelSelectionResult =>
- getVideoModelSelectionResult({
- currentSettings: { ...currentSettings, h3TransformerModel: transformer },
- model,
- models,
- });
-
// ---------------------------------------------------------------------------
// Validation
@@ -1526,8 +1525,20 @@ export const getVideoValidationReasons = (model: MainModelConfig, settings: Vide
return ['Video needs a supported video model before it can be invoked.'];
}
- const effectiveModel = resolveEffectiveVideoModel(model, settings);
- const config = getVideoConfig(effectiveModel);
+ // Supported-but-not-selectable H3 shapes can reach the model slot as stored
+ // or recalled state; name the actual fix instead of failing downstream.
+ if (isComponentsOnlyH3Main(model)) {
+ return [
+ `${model.name} is a components-only install. Select a single-file MiniMax H3 transformer as the model; this install then provides its components.`,
+ ];
+ }
+ if (model.base === 'minimax-h3' && model.format === 'diffusers' && model.variant === 'ref2va') {
+ return [
+ `${model.name} is a Ref2VA folder install, whose transformer weights cannot be folder-loaded. Select a single-file Ref2VA transformer as the model; this install can serve as its Model Components.`,
+ ];
+ }
+
+ const config = getVideoConfig(model);
const reasons: string[] = [];
const mode = resolveVideoMode(settings);
const referenceOnly = config.modes.length === 1 && config.modes[0] === 'reference';
@@ -1590,7 +1601,7 @@ export const getVideoValidationReasons = (model: MainModelConfig, settings: Vide
}
}
- if (!isValidVideoNumFrames(effectiveModel, settings.numFrames)) {
+ if (!isValidVideoNumFrames(model, settings.numFrames)) {
reasons.push(
config.frames.kind === 'grid'
? `Frame count must be between ${config.frames.min} and ${config.frames.max} in steps of ${config.frames.step} (4·n + 1).`
@@ -1659,7 +1670,7 @@ export const getVideoValidationReasons = (model: MainModelConfig, settings: Vide
}
}
- if (!getVideoDimensions(effectiveModel, settings)) {
+ if (!getVideoDimensions(model, settings)) {
reasons.push(
model.base === 'minimax-h3'
? 'MiniMax H3 supports aspect ratios from 1:4 to 4:1. The conditioning media is outside that range.'
diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts
index 5cb4a8636e..39da4d01d9 100644
--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts
@@ -49,10 +49,11 @@ describe('createDefaultVideoWidgetValues', () => {
expect(values.steps).toBe(40);
});
- it('skips a checkpoint-format MiniMax H3 main (transformer override, not a main)', () => {
- const values = createDefaultVideoWidgetValues([h3Model('checkpoint')]);
-
- expect(values.model).toBeNull();
+ it('picks a single-file MiniMax H3 checkpoint but never a components-only install', () => {
+ // The checkpoint is the model identity now; the components-only folder
+ // belongs in the Model Components slot, not the top selector.
+ expect(createDefaultVideoWidgetValues([h3Model('checkpoint')]).model?.key).toBe(h3Model('checkpoint').key);
+ expect(createDefaultVideoWidgetValues([{ ...h3Model(), components_only: true }]).model).toBeNull();
});
it('turns the accelerator on when its LoRAs are installed', () => {
@@ -65,6 +66,28 @@ describe('createDefaultVideoWidgetValues', () => {
describe('syncVideoWidgetValuesWithModels', () => {
const model = wanModel('i2v_a14b', 'gguf_quantized');
+ it('promotes a legacy transformer override to the top model slot', () => {
+ // Pre model-positions persisted shape: the Diffusers install at top, the
+ // single-file transformer in the override slot. The transformer is the
+ // model identity now; the install stays on as its component source.
+ const install = h3Model();
+ const checkpoint = { ...h3Model('checkpoint', 'h3-ckpt'), name: 'MiniMax H3 Ref2VA (int8)', variant: 'ref2va' };
+ const stored = {
+ ...createDefaultVideoWidgetValues([install, checkpoint]),
+ h3TransformerModel: checkpoint,
+ model: install,
+ modelKey: install.key,
+ };
+ const synced = syncVideoWidgetValuesWithModels(stored, [install, checkpoint]);
+
+ expect(synced.model?.key).toBe(checkpoint.key);
+ expect(synced.modelKey).toBe(checkpoint.key);
+ expect(synced.componentSourceModel?.key).toBe(install.key);
+ expect(synced.h3TransformerModel).toBeNull();
+ // Stable: a second sync of the promoted value returns it untouched.
+ expect(syncVideoWidgetValuesWithModels(synced, [install, checkpoint])).toBe(synced);
+ });
+
it('returns the same object when nothing changed', () => {
const catalog = [model, WAN_VAE_16];
const values = { ...createDefaultVideoWidgetValues(catalog), vae: WAN_VAE_16 };
diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
index 8ab53bbad6..b1274666b4 100644
--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
@@ -17,7 +17,7 @@ import {
getVideoModes,
getVideoValidationReasons,
isSupportedVideoModel,
- resolveEffectiveVideoModel,
+ isVideoModelSelectable,
type VideoComponentPolicyContext,
type VideoComponentValueKey,
} from './videoPolicies';
@@ -33,7 +33,7 @@ import {
const EMPTY_ACCELERATOR_LORA_KEYS: string[] = [];
export const createDefaultVideoWidgetValues = (models: readonly ModelConfig[] = []): VideoWidgetValues => {
- const model = (models.find((candidate) => isSupportedVideoModel(candidate)) as MainModelConfig | undefined) ?? null;
+ const model = (models.find((candidate) => isVideoModelSelectable(candidate)) as MainModelConfig | undefined) ?? null;
return { ...getDefaultVideoSettings(model ?? undefined, models), model };
};
@@ -47,12 +47,32 @@ export const syncVideoWidgetValuesWithModels = (
values: VideoWidgetValues,
models: readonly ModelConfig[]
): VideoWidgetValues => {
+ // Legacy stored shape (pre model-positions): an H3 Diffusers install at top
+ // with the single-file transformer in the override slot. The transformer is
+ // the model identity now — promote it to the top slot and keep the install
+ // as its component source. Runs before anything reads `values.model`, so
+ // the whole sync (and its write-back) sees the new shape.
+ if (values.model?.base === 'minimax-h3' && values.model.format === 'diffusers' && values.h3TransformerModel) {
+ values = {
+ ...values,
+ componentSourceModel: values.model,
+ h3TransformerModel: null,
+ model: values.h3TransformerModel,
+ modelKey: values.h3TransformerModel.key,
+ };
+ }
+
const modelsByKey = new Map(models.map((model) => [model.key, model]));
const storedMain = values.model ? modelsByKey.get(values.model.key) : undefined;
+ // The stored main survives on the looser `isSupportedVideoModel` check: a
+ // legacy non-selectable shape (components-only install at top with no
+ // transformer to promote) keeps its slot and shows validation guidance
+ // instead of being silently swapped for another model. Auto-picks use the
+ // stricter selectable filter.
const model: MainModelConfig | null =
storedMain && isSupportedVideoModel(storedMain)
? storedMain
- : ((models.find((candidate) => isSupportedVideoModel(candidate)) as MainModelConfig | undefined) ?? null);
+ : ((models.find((candidate) => isVideoModelSelectable(candidate)) as MainModelConfig | undefined) ?? null);
// The main changed identity under us (nothing stored, or the stored model was
// uninstalled and another family got auto-picked): run the canonical
@@ -154,15 +174,11 @@ export const syncVideoWidgetValuesWithModels = (
wanT5EncoderModel: syncComponent('wanT5EncoderModel', base.wanT5EncoderModel),
};
- // The transformer decides the task: if the Ref2VA transformer was uninstalled (and the
- // slot re-resolved to null or an FL2VA file), the stored references are orphaned - the
- // effective policy no longer has a reference mode - so drop them, identity-preserving.
- if (next.references.length > 0 && model) {
- const effectiveModel = resolveEffectiveVideoModel(model, next);
-
- if (!getVideoModes(effectiveModel).includes('reference')) {
- next.references = [];
- }
+ // The model decides the task: if the Ref2VA transformer was uninstalled and
+ // another model got auto-picked, the stored references are orphaned — the
+ // policy no longer has a reference mode — so drop them, identity-preserving.
+ if (next.references.length > 0 && model && !getVideoModes(model).includes('reference')) {
+ next.references = [];
}
const isUnchanged =
diff --git a/invokeai/frontend/webv2/src/features/video/index.ts b/invokeai/frontend/webv2/src/features/video/index.ts
index 9a5262cec5..385c309972 100644
--- a/invokeai/frontend/webv2/src/features/video/index.ts
+++ b/invokeai/frontend/webv2/src/features/video/index.ts
@@ -67,7 +67,6 @@ export {
getVideoModelPolicy,
getVideoModelSelectionResult,
getVideoTargetResolutionOptions,
- getVideoTransformerSelectionResult,
getWanExpertWiringWarning,
getVideoModes,
getVideoPromptPolicy,
@@ -79,7 +78,6 @@ export {
isVideoModeSupported,
MINIMAX_H3_REF2V_TURBO_ACCELERATOR,
MINIMAX_H3_TURBO_ACCELERATOR,
- resolveEffectiveVideoModel,
snapVideoNumFrames,
SUPPORTED_VIDEO_BASES,
VIDEO_GENERATION,
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx
index db6c304e8c..a21210fdb5 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoComponentsSection.tsx
@@ -15,12 +15,10 @@ import { ModelSelect } from '@features/models/react';
import {
getVideoComponentSectionPolicy,
getVideoModelSelectionResult,
- getVideoTransformerSelectionResult,
getWanExpertWiringWarning,
} from '@features/video/core/videoPolicies';
import { Field } from '@platform/ui';
import { Button } from '@platform/ui/Button';
-import { toaster } from '@platform/ui/toaster';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -183,45 +181,11 @@ export const VideoComponentsSection = memo(function VideoComponentsSection({
values: VideoWidgetValues;
}) {
const { t } = useTranslation();
- const models = useModelsSelector((snapshot) => snapshot.models);
- const modelsLoaded = useModelsSelector((snapshot) => snapshot.status) === 'loaded';
const policy = useMemo(() => getVideoComponentSectionPolicy(values.model ?? undefined, values), [values]);
const ctx = useMemo<VideoComponentPolicyContext | null>(
() => (values.model ? { model: values.model, selectedComponents: values, settings: values } : null),
[values]
);
- // The H3 transformer slot decides the TASK (fl2va's five modes vs ref2va's reference
- // mode), so changing it must run the same reconciliation a model selection runs — media
- // the new task cannot consume is cleared, and the accelerator re-resolves to the task's
- // own Turbo distillation. Judged against a loaded catalog only, like the expert swap: a
- // transition computed against an empty catalog would strip the accelerator silently.
- const handlePatch = useCallback(
- (patch: Partial<VideoWidgetValues>) => {
- if ('h3TransformerModel' in patch && values.model && modelsLoaded) {
- const transformer = patch.h3TransformerModel ?? null;
- const result = getVideoTransformerSelectionResult({
- currentSettings: values,
- model: values.model,
- models,
- transformer,
- });
-
- onPatch({ ...result.settings });
- if (result.clearedLabels.length > 0) {
- toaster.create({
- description: t('widgets.video.settingsAdjustedDescription', {
- labels: result.clearedLabels.join(', '),
- }),
- title: t('widgets.video.settingsAdjusted'),
- type: 'info',
- });
- }
- return;
- }
- onPatch(patch);
- },
- [models, modelsLoaded, onPatch, t, values]
- );
if (!ctx || policy.slots.length === 0) {
return null;
@@ -240,7 +204,7 @@ export const VideoComponentsSection = memo(function VideoComponentsSection({
ctx={ctx}
slot={slot}
value={values[slot.key as VideoComponentValueKey]}
- onPatch={handlePatch}
+ onPatch={onPatch}
/>
))}
<WanExpertWiringNotice values={values} onPatch={onPatch} />
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
index 995c9bff50..e5e33cdebd 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
@@ -463,3 +463,68 @@ describe('ref2va reference recall', () => {
expect(result?.values.firstFrameImage).toBeNull();
});
});
+
+describe('model-position recall shapes', () => {
+ const install = h3Model();
+ const checkpoint: MainModelConfig = {
+ base: 'minimax-h3',
+ format: 'checkpoint',
+ key: 'h3-ref2va-ckpt',
+ name: 'MiniMax H3 Ref2VA Transformer (int8, pruned)',
+ type: 'main',
+ variant: 'ref2va',
+ };
+ const ref2vTurbo = {
+ base: 'minimax-h3',
+ key: 'ref2v-turbo',
+ name: 'MiniMax H3 Ref2V Turbo LoRA',
+ type: 'lora' as const,
+ };
+ const catalog = [install, checkpoint, ref2vTurbo];
+ const currentValues = { ...createDefaultVideoWidgetValues([install]) };
+
+ it('promotes a legacy transformer-override recording onto the model slot before deriving the accelerator', () => {
+ // Pre model-positions metadata: the Diffusers install as `model`, the
+ // checkpoint as an override extra. The 4-step Ref2V Turbo derivation only
+ // succeeds if the promote lands first — it needs the ref2va variant.
+ const result = buildVideoRecallSettings({
+ currentValues,
+ kind: 'all',
+ metadata: {
+ generation_mode: 'minimax_h3_ref2v',
+ loras: [{ model: { key: ref2vTurbo.key }, weight: 1 }],
+ minimax_h3_references: [{ detail: 'max', image_name: 'ref.png', kind: 'image' }],
+ minimax_h3_transformer_model: { key: checkpoint.key },
+ model: { key: install.key },
+ num_frames: 124,
+ steps: 4,
+ },
+ models: catalog,
+ });
+
+ expect(result?.values.model?.key).toBe(checkpoint.key);
+ expect(result?.values.componentSourceModel?.key).toBe(install.key);
+ expect(result?.values.h3TransformerModel).toBeNull();
+ expect(result?.values.modelKey).toBe(checkpoint.key);
+ expect(result?.values).toMatchObject({ acceleratorEnabled: true, acceleratorLoraKeys: [ref2vTurbo.key] });
+ });
+
+ it('recalls the recorded component source for a checkpoint-main recording', () => {
+ const result = buildVideoRecallSettings({
+ currentValues,
+ kind: 'all',
+ metadata: {
+ generation_mode: 'minimax_h3_ref2v',
+ minimax_h3_component_source: { key: install.key },
+ minimax_h3_references: [{ detail: 'max', image_name: 'ref.png', kind: 'image' }],
+ model: { key: checkpoint.key },
+ num_frames: 124,
+ },
+ models: catalog,
+ });
+
+ expect(result?.fields).toContain('model');
+ expect(result?.values.model?.key).toBe(checkpoint.key);
+ expect(result?.values.componentSourceModel?.key).toBe(install.key);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
index 591843cdc1..dbe2869a35 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
@@ -13,7 +13,6 @@ import {
getVideoAspectRatioOptions,
getVideoDimensions,
getVideoModelPolicy,
- resolveEffectiveVideoModel,
getVideoModelSelectionResult,
getVideoTargetResolutionOptions,
isSupportedVideoModel,
@@ -229,6 +228,7 @@ const VIDEO_COMPONENT_METADATA_KEYS = [
['wan_component_source', 'componentSourceModel'],
['transformer_low_noise', 'wanLowNoiseModel'],
['minimax_h3_transformer_model', 'h3TransformerModel'],
+ ['minimax_h3_component_source', 'componentSourceModel'],
['minimax_h3_text_encoder_model', 'h3TextEncoderModel'],
] as const;
@@ -280,15 +280,14 @@ export const deriveAcceleratorRecallState = (
steps: number,
settings: VideoWidgetValues
): Pick<VideoWidgetValues, 'acceleratorEnabled' | 'acceleratorLoraKeys'> => {
- // The H3 task variant lives on the recalled transformer override, and the two tasks have
- // DIFFERENT accelerators (fl2va Turbo at 6 steps, ref2v Turbo at 4) - so both the policy
- // and the expected-LoRA lookup must go through the effective model. Callers must recall
- // the component overrides into `settings` before deriving this.
- const effectiveModel = resolveEffectiveVideoModel(model, settings);
+ // The H3 task variant lives on the model itself (a single-file transformer
+ // checkpoint carries its own variant), and the two tasks have DIFFERENT
+ // accelerators (fl2va Turbo at 6 steps, ref2v Turbo at 4). Callers must
+ // promote a legacy transformer override onto `model` before deriving this.
const accelerator = getVideoModelPolicy(model, settings).ui.accelerator;
const recalled = accelerator
? findAcceleratorLorasIn(
- effectiveModel,
+ model,
loras.map((lora) => lora.model),
{ requireFamilyName: true }
)
@@ -455,7 +454,7 @@ export const buildVideoRecallSettings = ({
// all / remix from here on.
const recalledModel = getSupportedVideoMetadataModel(metadata, models);
- const model = recalledModel ?? values.model;
+ let model = recalledModel ?? values.model;
if (recalledModel && recalledModel.key !== values.model?.key) {
// The canonical family transition first, so frames/fps/resolution snap to
@@ -552,6 +551,24 @@ export const buildVideoRecallSettings = ({
fields.push('components');
}
+ // Legacy metadata shape (pre model-positions): `model` recorded as the H3
+ // Diffusers install with the single-file transformer as an override extra.
+ // The transformer is the model identity now — promote it, so the
+ // accelerator derivation below judges the right task, and keep the install
+ // as the component source.
+ if (model?.base === 'minimax-h3' && model.format === 'diffusers' && values.h3TransformerModel) {
+ const componentSource = model;
+
+ model = values.h3TransformerModel;
+ values = {
+ ...values,
+ componentSourceModel: componentSource,
+ h3TransformerModel: null,
+ model,
+ modelKey: model.key,
+ };
+ }
+
const recordedLoras = getMetadataLoras(metadata);
const resolvedLoras = recordedLoras.flatMap((entry) => {
const installed = models.find((candidate) => candidate.key === entry.key);