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(webv2): accept anima-registered VAEs for Krea-2

joshistoastf5eca4b235de
diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
index 8aa7889496..fc2d257723 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
@@ -855,6 +855,48 @@ describe('Krea-2, Ideogram 4 and Wan policies', () => {
expect(reasons).toContain('Generate height must be a multiple of 16.');
});
+ it('accepts a Qwen-Image VAE registered under the anima base, as the backend loader does', () => {
+ // The same physical Qwen-Image VAE is registered as `anima` or `qwen-image` depending on
+ // which family it was installed for, and krea2_model_loader declares
+ // ui_model_base=[QwenImage, Anima]. Accepting only `qwen-image` hid a working VAE.
+ const animaRegisteredVae: VaeModelConfig = {
+ base: 'anima',
+ key: 'anima-qwen-vae',
+ name: 'Qwen VAE (installed for Anima)',
+ type: 'vae',
+ };
+ const checkpoint = createModel('krea-2', { format: 'checkpoint' });
+ const settings = createSettings(checkpoint, {
+ qwen3VLEncoderModel: qwen3VlEncoder,
+ vae: animaRegisteredVae,
+ });
+
+ expect(getGenerationValidationReasons(checkpoint, settings)).toEqual([]);
+
+ const slots = getComponentSectionPolicy(checkpoint, settings).slots;
+ const vaeSlotPolicy = slots.find((slot) => slot.key === 'vae');
+
+ // The picker filter and the validator must agree, or the dropdown hides a VAE that
+ // validation would then demand.
+ expect(
+ vaeSlotPolicy?.filter?.(animaRegisteredVae, {
+ model: checkpoint,
+ selectedComponents: { ...settings },
+ settings,
+ })
+ ).toBe(true);
+ });
+
+ it('still rejects a VAE from an unrelated family for Krea-2', () => {
+ const checkpoint = createModel('krea-2', { format: 'checkpoint' });
+ const reasons = getGenerationValidationReasons(
+ checkpoint,
+ createSettings(checkpoint, { qwen3VLEncoderModel: qwen3VlEncoder, vae: sdxlVae })
+ );
+
+ expect(reasons).toContain('Generate needs a VAE for non-Diffusers Krea-2 models.');
+ });
+
it('requires a VAE and Qwen3-VL encoder for a non-diffusers Krea-2 but not a diffusers one', () => {
const checkpoint = createModel('krea-2', { format: 'checkpoint' });
const missing = getGenerationValidationReasons(checkpoint, createSettings(checkpoint));
diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
index 3f6bec27fc..30e2b2f4d2 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
@@ -19,6 +19,7 @@ import {
getCompatibleDiffusersComponentSource,
isAnimaQwen3Encoder,
isAnimaVae,
+ isKrea2Vae,
isClipVariant,
isDiffusersMainForBase,
isFlux2DiffusersSourceForModel,
@@ -1024,7 +1025,7 @@ export const getComponentSectionPolicy = (
// both submodels must be selected. Diffusers models bundle them, hence optional there.
return createPolicy(model.format !== 'diffusers', [
{
- ...vaeSlot('Required for non-Diffusers Krea-2 models.', isVaeForBases(['qwen-image'])),
+ ...vaeSlot('Required for non-Diffusers Krea-2 models. Qwen-Image VAEs are used.', isKrea2Vae),
required: (ctx) => ctx.model.format !== 'diffusers',
missingMessage: 'Generate needs a VAE for non-Diffusers Krea-2 models.',
},
diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
index e9f60b712d..633ea9f978 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
@@ -98,6 +98,15 @@ export const getCompatibleDiffusersComponentSource = <T extends GenerateComponen
export const isAnimaVae = isVaeForBases(['anima', 'qwen-image', 'flux']);
+/**
+ * Krea-2 decodes with the Qwen-Image VAE (16-channel), which is why its graph reuses
+ * `qwen_image_l2i`. `anima` is accepted alongside `qwen-image` because the same physical VAE
+ * is registered under either base depending on which family it was installed for — matching
+ * `krea2_model_loader`'s own `ui_model_base=[QwenImage, Anima]`. Restricting this to
+ * `qwen-image` hides a working VAE that the backend would have accepted.
+ */
+export const isKrea2Vae = isVaeForBases(['qwen-image', 'anima']);
+
export const isVaeCompatibleWithGenerateModel = (model: GenerateModelConfig, vae: VaeModelConfig): boolean => {
if (model.type === 'external_image_generator') {
return false;
@@ -110,9 +119,8 @@ export const isVaeCompatibleWithGenerateModel = (model: GenerateModelConfig, vae
return isVaeForBases(['flux'])(vae);
case 'qwen-image':
return isVaeForBases(['qwen-image'])(vae);
- // Krea-2 decodes with the Qwen-Image VAE, which is why its graph reuses `qwen_image_l2i`.
case 'krea-2':
- return isVaeForBases(['qwen-image'])(vae);
+ return isKrea2Vae(vae);
case 'flux2':
return isVaeForBases(['flux2'])(vae);
default:
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
index 0ee8603978..df2362e63c 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
@@ -577,6 +577,23 @@ describe('Krea-2, Ideogram 4 and Wan graphs', () => {
});
});
+ it('sends an anima-registered Qwen-Image VAE to the Krea-2 loader', () => {
+ // Regression: the builder filtered VAEs to base `qwen-image`, so a Qwen-Image VAE
+ // installed under the `anima` base was dropped and the loader got no VAE at all.
+ const animaRegisteredVae: VaeModelConfig = {
+ base: 'anima',
+ key: 'anima-qwen-vae',
+ name: 'Qwen VAE (installed for Anima)',
+ type: 'vae',
+ };
+ const graph = compile(krea2Checkpoint, {
+ qwen3VLEncoderModel: qwen3VlEncoder,
+ vae: animaRegisteredVae,
+ });
+
+ expect(graph.nodes.model_loader).toMatchObject({ vae_model: animaRegisteredVae });
+ });
+
it('refuses to compile a non-diffusers Krea-2 with a missing submodel', () => {
// Validation runs ahead of the builder, so the user-facing reason surfaces rather than the
// builder's internal guard. Both layers exist; this pins which one the user actually sees.
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.ts
index 0084096ac9..b9b637ad01 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.ts
@@ -31,6 +31,7 @@ import {
isAnimaVae,
isFlux2Qwen3EncoderForModel,
isNonAnimaQwen3Encoder,
+ isKrea2Vae,
isVaeForBases,
} from './componentCompatibility';
import {
@@ -938,7 +939,10 @@ const buildKrea2Graph = (
// or GGUF) bundles neither VAE nor encoder, so both must be selected. A diffusers model
// carries them, and the loader extracts them when these are omitted.
const isDiffusers = model.format === 'diffusers';
- const vaeModel = getCompatibleVae(settings, ['qwen-image']);
+ // Same base set as the picker (`isKrea2Vae`) and the backend loader: a Qwen-Image VAE
+ // installed under the `anima` base is still the VAE Krea-2 wants. Narrowing it here would
+ // silently drop a VAE the user had legitimately selected.
+ const vaeModel = settings.vae && isKrea2Vae(settings.vae) ? settings.vae : null;
const qwen3VlEncoderModel = settings.qwen3VLEncoderModel;
if (!isDiffusers) {