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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): restore sampling defaults when the catalog sync breaks the accelerator
Lincoln Stein53f36f966bbe
diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.tsindex df0a1358f3..c89a1a5096 100644--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.test.ts@@ -109,12 +109,17 @@ describe('syncVideoWidgetValuesWithModels', () => {const enabled = getAcceleratorToggleResult(createDefaultVideoWidgetValues([model]), model, catalog, true).settings;const values = { ...enabled, model };- // The pair vanishes from the catalog: entries drop, flag clears with them.+ // The pair vanishes from the catalog: entries drop, flag clears with them,+ // and the sampling params Lightning wrote (steps 4 / CFG 1) are restored+ // to the model's own defaults — clearing only the flag would leave a+ // silent 4-step non-distilled setup.const synced = syncVideoWidgetValuesWithModels(values, [model]);expect(synced.loras).toEqual([]);expect(synced.acceleratorEnabled).toBe(false);expect(synced.acceleratorLoraKeys).toEqual([]);+ expect(synced.steps).toBe(40);+ expect(synced.cfgScale).toBe(5);});});diff --git a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts b/invokeai/frontend/webv2/src/features/video/core/widgetValues.tsindex 24bdeb5426..65d3cb03a2 100644--- a/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts+++ b/invokeai/frontend/webv2/src/features/video/core/widgetValues.ts@@ -12,6 +12,7 @@ import {getDefaultVideoSettings,getVideoComponentSectionPolicy,getVideoModelAvailabilityReasons,+ getVideoModelPolicy,getVideoModelSelectionResult,getVideoValidationReasons,isSupportedVideoModel,@@ -99,9 +100,23 @@ export const syncVideoWidgetValuesWithModels = (// Reuse the stored array whenever the content is unchanged — the identity// guarantee below depends on it.const acceleratorLoraKeys = acceleratorAlive || base.acceleratorLoraKeys.length === 0 ? base.acceleratorLoraKeys : [];+ // Losing a pair member through the catalog (uninstalled, dropped as+ // incompatible) tears the fast path down the same way the Concepts setter+ // does: flag off AND the model's own sampling defaults restored. Clearing+ // only the flag would leave steps 4 / CFG 1 with no distillation pair — a+ // silent run that reads as a broken model.+ const samplingDefaults =+ base.acceleratorEnabled && !acceleratorAlive && model ? getVideoModelPolicy(model, base).defaults : null;const next: VideoWidgetValues = {...base,+ ...(samplingDefaults+ ? {+ cfgScale: samplingDefaults.cfgScale,+ cfgScaleLowNoise: samplingDefaults.cfgScaleLowNoise,+ steps: samplingDefaults.steps,+ }+ : {}),acceleratorEnabled: acceleratorAlive,acceleratorLoraKeys,componentSourceModel: syncComponent('componentSourceModel', base.componentSourceModel),