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.

Merge branch 'main' into feat/krea2-edit-references-ui

Lincoln Steinb34a570e23fa
diff --cc docs/src/content/docs/Users Guide/04.Image Generation/generate-panel.mdx
index 9f4f6c6c37,3e52834059..742a48423f
--- a/docs/src/content/docs/Users Guide/04.Image Generation/generate-panel.mdx
+++ b/docs/src/content/docs/Users Guide/04.Image Generation/generate-panel.mdx
@@@ -128,8 -128,8 +129,8 @@@ What a reference does, and what option
| **FLUX.1** | An IP-Adapter, or a **FLUX Redux** model, which transfers the reference's content. | IP-Adapter options as above, or **Image influence** (Lowest to Highest) for Redux. |
| **Anima** (not Anima-3.8B) | An Anima IP-Adapter carries a character's appearance (hair, outfit, accessories) into the image. Up to four references (experimental); images of one character combine well, different characters blend. | **Strength** (0 to 2; 0 turns it off), per reference. Under **Advanced**: the IP-Adapter model and the **Active steps** range. |
| **FLUX.1 Kontext** | Kontext edits or recombines the reference images according to your prompt. | None beyond the model. |
- | **FLUX.2, Qwen Image Edit** | The model reads the references directly and uses them as your prompt instructs, for example *put the jacket from the first image on the person in the second*. | None. |
+ | **FLUX.2, Qwen Image Edit, Qwen-Image-2.1** | The model reads the references directly and uses them as your prompt instructs, for example *put the jacket from the first image on the person in the second*. | None. |
-| **Krea-2** | One reference's look — palette, texture, rendering — is transferred into the image while the prompt keeps driving the content; see [Krea-2](/users-guide/models/local-models/krea-2/#style-reference). | **Style strength** (0–2; 0 turns the reference off). |
+| **Krea-2** | **Style**: one reference's look — palette, texture, rendering — is transferred into the image while the prompt keeps driving the content. **Edit**: up to three references for an edit LoRA, such as a pose skeleton or a depth map, read in card order. See [Krea-2 style reference](/users-guide/models/local-models/krea-2/#style-reference) and [edit LoRAs](/users-guide/models/local-models/krea-2/#edit-loras-and-reference-images). | **Mode**: **Style** or **Edit**. **Style strength** (0–2; 0 turns the reference off) for Style. |
Reference images require an extra model for SD 1.5, SDXL, FLUX.1 and Anima (an IP-Adapter or FLUX Redux model). These are available as starter models in the Model Manager, and an installed IP-Adapter is selected automatically.
diff --cc invokeai/frontend/webv2/src/features/generation/core/__fixtures__/architectureCapabilities.json
index 053d248b39,1204c153c2..4599801f7b
--- a/invokeai/frontend/webv2/src/features/generation/core/__fixtures__/architectureCapabilities.json
+++ b/invokeai/frontend/webv2/src/features/generation/core/__fixtures__/architectureCapabilities.json
@@@ -571,8 -583,9 +583,9 @@@
"scheduler_set": "flow",
"scheduler_applies_to_graph": false,
"control_kinds": [],
- "max_reference_images": 1,
+ "max_reference_images": 3,
"reference_images_require_variant": null,
+ "reference_images_require_format": null,
"supports_regional_guidance": true,
"regional_negative": false,
"clip_skip_max": null,
@@@ -623,8 -636,9 +636,9 @@@
"scheduler_set": "flow",
"scheduler_applies_to_graph": false,
"control_kinds": [],
- "max_reference_images": 1,
+ "max_reference_images": 3,
"reference_images_require_variant": null,
+ "reference_images_require_format": null,
"supports_regional_guidance": true,
"regional_negative": false,
"clip_skip_max": null,
diff --cc invokeai/frontend/webv2/src/features/generation/core/__snapshots__/generateGraphNodeTypes.json
index 97d8cfdc41,ea3968d88f..dfcea3b309
--- a/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/generateGraphNodeTypes.json
+++ b/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/generateGraphNodeTypes.json
@@@ -698,9 -715,9 +723,10 @@@
"krea2_style_strength": [
1
],
+ "loras": [],
"mistral_encoder": [],
"model": [],
+ "moss_image_uncond_skip_layers": [],
"qwen_image_quantization": [
"nf4",
"none"
diff --cc invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
index 4a70422789,f3bb673eab..e239a3fae8
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
@@@ -27,15 -28,15 +27,17 @@@ import
getGenerationModelAvailabilityReasons,
getGenerationUiPolicy,
getGenerationValidationReasons,
+ getKrea2EditLoraState,
getMaxReferenceImages,
+ getMissingReferenceImageFormat,
getPromptPolicy,
getSchedulerOptions,
getSettingsWithModelDefaults,
isReferenceImageSupported,
isGenerateModelSelectable,
isSupportedGenerateModel,
+ QWEN_IMAGE_21_STANDALONE_ENCODER_REASON,
+ withAddedReferenceImages,
} from './baseGenerationPolicies';
import { SUPPORTED_GENERATE_BASES } from './supportedBases';
diff --cc invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
index ca515517ef,26b7ae1a2d..147154f516
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
@@@ -1424,6 -1447,14 +1479,10 @@@ const getFamilyDefaultReferenceImageCon
return { image, type: 'qwen_image_reference_image' };
}
- if (modelBase === 'krea-2') {
- return { image, styleStrength: DEFAULT_KREA2_STYLE_STRENGTH, type: 'krea2_reference_image' };
- }
-
+ if (modelBase === 'qwen-image-2-1') {
+ return { image, type: 'qwen_image_2_1_reference_image' };
+ }
+
if (isFluxKontextModel(model)) {
return { image, model, type: 'flux_kontext_reference_image' };
}
@@@ -1453,9 -1484,12 +1512,13 @@@ const getReferenceImageConfigSupported
return model.type !== 'external_image_generator' && model.base === 'flux2';
case 'qwen_image_reference_image':
return model.type !== 'external_image_generator' && model.base === 'qwen-image' && model.variant === 'edit';
+ case 'krea2_edit_reference_image':
case 'krea2_reference_image':
return model.type !== 'external_image_generator' && model.base === 'krea-2';
+ case 'qwen_image_2_1_reference_image':
+ return (
+ model.type !== 'external_image_generator' && model.base === 'qwen-image-2-1' && isReferenceImageSupported(model)
+ );
case 'flux_kontext_reference_image':
return isFluxKontextModel(model);
case 'flux_redux':
diff --cc invokeai/frontend/webv2/src/features/generation/core/settings.ts
index e6462cdb2e,aa5c72d1b5..0662391142
--- a/invokeai/frontend/webv2/src/features/generation/core/settings.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/settings.ts
@@@ -317,9 -348,9 +348,10 @@@ const REFERENCE_IMAGE_CONFIG_TYPES = ne
'flux_kontext_reference_image',
'flux_redux',
'ip_adapter',
+ 'krea2_edit_reference_image',
'krea2_reference_image',
'qwen_image_reference_image',
+ 'qwen_image_2_1_reference_image',
]);
const isClipVisionModel = (value: unknown): value is 'ViT-H' | 'ViT-G' | 'ViT-L' =>
@@@ -354,8 -385,8 +386,9 @@@ const normalizeReferenceImageConfig = (
switch (value.type) {
case 'external_reference_image':
case 'flux2_reference_image':
+ case 'krea2_edit_reference_image':
case 'qwen_image_reference_image':
+ case 'qwen_image_2_1_reference_image':
return { image, type: value.type };
case 'flux_kontext_reference_image':
return { image, model: getMainModelOrNull(value.model), type: value.type };
@@@ -426,9 -457,9 +459,10 @@@ const cloneReferenceImageConfig = (conf
switch (config.type) {
case 'external_reference_image':
case 'flux2_reference_image':
+ case 'krea2_edit_reference_image':
case 'krea2_reference_image':
case 'qwen_image_reference_image':
+ case 'qwen_image_2_1_reference_image':
return { ...config, image: config.image ? cloneCroppableImage(config.image) : null };
case 'flux_kontext_reference_image':
return {
@@@ -597,9 -629,9 +632,10 @@@ const syncReferenceImageConfigWithModel
}
case 'external_reference_image':
case 'flux2_reference_image':
+ case 'krea2_edit_reference_image':
case 'krea2_reference_image':
case 'qwen_image_reference_image':
+ case 'qwen_image_2_1_reference_image':
return config;
}
};
diff --cc invokeai/frontend/webv2/src/features/generation/core/types.ts
index cb05ea57f0,6cf8b3381e..6d5026ea68
--- a/invokeai/frontend/webv2/src/features/generation/core/types.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/types.ts
@@@ -167,11 -167,7 +167,12 @@@ export type GenerateReferenceImageConfi
| { type: 'qwen_image_reference_image'; image: GenerateReferenceImageAsset | null }
/** Krea-2 training-free style transfer: no adapter model, a single reference, `styleStrength` 0–2 (0 bypasses). */
| { type: 'krea2_reference_image'; image: GenerateReferenceImageAsset | null; styleStrength: number }
+ /**
+ * Krea-2 edit reference for ai-toolkit edit LoRAs, read by the encoder's vision tower and joined to the denoise as
+ * clean image tokens. Up to three, in list order; never combined with a style reference.
+ */
+ | { type: 'krea2_edit_reference_image'; image: GenerateReferenceImageAsset | null }
+ | { type: 'qwen_image_2_1_reference_image'; image: GenerateReferenceImageAsset | null }
| { type: 'external_reference_image'; image: GenerateReferenceImageAsset | null };
export interface GenerateReferenceImage {
diff --cc invokeai/frontend/webv2/src/features/generation/ui/GenerateGuidanceSection.tsx
index b759f5aec9,4043d29380..c2e611c73f
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateGuidanceSection.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateGuidanceSection.tsx
@@@ -1,8 -1,11 +1,12 @@@
import type { GenerationModelCatalogItem as ModelConfig } from '@features/generation/contracts';
import type { GenerateModelConfig, GenerateSettings, LoraModelConfig } from '@features/generation/core/types';
-import { Badge, Separator, Stack } from '@chakra-ui/react';
+import { Badge, Separator, Stack, Text } from '@chakra-ui/react';
- import { getKrea2EditLoraState, isReferenceImageSupported } from '@features/generation/core/baseGenerationPolicies';
+ import {
++ getKrea2EditLoraState,
+ getMissingReferenceImageFormat,
+ isReferenceImageSupported,
+ } from '@features/generation/core/baseGenerationPolicies';
import {
type GenerateDraft,
type GenerateSettingsUpdate,
@@@ -85,13 -88,9 +89,15 @@@ export const GenerateGuidanceSection =
onCommit={onReferenceCommit}
onCommitImmediate={onCommitImmediate}
/>
+ {/* Not blocking: the run works, but without an edit LoRA it only copies the references. */}
+ {getKrea2EditLoraState(selectedModel, settings) === 'noLora' ? (
+ <Text color="fg.warning" fontSize="xs" role="status" textWrap="pretty">
+ {t('widgets.generate.krea2EditReferencesNeedLora')}
+ </Text>
+ ) : null}
- {referenceImagesSupported || referenceImageCount > 0 ? <Separator borderColor="bg.subtle" /> : null}
+ {referenceImagesSupported || referenceImageCount > 0 || getMissingReferenceImageFormat(selectedModel) ? (
+ <Separator borderColor="bg.subtle" />
+ ) : null}
<GenerateConceptsContent
loraModels={loraModels}
loras={settings.loras}
diff --cc invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx
index 309cf4c978,94a7923149..ce47c5f809
--- a/invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx
@@@ -16,10 -16,11 +16,11 @@@ import { GalleryPickerPopover } from '@
import { isGalleryImageDragData, useGalleryImageDroppable } from '@features/gallery/utility';
import {
createReferenceImageId,
- getDefaultReferenceImageConfig,
getGenerationDimensions,
getMaxReferenceImages,
+ getMissingReferenceImageFormat,
isReferenceImageSupported,
+ withAddedReferenceImages,
} from '@features/generation/core/baseGenerationPolicies';
import { generatedImageToReferenceImage, getEffectiveReferenceImage } from '@features/generation/core/referenceImage';
import { clampDimension, deriveAspectRatioId, moveReferenceImage } from '@features/generation/core/settings';