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.

fix(ui): tighten the video accelerator reconcile after adversarial review

Lincoln Steinf14b3785e731
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 776dea0d39..22d554d3ca 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
@@ -413,8 +413,10 @@ describe('MiniMax H3 Turbo', () => {
expect(on).toMatchObject({ acceleratorEnabled: true, steps: 8 });
expect(on.acceleratorLoraKeys).toEqual([LIGHTX2V.key]);
- // The help text quotes the running LoRA's count, not the family default.
- expect(getVideoModelPolicy(model, on).ui.accelerator).toMatchObject({ label: 'Turbo', steps: 8 });
+ // The help text quotes the running LoRA's count; `ui.accelerator` stays the
+ // family config, so callers can still resolve other counts against it.
+ expect(getVideoModelPolicy(model, on).ui).toMatchObject({ acceleratorSteps: 8 });
+ expect(getVideoModelPolicy(model, on).ui.accelerator).toMatchObject({ label: 'Turbo', steps: 6 });
});
it('re-anchors the fast path on the other Turbo LoRA instead of tearing it down', () => {
@@ -436,52 +438,34 @@ describe('MiniMax H3 Turbo', () => {
expect(swapped.acceleratorLoras?.map((entry) => entry.key)).toEqual([TURBO.key]);
});
- it('adopts a Turbo LoRA the user enables on their own, and honors it on the next toggle', () => {
+ it('never arms an off fast path from a list edit, whatever lands in the list', () => {
const model = h3Model();
- const off = settingsFor(model);
-
- expect(off).toMatchObject({ acceleratorEnabled: false, steps: 50 });
-
- const adopted = getAcceleratorLoraChangeResult(off, model, H3_CATALOG, [
- { isEnabled: true, model: TURBO as never, weight: 1 },
- ]);
-
- expect(adopted.outcome).toBe('switched');
- expect(adopted.settings).toMatchObject({ acceleratorEnabled: true, steps: 6 });
- expect(adopted.settings.acceleratorLoraKeys).toEqual([TURBO.key]);
+ const turboRider = { base: 'minimax-h3', key: 'rider', name: 'Turbo Rider', type: 'lora' as const };
+ // A user's own H3 LoRA satisfies the family-name test as readily as a real
+ // repack does, and a hand-tuned step count must survive an unrelated edit.
+ const own = { base: 'minimax-h3', key: 'mine', name: 'My H3 Turbo Sharpener', type: 'lora' as const };
+ const off = settingsFor(model, { steps: 12 });
- // Toggling off drops the user's pick from the list, and toggling back on
- // is free to take the catalog's again.
- const cycled = getAcceleratorToggleResult(adopted.settings, model, H3_CATALOG, false).settings;
+ for (const candidate of [TURBO, LIGHTX2V, turboRider, own]) {
+ const result = getAcceleratorLoraChangeResult(off, model, H3_CATALOG, [
+ { isEnabled: true, model: candidate as never, weight: 1 },
+ ]);
- expect(cycled).toMatchObject({ acceleratorEnabled: false, steps: 50 });
- expect(cycled.loras).toEqual([]);
+ expect(result.outcome).toBe('unchanged');
+ expect(result.settings).toMatchObject({ acceleratorEnabled: false, steps: 12 });
+ }
});
- it('honors a Turbo LoRA the user already has enabled when the toggle goes on', () => {
+ it('installs the catalog Turbo LoRA on toggle-on, never a user LoRA that is merely H3-named', () => {
const model = h3Model();
- const withTurbo = settingsFor(model, { loras: [{ isEnabled: true, model: TURBO as never, weight: 1 }] });
- const on = getAcceleratorToggleResult(withTurbo, model, H3_CATALOG, true).settings;
+ const own = { base: 'minimax-h3', key: 'mine', name: 'My H3 Turbo Sharpener', type: 'lora' as const };
+ const withOwn = settingsFor(model, { loras: [{ isEnabled: true, model: own as never, weight: 0.4 }] });
+ const on = getAcceleratorToggleResult(withOwn, model, [TURBO, own], true).settings;
expect(on.acceleratorLoraKeys).toEqual([TURBO.key]);
expect(on.steps).toBe(6);
- });
-
- it('never adopts a look-alike LoRA, and never adopts at all on a background sync', () => {
- const model = h3Model();
- const turboRider = { base: 'minimax-h3', key: 'rider', name: 'Turbo Rider', type: 'lora' as const };
- const off = settingsFor(model);
-
- expect(
- getAcceleratorLoraChangeResult(off, model, H3_CATALOG, [
- { isEnabled: true, model: turboRider as never, weight: 0.8 },
- ]).outcome
- ).toBe('unchanged');
- expect(
- getAcceleratorLoraChangeResult(off, model, H3_CATALOG, [{ isEnabled: true, model: TURBO as never, weight: 1 }], {
- adopt: false,
- }).outcome
- ).toBe('unchanged');
+ // ...and the user's own entry keeps its weight rather than being co-opted.
+ expect(on.loras.find((entry) => entry.model.key === 'mine')?.weight).toBe(0.4);
});
it('keeps an oddly named Turbo LoRA running while it is the only one installed', () => {
@@ -524,6 +508,35 @@ describe('MiniMax H3 Turbo', () => {
expect(result.settings).toMatchObject({ acceleratorEnabled: true, steps: 9 });
});
+ it('stays intact through a duplicated LoRA entry, so an unchanged value reconciles to itself', () => {
+ const model = h3Model();
+ const on = getDefaultVideoSettings(model, [TURBO]);
+ // A hand-edited project file (or metadata whose graph listed one twice)
+ // can hold the same key twice; the flag must not read as broken.
+ const duplicated = [...on.loras, ...on.loras];
+ const once = getAcceleratorLoraChangeResult(on, model, [TURBO], duplicated);
+ const twice = getAcceleratorLoraChangeResult(once.settings, model, [TURBO], duplicated);
+
+ expect(once.outcome).toBe('unchanged');
+ expect(twice.outcome).toBe('unchanged');
+ expect(twice.settings.acceleratorLoraKeys).toBe(on.acceleratorLoraKeys);
+ });
+
+ it('rejects a Lightning pair that does not name the family, even with no family token to check', () => {
+ // The fallback variant has no variant string, so there is no token to
+ // demand — the list-scoped lookup must fail closed rather than accept any
+ // Lightning-named pair the user happens to hold.
+ const fallbackMain = wanModel('', 'gguf_quantized', 'wan-unprobed');
+ const mine = [
+ lora('Personal Lightning High Detail', null, 'myh'),
+ lora('Personal Lightning Low Detail', null, 'myl'),
+ ];
+
+ expect(findWanLightningLoraPair(mine, fallbackMain.variant, { requireFamilyName: true })).toBeNull();
+ // Unrestricted (the catalog question) it still resolves, as before.
+ expect(findWanLightningLoraPair(mine, fallbackMain.variant)).toMatchObject({ high: { key: 'myh' } });
+ });
+
it('swaps a T2V Lightning pair for the I2V one when the main changes family', () => {
const catalog = [LIGHTNING_T2V_HIGH, LIGHTNING_T2V_LOW, LIGHTNING_I2V_HIGH, LIGHTNING_I2V_LOW];
const t2v = wanModel('t2v_a14b');
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
index 7e5f9f3827..fc4a476cdd 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
@@ -421,21 +421,14 @@ export interface VideoModelPolicy {
fpsVisible: boolean;
/** The family's distillation fast path, or null when it has none. */
accelerator: VideoAcceleratorConfig | null;
+ /** Steps for the fast path as currently configured, or null when it has none. */
+ acceleratorSteps: number | null;
audioOutput: boolean;
};
}
export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings: VideoSettings): VideoModelPolicy => {
const config = getVideoConfig(model);
- // The step count the help text quotes is the one the *running* accelerator
- // LoRA was distilled for, not the family's reference count — with the
- // 8-step LightX2V Turbo LoRA on, "6 steps" would be a lie.
- const accelerator = config.accelerator
- ? {
- ...config.accelerator,
- steps: getAcceleratorSteps(config.accelerator, getRecordedAcceleratorLoras(settings)),
- }
- : null;
return {
aspectRatioOptions: getVideoAspectRatioOptions(model),
@@ -449,7 +442,15 @@ export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings
prompt: getVideoPromptPolicy(model, settings),
targetResolutions: config.targetResolutions,
ui: {
- accelerator,
+ accelerator: config.accelerator,
+ // The step count the help text quotes is the one the *running*
+ // accelerator LoRA was distilled for — with the 8-step LightX2V Turbo
+ // LoRA on, "6 steps" would be a lie. It is deliberately NOT folded into
+ // `accelerator`: that stays the family config, so callers can keep using
+ // it as the reference other counts are resolved against.
+ acceleratorSteps: config.accelerator
+ ? getAcceleratorSteps(config.accelerator, getRecordedAcceleratorLoras(settings))
+ : null,
audioOutput: config.audioOutput,
cfgLowNoiseVisible: config.cfg.lowNoiseVisible,
cfgVisible: config.cfg.visible,
@@ -492,7 +493,8 @@ const LOW_NOISE_PATTERN = /(?:^|[^a-z0-9])low(?:[^a-z0-9]|$)/i;
* `requireFamilyName` drops the fallback and demands the family token, so a
* T2V pair is not read as a valid accelerator for an I2V main — the question
* asked when the candidates are LoRAs already in the panel rather than the
- * catalog the toggle is free to pick from.
+ * catalog the toggle is free to pick from. With no family token to demand it
+ * matches nothing, leaving the answer to the catalog.
*/
export const findWanLightningLoraPair = (
models: readonly ModelConfig[],
@@ -511,9 +513,13 @@ export const findWanLightningLoraPair = (
const familyToken = typeof mainVariant === 'string' ? mainVariant.split('_')[0] : undefined;
const familyPattern = familyToken ? new RegExp(`(?:^|[^a-z0-9])${familyToken}(?:[^a-z0-9]|$)`, 'i') : null;
const score = (model: LoraModelConfig): number => (familyPattern?.test(model.name) ? 0 : 1);
+ // With `requireFamilyName` and no family token to check against (an unprobed
+ // Wan release on the fallback variant) there is nothing to verify, so this
+ // fails closed rather than accepting everything — the caller falls back to
+ // the catalog pick, which is a real answer.
const pick = (pattern: RegExp): LoraModelConfig | null =>
candidates
- .filter((model) => pattern.test(model.name) && (!requireFamilyName || !familyPattern || score(model) === 0))
+ .filter((model) => pattern.test(model.name) && (!requireFamilyName || score(model) === 0))
.sort((a, b) => score(a) - score(b))[0] ?? null;
const high = pick(HIGH_NOISE_PATTERN);
@@ -661,28 +667,30 @@ const isRecordedAcceleratorIntact = (
return false;
}
- const live = getEnabledLoraModels(settings).filter((lora) => recorded.has(lora.key));
+ // Deduplicated by key: a list holding the same LoRA twice (a hand-edited
+ // project file, metadata whose graph listed one twice) must not make this
+ // permanently false — the identity guarantee in `syncVideoWidgetValuesWithModels`
+ // depends on an unchanged value reaching the 'unchanged' outcome.
+ const live = [
+ ...new Map(
+ getEnabledLoraModels(settings)
+ .filter((lora) => recorded.has(lora.key))
+ .map((lora) => [lora.key, lora])
+ ).values(),
+ ];
return live.length === recorded.size && findAcceleratorAmong(model, live, models)?.length === recorded.size;
};
/**
* The accelerator LoRA entries for a model, or null when they are not
- * installed. A complete set the user already has enabled in the Concepts list
- * wins over the catalog pick: with two Turbo LoRAs installed, the toggle must
- * honor the one the user chose rather than swapping in its own.
+ * installed. Deliberately catalog-only: the family name test is all that
+ * separates a distillation LoRA from any other, and "MiniMax H3 …" is how a
+ * user names their OWN H3 LoRA too, so letting the panel's list steer this
+ * would let the toggle arm itself on a LoRA with no distillation in it.
*/
-const findAcceleratorLoraEntries = (
- model: MainModelConfig,
- models: readonly ModelConfig[],
- settings?: Pick<VideoSettings, 'loras'>
-): GenerateLora[] | null => {
- const chosen =
- (settings ? findAcceleratorLorasIn(model, getEnabledLoraModels(settings), { requireFamilyName: true }) : null) ??
- findAcceleratorLorasIn(model, models);
-
- return chosen?.map((lora) => ({ isEnabled: true, model: lora, weight: 1 })) ?? null;
-};
+const findAcceleratorLoraEntries = (model: MainModelConfig, models: readonly ModelConfig[]): GenerateLora[] | null =>
+ findAcceleratorLorasIn(model, models)?.map((lora) => ({ isEnabled: true, model: lora, weight: 1 })) ?? null;
export interface AcceleratorToggleResult {
settings: VideoSettings;
@@ -722,7 +730,7 @@ export const getAcceleratorToggleResult = (
};
}
- const entries = findAcceleratorLoraEntries(model, models, { loras: withoutAccelerators });
+ const entries = findAcceleratorLoraEntries(model, models);
if (!entries) {
// Never leave the flag claiming a fast path that has no LoRAs behind it.
@@ -772,30 +780,32 @@ export interface AcceleratorLoraChangeResult {
* sampling defaults: a silent 6-step run with no distillation LoRA behind it
* just reads as a broken model.
*
- * `adopt` lets an explicit user edit turn the fast path ON when the list gains
- * a complete accelerator set. Background catalog reconciliation passes false,
- * so a stored off-with-a-Turbo-LoRA state is never rewritten behind the user's
- * back — only repaired when it was on.
+ * Strictly a repair of a fast path that is already ON. An off accelerator is
+ * never armed by a list edit, however accelerator-shaped the LoRA that lands
+ * in it looks: the name heuristic cannot tell a distillation release from a
+ * user's own "… Turbo …" LoRA, and arming on it would silently drop a
+ * hand-tuned step count onto a LoRA that does not support it.
*/
export const getAcceleratorLoraChangeResult = (
settings: VideoSettings,
model: MainModelConfig,
models: readonly ModelConfig[],
- loras: GenerateLora[],
- { adopt = true }: { adopt?: boolean } = {}
+ loras: GenerateLora[]
): AcceleratorLoraChangeResult => {
const config = getVideoConfig(model);
const next: VideoSettings = { ...settings, loras };
+ // Nothing to repair, and nothing this function is allowed to start.
+ if (!settings.acceleratorEnabled) {
+ return { acceleratorLoras: null, outcome: 'unchanged', settings: next };
+ }
+
// The recorded set is still running: leave everything the user tuned alone.
if (isRecordedAcceleratorIntact(next, model, models, config)) {
return { acceleratorLoras: null, outcome: 'unchanged', settings: next };
}
- const replacement =
- config.accelerator && (settings.acceleratorEnabled || adopt)
- ? findAcceleratorAmong(model, getEnabledLoraModels(next), models)
- : null;
+ const replacement = config.accelerator ? findAcceleratorAmong(model, getEnabledLoraModels(next), models) : null;
if (replacement && config.accelerator) {
return {
@@ -812,10 +822,6 @@ export const getAcceleratorLoraChangeResult = (
};
}
- if (!settings.acceleratorEnabled) {
- return { acceleratorLoras: null, outcome: 'unchanged', settings: next };
- }
-
return {
acceleratorLoras: null,
outcome: 'disabled',
@@ -1312,7 +1318,7 @@ export const getVideoModelSelectionResult = ({
// 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, model, models, config)) {
- const targetEntries = config.accelerator ? findAcceleratorLoraEntries(model, models, next) : null;
+ const targetEntries = config.accelerator ? findAcceleratorLoraEntries(model, models) : null;
const result = getAcceleratorToggleResult(next, model, models, targetEntries !== null);
Object.assign(next, result.settings);
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 ede35338f3..5cb4a8636e 100644
--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts
@@ -72,6 +72,24 @@ describe('syncVideoWidgetValuesWithModels', () => {
expect(syncVideoWidgetValuesWithModels(values, catalog)).toBe(values);
});
+ it('clears the accelerator flag when no video main is left installed', () => {
+ // `loras` empties out with the model, so a surviving flag would record keys
+ // that are not in the list — a record the persistence validator rejects.
+ const h3 = h3Model();
+ const turbo = { base: 'minimax-h3', key: 'turbo', name: 'MiniMax H3 Turbo LoRA', type: 'lora' as const };
+ const values = createDefaultVideoWidgetValues([h3, turbo as never]);
+
+ expect(values).toMatchObject({ acceleratorEnabled: true });
+
+ const synced = syncVideoWidgetValuesWithModels(values, [turbo as never]);
+
+ expect(synced).toMatchObject({ acceleratorEnabled: false, model: null });
+ expect(synced.acceleratorLoraKeys).toEqual([]);
+ expect(synced.loras).toEqual([]);
+ // Still stable: a second sync of the cleared value returns it untouched.
+ expect(syncVideoWidgetValuesWithModels(synced, [turbo as never])).toBe(synced);
+ });
+
it('falls back to an installed supported main when the stored one is gone', () => {
const replacement = wanModel('t2v_a14b');
const values = createDefaultVideoWidgetValues([model]);
diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
index e8091c26ee..f82fb9f7a0 100644
--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts
@@ -27,6 +27,9 @@ import {
* validation the invoke route consumes, and seed resolution at submit.
*/
+// Shared empty array, so clearing already-clear keys keeps its identity.
+const EMPTY_ACCELERATOR_LORA_KEYS: string[] = [];
+
export const createDefaultVideoWidgetValues = (models: readonly ModelConfig[] = []): VideoWidgetValues => {
const model = (models.find((candidate) => isSupportedVideoModel(candidate)) as MainModelConfig | undefined) ?? null;
@@ -99,27 +102,41 @@ export const syncVideoWidgetValuesWithModels = (
// back. Clearing only the flag would leave steps 4 / CFG 1 with no
// distillation LoRA — a silent run that reads as a broken model.
//
- // `adopt: false`: a catalog sync runs on every render and on mount, so it
- // may only repair a fast path the user turned on, never start one.
- const acceleratorSync = model ? getAcceleratorLoraChangeResult(base, model, models, loras, { adopt: false }) : null;
- const accelerator =
- acceleratorSync && acceleratorSync.outcome !== 'unchanged'
- ? {
- acceleratorEnabled: acceleratorSync.settings.acceleratorEnabled,
- acceleratorLoraKeys: acceleratorSync.settings.acceleratorLoraKeys,
- cfgScale: acceleratorSync.settings.cfgScale,
- cfgScaleLowNoise: acceleratorSync.settings.cfgScaleLowNoise,
- steps: acceleratorSync.settings.steps,
- }
- : // Reuse the stored values whenever nothing changed — the identity
- // guarantee below depends on `acceleratorLoraKeys` keeping its array.
- {
- acceleratorEnabled: base.acceleratorEnabled,
- acceleratorLoraKeys: base.acceleratorLoraKeys,
- cfgScale: base.cfgScale,
- cfgScaleLowNoise: base.cfgScaleLowNoise,
- steps: base.steps,
- };
+ // The reconcile only ever repairs a fast path that is already on, so a sync
+ // running on every render cannot arm one behind the user's back.
+ //
+ // Reuse the stored values whenever nothing changed — the identity guarantee
+ // below depends on `acceleratorLoraKeys` keeping its array.
+ const unchangedAccelerator = {
+ acceleratorEnabled: base.acceleratorEnabled,
+ acceleratorLoraKeys: base.acceleratorLoraKeys,
+ cfgScale: base.cfgScale,
+ cfgScaleLowNoise: base.cfgScaleLowNoise,
+ steps: base.steps,
+ };
+ const acceleratorSync = model ? getAcceleratorLoraChangeResult(base, model, models, loras) : null;
+ let accelerator = unchangedAccelerator;
+
+ if (!model) {
+ // No video main at all: `loras` above is empty, so a surviving flag would
+ // name keys that are not in the list — a record `isVideoSettings` rejects
+ // on reload. There is no model to take sampling defaults from.
+ if (base.acceleratorEnabled || base.acceleratorLoraKeys.length > 0) {
+ accelerator = {
+ ...unchangedAccelerator,
+ acceleratorEnabled: false,
+ acceleratorLoraKeys: EMPTY_ACCELERATOR_LORA_KEYS,
+ };
+ }
+ } else if (acceleratorSync && acceleratorSync.outcome !== 'unchanged') {
+ accelerator = {
+ acceleratorEnabled: acceleratorSync.settings.acceleratorEnabled,
+ acceleratorLoraKeys: acceleratorSync.settings.acceleratorLoraKeys,
+ cfgScale: acceleratorSync.settings.cfgScale,
+ cfgScaleLowNoise: acceleratorSync.settings.cfgScaleLowNoise,
+ steps: acceleratorSync.settings.steps,
+ };
+ }
const next: VideoWidgetValues = {
...base,
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
index 32b1d7e337..452f472587 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
@@ -247,13 +247,13 @@ export const VideoWidgetView = () => {
);
const setLoras = useCallback(
(loras: VideoWidgetValues['loras']) => {
- // The fast path follows the list: a different complete accelerator set
- // in it re-anchors the toggle onto that set at its own step count, and
- // losing the last one turns the toggle off and restores the model's own
- // sampling defaults (the accelerator wrote steps/CFG). Either way the
- // user's list edit stands, and either way they are told — a silent
- // 6-step run with no distillation LoRA behind it just looks like a
- // broken model.
+ // While the fast path is on it follows the list: a different complete
+ // accelerator set in it re-anchors the toggle onto that set at its own
+ // step count, and losing the last one turns the toggle off and restores
+ // the model's own sampling defaults (the accelerator wrote steps/CFG).
+ // Either way the user's list edit stands, and either way they are told —
+ // a silent 6-step run with no distillation LoRA behind it just looks
+ // like a broken model. An off accelerator is never armed from here.
if (!values.model) {
patch({ loras });
return;
@@ -502,7 +502,7 @@ export const VideoWidgetView = () => {
<Field
helpText={t('widgets.video.acceleratorHelp', {
label: policy.ui.accelerator.label,
- steps: policy.ui.accelerator.steps,
+ steps: policy.ui.acceleratorSteps ?? policy.ui.accelerator.steps,
})}
label={t('widgets.video.accelerator', { label: policy.ui.accelerator.label })}
>
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 d2e086d8e9..12129af9ce 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.test.ts
@@ -137,6 +137,32 @@ describe('deriveAcceleratorRecallState', () => {
});
});
+ it('reads the step count off the recalled LoRAs, not off what the panel is running', () => {
+ // A panel already running an 8-step Turbo LoRA must not shift the step
+ // count a 6-step one is checked against.
+ const turbo = { base: 'minimax-h3', key: 'turbo', name: 'MiniMax H3 Turbo LoRA', type: 'lora' as const };
+ const lightx2v = {
+ base: 'minimax-h3',
+ key: 'lightx2v',
+ name: 'MiniMax H3 LightX2V Turbo LoRA',
+ type: 'lora' as const,
+ };
+ const model = h3Model();
+ const running = {
+ ...createDefaultVideoWidgetValues([model, lightx2v as never]),
+ acceleratorEnabled: true,
+ acceleratorLoraKeys: [lightx2v.key],
+ loras: [{ isEnabled: true, model: lightx2v as never, weight: 1 }],
+ steps: 8,
+ };
+ const recalled = [{ isEnabled: true, model: turbo as never, weight: 1 }];
+
+ expect(deriveAcceleratorRecallState(model, recalled, 6, running)).toEqual({
+ acceleratorEnabled: true,
+ acceleratorLoraKeys: [turbo.key],
+ });
+ });
+
it('stays off at non-accelerator steps or with a partial pair', () => {
expect(deriveAcceleratorRecallState(WAN_T2V, pairEntries, 40, settings)).toEqual({
acceleratorEnabled: false,