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.

test(generate): cover output filters and shift override edges; tidy shift field

Josh Corbett013a70e831e0
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx
index 9bad2647f8..aae0692f43 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/krea-2.mdx
@@ -137,11 +137,11 @@ it if you like), and set **Style strength**. The reference applies to Generate a
the workflow editor the same thing is the **Style Reference - Krea-2** node, feeding the **Style Reference**
input of **Denoise - Krea-2**.
-- **Style Strength** is the one knob you need. `1.0` is the recommended setting; the slider goes to `2.0`
+- **Style strength** is the one knob you need. `1.0` is the recommended setting; the slider goes to `2.0`
for a heavier effect. `0` disables the reference entirely and costs nothing.
- The remaining node inputs (block range, key/value scaling, AdaIN strengths) are for tuning and should be
- left at their defaults. Style Strength already modulates several of them.
-- The reference image and its Style Strength are recorded in image metadata, so **Recall All** and **Remix
+ left at their defaults. Style strength already modulates several of them.
+- The reference image and its Style strength are recorded in image metadata, so **Recall All** and **Remix
Image** restore them along with the rest of the recipe.
:::caution[One reference, matching size, roughly 2x runtime]
diff --git 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
index 3b2f1fb14b..4cc49c7bcf 100644
--- 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
@@ -49,7 +49,7 @@ The **Seed** sets the starting noise for the image. The same model, prompt, seed
Some families add their own controls to the Render section:
-* **DyPE** (FLUX.1) — position extrapolation for sizes above the 1024px training resolution. **Auto** turns it on above 1536px, **Area** by image area and **4K** is a fixed tuning; **Manual** exposes the **scale (λs)** and **exponent (λt)**.
+* **DyPE** (FLUX.1) — position extrapolation for sizes above the 1024px training resolution. **Auto** turns it on above 1536px, **Area** by image area and **4K optimized** is a fixed tuning; **Manual** exposes the **scale (λs)** and **exponent (λt)**.
* **Shift** (Z-Image, Qwen Image) — an override for the sampling schedule's timestep shift. Left on auto, the model derives it from the image size; Lightning LoRAs are trained for `3`.
* **Seed variance** (Krea-2, Z-Image) — perturbs the prompt conditioning so nearby seeds give more varied images; **Variance strength** and **Randomized channels** set how much.
* **Conditioning rebalance** (Krea-2) and **CFG (Low)** (Wan) — see the model's page under Local Models.
diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.ts
index a923b6c1b4..09a5791e61 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.test.ts
@@ -1146,6 +1146,23 @@ describe('compileCanvasGraph — output filters', () => {
expect(metadataTarget(backendGraph)).toBe('canvas_output');
});
+ it('runs a lone watermark as the staged outpaint result', () => {
+ const { backendGraph } = compile(sd1Model, 'outpaint', {
+ destination: 'canvas',
+ projectSettings: { useWatermark: true },
+ });
+
+ expect(backendGraph.nodes.canvas_decode?.type).toBe('invokeai_img_blend');
+ expect(backendGraph.nodes.canvas_img_nsfw).toBeUndefined();
+ expect(backendGraph.nodes.canvas_output).toMatchObject({ is_intermediate: true, type: 'img_watermark' });
+ expect(
+ backendGraph.edges.find(
+ (edge) => edge.destination.node_id === 'canvas_output' && edge.destination.field === 'image'
+ )?.source.node_id
+ ).toBe('canvas_decode');
+ expect(metadataTarget(backendGraph)).toBe('canvas_output');
+ });
+
it('leaves every mode untouched while both filters are off', () => {
for (const mode of ['txt2img', 'img2img', 'inpaint', 'outpaint'] as const) {
const { backendGraph } = compile(sd1Model, mode, {
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 c2ba83cac5..2891dc7871 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
@@ -1447,8 +1447,12 @@ describe('output filters', () => {
/** The graph without its minted ids, so two compilations of one recipe compare equal. */
const structure = (graph: ReturnType<typeof compile>) => stabilizeBackendGraphIds(graph);
+ // The committed node-type contract (`__snapshots__/generateGraphNodeTypes.json`, checked against the backend
+ // registry) is the guard on what a default recipe emits; this only pins that the filter switches themselves are
+ // inert at their defaults. Metadata does record the new tuning keys at defaults (`z_image_shift: 'auto'` etc.),
+ // as legacy did.
it.each(generateGraphCases)(
- '$label compiles the same graph when the filters are left at their defaults',
+ '$label emits no filter nodes and the same structure whether the filter settings are omitted or off',
({ base, shape }) => {
const { model, settings } = satisfiedSettingsFor(base, shape);
const plain = compileGenerateGraph(settings, model, 'gallery', { useCpuNoise: true }).backendGraph;
diff --git a/invokeai/frontend/webv2/src/features/generation/core/settings.ts b/invokeai/frontend/webv2/src/features/generation/core/settings.ts
index 0ee900aec6..0aaad447d2 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/settings.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/settings.ts
@@ -237,7 +237,11 @@ export const isFluxDypePreset = (value: unknown): value is FluxDypePreset =>
export const isQwenImageEncoderQuantization = (value: unknown): value is QwenImageEncoderQuantization =>
QWEN_IMAGE_ENCODER_QUANTIZATIONS.includes(value as QwenImageEncoderQuantization);
-/** A shift override, kept only inside the node's bounds; anything else means auto. */
+/**
+ * A shift override, kept only inside the node's bounds. Anything else means auto rather than a clamped value: null is
+ * the legacy sentinel for "let the node derive it", and silently clamping a stray value would turn auto recipes into
+ * fixed ones.
+ */
const getTimestepShift = (value: unknown): number | null =>
typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= MAX_TIMESTEP_SHIFT ? value : null;
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.browser.test.tsx
index 7c807c11fc..f63972e633 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.browser.test.tsx
@@ -497,8 +497,11 @@ describe('GenerateRenderSection model-family tuning', () => {
expect(onCommit).toHaveBeenCalledWith({ zImageShift: 3 });
await settle(() => root?.unmount());
- await render(zImageModel, { zImageShift: 2.5 });
+ const onOverriddenCommit = await render(zImageModel, { zImageShift: 2.5 });
expect(slidersNamed('Shift')[0]?.getAttribute('aria-valuenow')).toBe('2.5');
+ // Turning the override off hands the shift back to the node, rather than leaving the last value in place.
+ await settle(() => switchNamed('Override')?.querySelector<HTMLElement>('[data-part="control"]')?.click());
+ expect(onOverriddenCommit).toHaveBeenCalledWith({ zImageShift: null });
await settle(() => root?.unmount());
const onQwenCommit = await render(qwenImageModel);
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx
index 8ff6e249c0..ca584b172f 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx
@@ -65,6 +65,7 @@ const STEPS_SLIDER_MAX = 100;
/** The useful shift range; the input accepts the node's full `ge=0` span up to 10. */
const TIMESTEP_SHIFT_SLIDER_MIN = 1;
const TIMESTEP_SHIFT_SLIDER_MAX = 7;
+const TIMESTEP_SHIFT_MARKS = [{ label: String(DEFAULT_TIMESTEP_SHIFT), value: DEFAULT_TIMESTEP_SHIFT }];
/** The exponent's `le=1000` bound is far beyond any documented recipe (0.5–2), so the track stops at 10. */
const DYPE_EXPONENT_SLIDER_MAX = 10;
const formatPercent = (value: number): string => `${value}%`;
@@ -440,14 +441,13 @@ const TimestepShiftField = ({
onCheckedChange={(checked) => onChange(checked ? DEFAULT_TIMESTEP_SHIFT : null)}
/>
{shift !== null ? (
- <ScrubberField
- defaultValue={DEFAULT_TIMESTEP_SHIFT}
- inputMax={MAX_TIMESTEP_SHIFT}
- inputMin={0}
- label={t('widgets.generate.timestepShift')}
- marks={[DEFAULT_TIMESTEP_SHIFT]}
+ <SliderNumberField
+ ariaLabel={t('widgets.generate.timestepShift')}
+ marks={TIMESTEP_SHIFT_MARKS}
max={TIMESTEP_SHIFT_SLIDER_MAX}
min={TIMESTEP_SHIFT_SLIDER_MIN}
+ numberInputMax={MAX_TIMESTEP_SHIFT}
+ numberInputMin={0}
step={0.1}
value={shift}
onChange={onChange}
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.test.ts b/invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.test.ts
index bc908830ed..fda6f07bb2 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.test.ts
@@ -1303,6 +1303,35 @@ describe('model-family tuning recall', () => {
});
});
+describe('Krea-2 style reference without an image', () => {
+ it('recalls the rest of the record and leaves reference images alone', () => {
+ const result = buildImageRecallSettings({
+ currentValues: createValues(),
+ image,
+ kind: 'all',
+ metadata: {
+ krea2_style_strength: 1.4,
+ model: { key: krea2Model.key },
+ ref_images: [
+ {
+ config: { image: null, styleStrength: 1.4, type: 'krea2_style_reference_image' },
+ id: 'style',
+ isEnabled: true,
+ },
+ ],
+ steps: 8,
+ },
+ models: [],
+ supportedModels: [krea2Model],
+ vaeModels: [],
+ });
+
+ expect(result?.fields).toEqual(expect.arrayContaining(['model', 'steps']));
+ expect(result?.fields).not.toContain('referenceImages');
+ expect(result?.values.referenceImages).toEqual([]);
+ });
+});
+
/** Remix from the metadata a fully filled graph records, starting from SDXL defaults. */
const remixRoundTrip = ({ base, shape }: (typeof generateGraphCases)[number]) => {
const { filled, model, settings } = fullyFilledSettingsFor(base, shape);
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
index 53ce8ff6f7..8b270005ad 100644
--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
@@ -450,6 +450,13 @@ const primeGenerate = (
const submitGenerate = (state: WorkbenchState) =>
workbenchReducer(state, { backendSupportsCancellation: true, type: 'submitInvocationSnapshot' });
+const getQueuedOutputNode = (state: WorkbenchState) => {
+ const submission = getActiveProject(state).queue.items[0]?.snapshot.backendSubmission;
+ const nodes = submission?.kind === 'invalid' ? {} : (submission?.graph.nodes ?? {});
+
+ return nodes.canvas_output;
+};
+
const getQueuedRandDevice = (state: WorkbenchState): unknown => {
const submission = getActiveProject(state).queue.items[0]?.snapshot.backendSubmission;
const nodes = submission?.kind === 'invalid' ? {} : (submission?.graph.nodes ?? {});
@@ -471,6 +478,35 @@ const createUpscaleModel = (key: string, type: string, base: string, name = key)
type,
});
+describe('project output filters', () => {
+ it('queues the NSFW checker as the generate output when the project turns it on', () => {
+ const initial = workbenchReducer(createInitialWorkbenchState(), {
+ settings: { useNsfwChecker: true },
+ type: 'setActiveProjectSettings',
+ });
+ const state = workbenchReducer(primeGenerate(initial), {
+ backendSupportsCancellation: true,
+ route: { destination: 'gallery', destinationLocked: false, sourceId: 'generate', sourceLocked: false },
+ projectId: initial.activeProjectId,
+ type: 'submitResolvedInvocationSnapshot',
+ });
+
+ expect(getQueuedOutputNode(state)).toMatchObject({ is_intermediate: false, type: 'img_nsfw' });
+ });
+
+ it('queues the plain decode while the filters are off', () => {
+ const initial = createInitialWorkbenchState();
+ const state = workbenchReducer(primeGenerate(initial), {
+ backendSupportsCancellation: true,
+ route: { destination: 'gallery', destinationLocked: false, sourceId: 'generate', sourceLocked: false },
+ projectId: initial.activeProjectId,
+ type: 'submitResolvedInvocationSnapshot',
+ });
+
+ expect(getQueuedOutputNode(state)?.type).toBe('l2i');
+ });
+});
+
describe('generation-device orchestration metadata', () => {
it('passes the XPU runtime snapshot through the generate submission boundary', () => {
generationDeviceMock.options = [{ device: 'xpu:0', name: 'Intel Arc' }];