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
Merge branch 'refactor/invocations-by-architecture' into feat/webv2-server-driven-model-policies
Alexander Eichhorn4166106e44e7
diff --cc invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.tsindex b9e5b3482d,f0dbdb6884..7202df8374--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts@@@ -25,7 -25,8 +25,8 @@@ importgetSettingsWithModelDefaults,isReferenceImageSupported,isSupportedGenerateModel,- SUPPORTED_GENERATE_BASES,} from './baseGenerationPolicies';++import { SUPPORTED_GENERATE_BASES } from './supportedBases';const createModel = (base: string, overrides: Partial<MainModelConfig> = {}): MainModelConfig => ({base,@@@ -1196,33 -1243,3 +1197,60 @@@ describe('Krea-2, Ideogram 4 and Wan po).toEqual([]);});});++describe('the guidance slider value from a model record', () => {+ // MainModelDefaultSettings has separate cfg_scale and guidance fields; the UI has one control.+ // Which field feeds it depends on guidanceLabel, and getting that backwards reads a distilled+ // model's "CFG off" marker as its guidance setting.+ it('prefers guidance over cfg_scale for a guidance-labelled architecture', () => {+ const model = createModel('flux', {+ variant: 'dev',+ default_settings: { cfg_scale: 1, guidance: 3.5, steps: 28 },+ } as Partial<MainModelConfig>);++ // Not 1 — that is the CFG-off marker, and buildFluxGraph wires this value into `guidance`.+ expect(getDefaultGenerateSettings(model).cfgScale).toBe(3.5);+ });++ it('falls back to cfg_scale when a guidance-labelled model records no guidance', () => {+ const model = createModel('flux', {+ variant: 'schnell',+ default_settings: { cfg_scale: 1, steps: 4 },+ } as Partial<MainModelConfig>);++ expect(getDefaultGenerateSettings(model).cfgScale).toBe(1);+ });++ it('prefers cfg_scale for a CFG-labelled architecture', () => {+ const model = createModel('sdxl', { default_settings: { cfg_scale: 6.5, steps: 30 } } as Partial<MainModelConfig>);++ expect(getDefaultGenerateSettings(model).cfgScale).toBe(6.5);+ });++++ it('ignores a guidance a CFG-labelled model also records', () => {++ // `default_settings.guidance` is editable on *every* main model — it is in MAIN_FIELDS++ // unconditionally (`defaultSettingsFields.ts`), not gated on base. So an SDXL record can carry++ // one, and it must not displace the cfg_scale that base actually generates with. The case above++ // has only cfg_scale set and would pass either way round.++ const model = createModel('sdxl', {++ default_settings: { cfg_scale: 7, guidance: 4, steps: 30 },++ } as Partial<MainModelConfig>);++++ expect(getDefaultGenerateSettings(model).cfgScale).toBe(7);++ });++++ it('reads the right field for every base in the table', () => {++ // Swept rather than sampled: a base added to the capability table with the wrong label picks++ // the wrong field silently, and the three cases above only name three bases.++ for (const base of SUPPORTED_GENERATE_BASES) {++ const model = createModel(base, {++ default_settings: { cfg_scale: 7, guidance: 30 },++ } as Partial<MainModelConfig>);++ const label = getGenerationModelPolicy(model, createSettings(model)).ui.guidanceLabel;++++ expect(getDefaultGenerateSettings(model).cfgScale, `${base} (${label}) read the wrong field`).toBe(++ label === 'Guidance' ? 30 : 7++ );++ }++ });+});