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
feat(generate): more rebalance presets and a leaner model card
Josh Corbett73a791f11fef
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex d9b76f09e5..0825a3fffc 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -2007,7 +2007,6 @@"capabilitiesUnavailableForRecall": "Model capabilities are not loaded, so settings that depend on the model cannot be applied yet. Prompts and seed can. If loading failed, retry from the Generate panel.","capabilitiesUnavailableForSetup": "Model capabilities are not loaded, so this project cannot be set up for Generate yet. If loading failed, retry from the Generate panel.","cfgRescale": "CFG rescale",- "chooseModelToStart": "Choose a model to start","clearPromptTemplate": "Stop using this template","clearReferenceImages": "Remove all","clipSkip": "CLIP skip",@@ -2197,7 +2196,6 @@"moveReferenceImageDown": "Move reference image down","moveReferenceImageUp": "Move reference image up","moreRatios": "More aspect ratios",- "nativePx": "{{size}} px native","negativePrompt": "Negative prompt","negativePromptAdd": "Negative prompt…","negativePromptHide": "Turn off negative prompt",@@ -2326,7 +2324,6 @@"referenceImageModel": "Reference image model","referenceImages": "Reference images","referenceImagesUnsupported": "Reference images are not supported by the selected model.",- "referencesMax": "References ×{{count}}","removeConcept": "Remove concept","removeConceptNamed": "Remove {{name}}","removeReferenceImage": "Remove reference image",diff --git a/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.test.ts b/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.test.tsindex 7c4b035494..81774613d6 100644--- a/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.test.ts@@ -143,7 +143,17 @@ describe('getRebalanceSparklinePath', () => {describe('presets', () => {it('ships the backend defaults and a neutral pass', () => {- expect(BUILTIN_REBALANCE_PRESETS.map((preset) => preset.id)).toEqual(['default', 'neutral']);+ expect(BUILTIN_REBALANCE_PRESETS.map((preset) => preset.id)).toEqual([+ 'default',+ 'neutral',+ 'subtle',+ 'strong',+ 'early',+ 'late',+ ]);+ for (const preset of BUILTIN_REBALANCE_PRESETS) {+ expect(isValidKrea2RebalanceWeights(preset.weights), preset.id).toBe(true);+ }expect(BUILTIN_REBALANCE_PRESETS[0]?.weights).toBe(DEFAULT_KREA2_REBALANCE_WEIGHTS);expect(BUILTIN_REBALANCE_PRESETS[0]?.multiplier).toBe(DEFAULT_KREA2_REBALANCE_MULTIPLIER);expect(BUILTIN_REBALANCE_PRESETS[1]?.multiplier).toBe(1);diff --git a/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.ts b/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.tsindex 94dcae8552..f2a86ddf25 100644--- a/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/conditioningRebalance.ts@@ -157,9 +157,10 @@ export const NEUTRAL_KREA2_REBALANCE_WEIGHTS = Array.from({ length: KREA2_REBALA);/**- * Only curves with a basis in the backend ship as built-ins: the node's own defaults and- * a neutral pass. A named curve like "Detail" is a tuning claim, and nothing in this repo- * measures one — users save their own instead.+ * Built-ins are described by their shape, not by a tuning claim: the node's own+ * defaults, a neutral pass, the default curve scaled toward or away from+ * neutral, and curves that lean on the early or late taps. Nothing here+ * measures a look — users save their own curves for that.*/export const BUILTIN_REBALANCE_PRESETS: readonly RebalancePreset[] = [{@@ -174,6 +175,30 @@ export const BUILTIN_REBALANCE_PRESETS: readonly RebalancePreset[] = [multiplier: 1,weights: NEUTRAL_KREA2_REBALANCE_WEIGHTS,},+ {+ id: 'subtle',+ label: 'Subtle',+ multiplier: DEFAULT_KREA2_REBALANCE_MULTIPLIER,+ weights: '1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.75,3.0,1.05,2.5,1.0',+ },+ {+ id: 'strong',+ label: 'Strong',+ multiplier: DEFAULT_KREA2_REBALANCE_MULTIPLIER,+ weights: '1.0,1.0,1.0,1.0,1.0,1.0,1.0,3.75,7.5,1.15,6.0,1.0',+ },+ {+ id: 'early',+ label: 'Early layers',+ multiplier: DEFAULT_KREA2_REBALANCE_MULTIPLIER,+ weights: '4.0,3.0,2.0,1.5,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0',+ },+ {+ id: 'late',+ label: 'Late layers',+ multiplier: DEFAULT_KREA2_REBALANCE_MULTIPLIER,+ weights: '1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.5,2.0,3.0,4.0',+ },];const BUILTIN_REBALANCE_PRESET_IDS = new Set(BUILTIN_REBALANCE_PRESETS.map((preset) => preset.id));diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsxindex d8caaf956b..2b5bd675a1 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx@@ -1,17 +1,13 @@/* oxlint-disable react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-jsx-as-prop */import type { GenerationModelCatalogItem as ModelConfig } from '@features/generation/contracts';-import type { GenerateModelConfig, GenerateSettings, VaeModelConfig } from '@features/generation/core/types';+import type { GenerateModelConfig, GenerateSettings } from '@features/generation/core/types';-import { Badge, HStack, Stack, Text } from '@chakra-ui/react';+import { Stack, Text } from '@chakra-ui/react';import {getGenerateModelSelectionResult,- getGenerationDimensions,- getMaxReferenceImages,- getPromptPolicy,isGenerateModelSelectable,- isReferenceImageSupported,} from '@features/generation/core/baseGenerationPolicies';-import { isGenerateModelConfig, isVaeModelConfig } from '@features/generation/core/settings';+import { isGenerateModelConfig } from '@features/generation/core/settings';import { Button } from '@platform/ui/Button';import { ConfirmDialog } from '@platform/ui/ConfirmDialog';import { Field } from '@platform/ui/Field';@@ -19,7 +15,6 @@ import { useCallback, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';import { GenerationModelSelect as ModelSelect, useGenerationUi } from './GenerationUiContext';-import { countModelDefaultOverrides, getModelDefaultSettings } from './shared/modelDefaultSettings';const MAIN_MODEL_TYPES = ['main', 'external_image_generator'];@@ -58,44 +53,6 @@ export const GenerateModelCard = ({// confirm, and the labels shown come from a preview run of the same move.const [pendingSwitchModel, setPendingSwitchModel] = useState<GenerateModelConfig | null>(null);- const vaeModels = useMemo(- () => models.filter((model): model is ModelConfig & VaeModelConfig => isVaeModelConfig(model)),- [models]- );-- const overrideCount = useMemo(() => {- if (!selectedModel) {- return 0;- }-- return countModelDefaultOverrides(settings, getModelDefaultSettings(settings, selectedModel, vaeModels));- }, [selectedModel, settings, vaeModels]);-- /** What the model offers, in one quiet line: native size, then capabilities. */- const features = useMemo(() => {- if (!selectedModel) {- return [];- }-- const entries: string[] = [- t('widgets.generate.nativePx', { size: getGenerationDimensions(selectedModel).optimal }),- ];-- if (getPromptPolicy(selectedModel, settings).negativeVisible) {- entries.push(t('widgets.generate.negativePrompt'));- }-- if (isReferenceImageSupported(selectedModel)) {- entries.push(t('widgets.generate.referencesMax', { count: getMaxReferenceImages(selectedModel) }));- }-- if (selectedModel.type !== 'external_image_generator') {- entries.push(t('widgets.generate.concepts'));- }-- return entries;- }, [selectedModel, settings, t]);-const pendingSwitchClearedLabels = useMemo(() => {if (!pendingSwitchModel) {return [];@@ -141,18 +98,7 @@ export const GenerateModelCard = ({/></Field>- {selectedModel ? (- <HStack gap="2" justify="space-between">- <Text color="fg.muted" fontSize="2xs" minW="0">- {features.join(' · ')}- </Text>- {overrideCount > 0 ? (- <Badge flexShrink="0" size="xs" variant="surface">- {t('widgets.generate.overridesCount', { count: overrideCount })}- </Badge>- ) : null}- </HStack>- ) : isLoadingModels ? (+ {selectedModel ? null : isLoadingModels ? (<Text color="fg.muted" fontSize="2xs">{t('widgets.generate.loadingModels')}</Text>@@ -169,11 +115,7 @@ export const GenerateModelCard = ({{t('widgets.generate.openModelManager')}</Button></Stack>- ) : (- <Text color="fg.muted" fontSize="2xs">- {t('widgets.generate.chooseModelToStart')}- </Text>- )}+ ) : null}<ConfirmDialogbody={diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsxindex e2a6c3ab0e..9b5f349e71 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx@@ -1,7 +1,7 @@import type { GenerationModelCatalogItem as ModelConfig } from '@features/generation/contracts';import type { GenerateModelConfig, GenerateSettings, LoraModelConfig } from '@features/generation/core/types';-import { Stack } from '@chakra-ui/react';+import { Separator, Stack } from '@chakra-ui/react';import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';import { GenerateAdvancedFields } from './GenerateAdvancedFields';@@ -236,6 +236,9 @@ export const GenerateSettingsForm = ({onCommitSettings={commitSettingsImmediately}/>+ {/* The same hairline the collapsible sections draw between one another. */}+ <Separator />+<GeneratePromptFieldsprojectId={projectId}selectedModel={selectedModel}