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 remote-tracking branch 'origin/main' into feat/parity-model-tuning
Josh Corbetta95dff0986e7
diff --cc invokeai/frontend/webv2/src/features/generation/core/__snapshots__/animaLLLiteCanvasGraphs.jsonindex 9ac9888b19,8315b8ad6b..0818e63c4c--- a/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/animaLLLiteCanvasGraphs.json+++ b/invokeai/frontend/webv2/src/features/generation/core/__snapshots__/animaLLLiteCanvasGraphs.json@@@ -204,12 -685,552 +685,552 @@@},{"destination": {- "field": "mask",- "node_id": "expand_mask"+ "field": "mask",+ "node_id": "expand_mask"+ },+ "source": {+ "field": "expanded_mask_area",+ "node_id": "create_gradient_mask"+ }+ },+ {+ "destination": {+ "field": "layer_upper",+ "node_id": "canvas_output"+ },+ "source": {+ "field": "image",+ "node_id": "canvas_l2i"+ }+ },+ {+ "destination": {+ "field": "mask",+ "node_id": "canvas_output"+ },+ "source": {+ "field": "image",+ "node_id": "expand_mask"+ }+ },+ {+ "destination": {+ "field": "control_lllite",+ "node_id": "denoise_latents"+ },+ "source": {+ "field": "collection",+ "node_id": "control_lllite_collector"+ }+ },+ {+ "destination": {+ "field": "item",+ "node_id": "control_lllite_collector"+ },+ "source": {+ "field": "control",+ "node_id": "anima_lllite_sketch-layer"+ }+ },+ {+ "destination": {+ "field": "item",+ "node_id": "control_lllite_collector"+ },+ "source": {+ "field": "control",+ "node_id": "anima_lllite_depth-layer"+ }+ },+ {+ "destination": {+ "field": "item",+ "node_id": "control_lllite_collector"+ },+ "source": {+ "field": "control",+ "node_id": "anima_lllite_pose-layer"+ }+ }+ ],+ "id": "anima_lllite_canvas",+ "nodes": {+ "negative_prompt": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "negative_prompt",+ "type": "string"+ },+ "positive_prompt": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "positive_prompt",+ "type": "string"+ },+ "seed": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "seed",+ "type": "integer"+ },+ "model_loader": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "model_loader",+ "model": {+ "base": "anima",+ "key": "anima-model",+ "name": "Anima",+ "type": "main",+ "hash": "blake3:anima"+ },+ "qwen3_encoder_model": {+ "base": "any",+ "key": "qwen3",+ "name": "Qwen3 Encoder",+ "type": "qwen3_encoder",+ "variant": "qwen3_06b",+ "hash": "blake3:qwen3"+ },+ "type": "anima_model_loader",+ "vae_model": {+ "base": "qwen-image",+ "key": "qwen-vae",+ "name": "Qwen VAE",+ "type": "vae",+ "hash": "blake3:vae"+ }+ },+ "pos_cond": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "pos_cond",+ "type": "anima_text_encoder"+ },+ "pos_cond_collect": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "pos_cond_collect",+ "type": "collect"+ },+ "neg_cond": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "neg_cond",+ "type": "anima_text_encoder"+ },+ "neg_cond_collect": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "neg_cond_collect",+ "type": "collect"+ },+ "denoise_latents": {+ "is_intermediate": true,+ "use_cache": true,+ "denoising_end": 1,+ "denoising_start": 0.4,+ "guidance_scale": 4.5,+ "height": 1024,+ "id": "denoise_latents",+ "scheduler": "euler",+ "steps": 35,+ "type": "anima_denoise",+ "width": 768+ },+ "core_metadata_0_i": {+ "is_intermediate": true,+ "use_cache": true,+ "cfg_scale": 4.5,+ "cfg_rescale_multiplier": 0,+ "generation_mode": "anima_inpaint",+ "height": 1024,+ "id": "core_metadata_0_i",+ "model": {+ "base": "anima",+ "key": "anima-model",+ "name": "Anima",+ "type": "main",+ "hash": "blake3:anima"+ },+ "rand_device": "cpu",+ "scheduler": "euler",+ "seamless_x": false,+ "seamless_y": false,+ "steps": 35,+ "type": "core_metadata",+ "vae": {+ "base": "qwen-image",+ "key": "qwen-vae",+ "name": "Qwen VAE",+ "type": "vae",+ "hash": "blake3:vae"+ },+ "width": 768,+ "qwen3_encoder": {+ "base": "any",+ "key": "qwen3",+ "name": "Qwen3 Encoder",+ "type": "qwen3_encoder",+ "variant": "qwen3_06b",+ "hash": "blake3:qwen3"+ },+ "clip_skip": 0,+ "strength": 0.6+ },+ "canvas_i2l": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "canvas_i2l",+ "type": "anima_i2l",+ "image": {+ "image_name": "canvas-composite.png"+ }+ },- "canvas_l2i": {- "is_intermediate": true,- "use_cache": false,- "id": "canvas_l2i",- "type": "anima_l2i"- },+ "create_gradient_mask": {+ "is_intermediate": true,+ "use_cache": true,+ "coherence_mode": "Gaussian Blur",+ "edge_radius": 16,+ "fp32": false,+ "id": "create_gradient_mask",+ "image": {+ "image_name": "canvas-composite.png"+ },+ "minimum_denoise": 0,+ "type": "create_gradient_mask",+ "mask": {+ "image_name": "canvas-mask.png"+ }+ },+ "expand_mask": {+ "is_intermediate": true,+ "use_cache": true,+ "fade_size_px": 16,+ "id": "expand_mask",+ "type": "expand_mask_with_fade"+ },++ "canvas_l2i": {++ "is_intermediate": true,++ "use_cache": false,++ "id": "canvas_l2i",++ "type": "anima_l2i"++ },+ "canvas_output": {+ "is_intermediate": true,+ "use_cache": false,- "id": "canvas_output",+ "layer_base": {+ "image_name": "canvas-composite.png"+ },- "type": "invokeai_img_blend"++ "type": "invokeai_img_blend",++ "id": "canvas_output"+ },+ "anima_lllite_sketch-layer": {+ "is_intermediate": true,+ "use_cache": true,+ "begin_step_percent": 0,+ "control_model": {+ "base": "anima",+ "hash": "blake3:sketch",+ "key": "sketch",+ "name": "sketch",+ "type": "controlnet"+ },+ "end_step_percent": 0.9,+ "id": "anima_lllite_sketch-layer",+ "image": {+ "image_name": "sketch-layer-composite.png"+ },+ "type": "anima_lllite",+ "weight": 0.8+ },+ "control_lllite_collector": {+ "is_intermediate": true,+ "use_cache": true,+ "id": "control_lllite_collector",+ "type": "collect"+ },+ "anima_lllite_depth-layer": {+ "is_intermediate": true,+ "use_cache": true,+ "begin_step_percent": 0,+ "control_model": {+ "base": "anima",+ "hash": "blake3:depth",+ "key": "depth",+ "name": "depth",+ "type": "controlnet"+ },+ "end_step_percent": 0.9,+ "id": "anima_lllite_depth-layer",+ "image": {+ "image_name": "depth-layer-composite.png"+ },+ "type": "anima_lllite",+ "weight": -1+ },+ "anima_lllite_pose-layer": {+ "is_intermediate": true,+ "use_cache": true,+ "begin_step_percent": 0,+ "control_model": {+ "base": "anima",+ "hash": "blake3:pose",+ "key": "pose",+ "name": "pose",+ "type": "controlnet"+ },+ "end_step_percent": 0.9,+ "id": "anima_lllite_pose-layer",+ "image": {+ "image_name": "pose-layer-composite.png"+ },+ "type": "anima_lllite",+ "weight": 2+ }+ }+ },+ "outpaint_inpaint_adapter_and_control_layer": {+ "edges": [+ {+ "destination": {+ "field": "transformer",+ "node_id": "denoise_latents"+ },+ "source": {+ "field": "transformer",+ "node_id": "model_loader"+ }+ },+ {+ "destination": {+ "field": "qwen3_encoder",+ "node_id": "pos_cond"+ },+ "source": {+ "field": "qwen3_encoder",+ "node_id": "model_loader"+ }+ },+ {+ "destination": {+ "field": "vae",+ "node_id": "canvas_l2i"+ },+ "source": {+ "field": "vae",+ "node_id": "model_loader"+ }+ },+ {+ "destination": {+ "field": "prompt",+ "node_id": "pos_cond"+ },+ "source": {+ "field": "value",+ "node_id": "positive_prompt"+ }+ },+ {+ "destination": {+ "field": "item",+ "node_id": "pos_cond_collect"+ },+ "source": {+ "field": "conditioning",+ "node_id": "pos_cond"+ }+ },+ {+ "destination": {+ "field": "positive_conditioning",+ "node_id": "denoise_latents"+ },+ "source": {+ "field": "collection",+ "node_id": "pos_cond_collect"+ }+ },+ {+ "destination": {+ "field": "qwen3_encoder",+ "node_id": "neg_cond"+ },+ "source": {+ "field": "qwen3_encoder",+ "node_id": "model_loader"+ }+ },+ {+ "destination": {+ "field": "prompt",+ "node_id": "neg_cond"+ },+ "source": {+ "field": "value",+ "node_id": "negative_prompt"+ }+ },+ {+ "destination": {+ "field": "item",+ "node_id": "neg_cond_collect"+ },+ "source": {+ "field": "conditioning",+ "node_id": "neg_cond"+ }+ },+ {+ "destination": {+ "field": "negative_conditioning",+ "node_id": "denoise_latents"+ },+ "source": {+ "field": "collection",+ "node_id": "neg_cond_collect"+ }+ },+ {+ "destination": {+ "field": "seed",+ "node_id": "denoise_latents"+ },+ "source": {+ "field": "value",+ "node_id": "seed"+ }+ },+ {+ "destination": {+ "field": "latents",+ "node_id": "canvas_l2i"+ },+ "source": {+ "field": "latents",+ "node_id": "denoise_latents"+ }+ },+ {+ "destination": {+ "field": "seed",+ "node_id": "core_metadata_0_i"+ },+ "source": {+ "field": "value",+ "node_id": "seed"+ }+ },+ {+ "destination": {+ "field": "positive_prompt",+ "node_id": "core_metadata_0_i"+ },+ "source": {+ "field": "value",+ "node_id": "positive_prompt"+ }+ },+ {+ "destination": {+ "field": "negative_prompt",+ "node_id": "core_metadata_0_i"+ },+ "source": {+ "field": "value",+ "node_id": "negative_prompt"+ }+ },+ {+ "destination": {+ "field": "metadata",+ "node_id": "canvas_output"+ },+ "source": {+ "field": "metadata",+ "node_id": "core_metadata_0_i"+ }+ },+ {+ "destination": {+ "field": "mask2",+ "node_id": "mask_combine"+ },+ "source": {+ "field": "image",+ "node_id": "image_alpha_to_mask"+ }+ },+ {+ "destination": {+ "field": "image",+ "node_id": "canvas_i2l"+ },+ "source": {+ "field": "image",+ "node_id": "infill"+ }+ },+ {+ "destination": {+ "field": "vae",+ "node_id": "canvas_i2l"+ },+ "source": {+ "field": "vae",+ "node_id": "model_loader"+ }+ },+ {+ "destination": {+ "field": "latents",+ "node_id": "denoise_latents"+ },+ "source": {+ "field": "latents",+ "node_id": "canvas_i2l"+ }+ },+ {+ "destination": {+ "field": "mask",+ "node_id": "create_gradient_mask"+ },+ "source": {+ "field": "image",+ "node_id": "mask_combine"+ }+ },+ {+ "destination": {+ "field": "vae",+ "node_id": "create_gradient_mask"+ },+ "source": {+ "field": "vae",+ "node_id": "model_loader"+ }+ },+ {+ "destination": {+ "field": "denoise_mask",+ "node_id": "denoise_latents"+ },+ "source": {+ "field": "denoise_mask",+ "node_id": "create_gradient_mask"+ }+ },+ {+ "destination": {+ "field": "image",+ "node_id": "invert_anima_inpaint_adapter_mask"},"source": {- "field": "expanded_mask_area",- "node_id": "create_gradient_mask"+ "field": "image",+ "node_id": "mask_combine"}},{diff --cc invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.tsindex 1bb3ddaa51,b3bf6a0114..f57ebb0435--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts@@@ -57,10 -58,9 +58,11 @@@ import} from './pid';import {clampDimension,+ DEFAULT_ANIMA_INPAINT_ADAPTER_WEIGHT,DEFAULT_HIDIFFUSION_T1_RATIO,DEFAULT_HIDIFFUSION_T2_RATIO,+ DEFAULT_FLUX_DYPE_EXPONENT,+ DEFAULT_FLUX_DYPE_SCALE,DEFAULT_IDEOGRAM4_SAMPLER_PRESET,DEFAULT_KREA2_REBALANCE_MULTIPLIER,DEFAULT_KREA2_REBALANCE_WEIGHTS,diff --cc invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.tsindex 1f7cf4da4b,39082c7264..4260197de7--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts@@@ -5,19 -5,15 +5,21 @@@import type { SupportedGenerateBase } from '@features/generation/core/baseGenerationPolicies';import type { BackendGraphContract, BackendInvocationContract } from '@features/generation/core/contracts';- import type { GenerateModelConfig, GenerateSettings } from '@features/generation/core/types';+ import type { ComponentModelConfig, GenerateModelConfig, GenerateSettings } from '@features/generation/core/types';import { getGenerationValidationReasons } from '@features/generation/core/baseGenerationPolicies';- import { GRAPH_BUILDERS } from '@features/generation/core/graph';+ import { findVaeSource, GRAPH_BUILDERS } from '@features/generation/core/graph';-import { addEdge, addNode, toGraphContract } from '@features/generation/core/graphBuilder';+import {+ addEdge,+ addNode,+ addOutputPostprocessors,+ replaceCanvasOutput,+ toGraphContract,+} from '@features/generation/core/graphBuilder';import { addKrea2ConditioningEnhancers } from '@features/generation/core/krea2Conditioning';- import { getIsPidSupportedBase } from '@features/generation/core/pid';+ import { getIsPidActive } from '@features/generation/core/pid';+ import { shouldUsePidDecode } from '@features/generation/core/pidGraph';+ import { MAX_ANIMA_INPAINT_ADAPTER_WEIGHT, MIN_ANIMA_INPAINT_ADAPTER_WEIGHT } from '@features/generation/core/settings';import type {CanvasCompositingSettings,@@@ -132,6 -175,38 +181,18 @@@ const requireVaeSource = (graph: Backenreturn source;};+ /** The size the base graph denoises at: the `noise` node carries it for SD families, the denoise node elsewhere. */+ const getDenoiseSize = (graph: BackendGraphContract, denoise: BackendInvocationContract): CanvasSize => {+ const { height, width } = graph.nodes.noise ?? denoise;+ if (typeof width !== 'number' || typeof height !== 'number') {+ throw new TypeError('Canvas generation could not read the denoise size from the base graph.');+ }+ return { height, width };+ };++ const findMetadataNode = (graph: BackendGraphContract): BackendInvocationContract | undefined =>+ Object.values(graph.nodes).find((node) => node.type === 'core_metadata');+-/** Rename every matching node ID and edge reference. */-const renameNode = (graph: BackendGraphContract, oldId: string, newId: string): BackendInvocationContract => {- const node = graph.nodes[oldId];- if (!node) {- throw new Error(`Canvas generation could not find the "${oldId}" node to rename.`);- }- delete graph.nodes[oldId];- node.id = newId;- graph.nodes[newId] = node;- for (const edge of graph.edges) {- if (edge.source.node_id === oldId) {- edge.source.node_id = newId;- }- if (edge.destination.node_id === oldId) {- edge.destination.node_id = newId;- }- }- return node;-};-/** Resizes a model-grid processing output back to the bbox's exact final footprint. */const resizeCanvasOutputToBbox = (graph: BackendGraphContract,@@@ -143,8 -220,21 +206,17 @@@return;}+ // Retarget PiD Fit's resize so the output is resampled once, straight to the bbox (legacy parity), rather+ // than through the processing size.+ const terminalResize = graph.nodes.canvas_output;+ if (isPidFit && terminalResize?.type === 'img_resize') {+ terminalResize.width = bbox.width;+ terminalResize.height = bbox.height;+ return;+ }+- const processingOutput = renameNode(graph, 'canvas_output', 'canvas_processing_output');- processingOutput.is_intermediate = true;-- const output = addNode(graph, {+ const { output, retired } = replaceCanvasOutput(graph, 'canvas_processing_output', {height: bbox.height,- id: 'canvas_output',is_intermediate: destination === 'canvas',type: 'img_resize',use_cache: false,@@@ -303,16 -451,16 +426,18 @@@ const graftMaskTail =/** Either a fixed mask image field or an edge-fed source node. */gradientMaskImage?: { image_name: string };gradientMaskEdge?: { node: BackendInvocationContract; field: string };+ /** The raster image the Anima inpaint adapter conditions on; the composite itself when absent. */+ adapterImageEdge?: { node: BackendInvocationContract; field: string };}): void => {- const { compositing, denoise, destination, i2lType, initialImageName, settings, vaeSource } = args;+ const { compositing, denoise, destination, i2lType, initialImageName, model, settings, vaeSource } = args;const needsResize = !sizesMatch(args.bbox, args.processingSize);- // The final output owns canvas_output; the base decoder becomes intermediate.- const l2i = renameNode(graph, 'canvas_output', 'canvas_l2i');- l2i.is_intermediate = true;+ // The base decoder, until the composited output below takes over canvas_output from it.+ const l2i = graph.nodes.canvas_output;+ if (!l2i) {+ throw new Error('Canvas generation could not find the base graph output.');+ }const gradientMask = addNode(graph, {coherence_mode: compositing.coherenceMode,@@@ -651,10 -820,14 +791,16 @@@ export const compileCanvasGraph = (inpu}if (mode === 'txt2img' || mode === 'img2img') {- resizeCanvasOutputToBbox(backendGraph, bbox, processingSize, destination);+ resizeCanvasOutputToBbox(+ backendGraph,+ bbox,+ processingSize,+ destination,+ shouldUsePidDecode(settings, model.base) && settings.pidMode === 'fit'+ );}+ // After every mode has settled its final image node, so the filters see the composited/resized result.+ addOutputPostprocessors(backendGraph, runtimeProjectSettings, outputIsIntermediate);setCanvasMetadataDimensions(backendGraph, bbox);return {diff --cc invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.tsindex 74fb71fd4b,9d72e8ec60..cdb0cc3907--- a/invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts+++ b/invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts@@@ -82,7 -75,7 +83,8 @@@ type RecalledField| 'loras'| 'referenceImages'| 'krea2Rebalance'- | 'modelTuning';++ | 'modelTuning'+ | 'animaInpaintAdapterWeight';export type ImageRecallSkipReason =| 'ambiguous'@@@ -428,115 -421,29 +430,136 @@@ const getMetadataKrea2Rebalance =const hasKrea2Rebalance = (metadata: unknown, model: GenerateModelConfig | undefined): boolean =>Object.keys(getMetadataKrea2Rebalance(metadata, model)).length > 0;+/**+ * Generation graphs stamp `generation_mode` and record what ran, so on such a record a missing list or switch means+ * none or the node default. Other records that name a model, such as canvas saves, never record concepts or tuning.+ */+const isGenerationRecord = (metadata: unknown): boolean => getString(metadata, 'generation_mode') !== null;++const getBoundedNumber = (metadata: unknown, key: string, min: number, max: number): number | null => {+ const value = getNumber(metadata, key);++ return value !== null && value >= min && value <= max ? value : null;+};++/**+ * A recorded shift: `'auto'` (webv2) or `null` (legacy) for one the node derived, a number for an override.+ * Undefined when the key is missing or holds something else.+ */+const getRecordedTimestepShift = (metadata: unknown, key: string): number | null | undefined => {+ if (!isRecord(metadata) || !(key in metadata)) {+ return undefined;+ }++ if (metadata[key] === null || metadata[key] === 'auto') {+ return null;+ }++ return getBoundedNumber(metadata, key, MIN_TIMESTEP_SHIFT, MAX_TIMESTEP_SHIFT) ?? undefined;+};++/**+ * Per-family tuning the graphs record under their own keys. Gated on the model recall settles on, since each+ * setting only reaches that family's denoise or encoder nodes.+ *+ * A generation record of that same family that leaves a switch out ran the node's default: webv2 recorded no tuning+ * before the panel offered it. Restoring the default there means a preset turned on since does not survive recall.+ * Values that only matter while a switch is on (DyPE scale, variance strength) stay as they are when missing.+ */+const getMetadataModelTuning = (+ metadata: unknown,+ model: GenerateModelConfig | undefined+): Partial<GenerateWidgetValues> => {+ if (!model || model.type !== 'main' || !isRecord(metadata)) {+ return {};+ }++ const recordsFamily = isGenerationRecord(metadata) && getRecord(metadata, 'model')?.base === model.base;+ const recordedOrDefault = <T>(key: string, recorded: T | undefined, fallback: T): T | undefined =>+ recorded !== undefined ? recorded : recordsFamily && !(key in metadata) ? fallback : undefined;++ if (model.base === 'flux') {+ const preset = recordedOrDefault(+ 'dype_preset',+ isFluxDypePreset(metadata.dype_preset) ? metadata.dype_preset : undefined,+ 'off'+ );+ const scale = getBoundedNumber(metadata, 'dype_scale', 0, MAX_FLUX_DYPE_SCALE);+ const exponent = getBoundedNumber(metadata, 'dype_exponent', 0, MAX_FLUX_DYPE_EXPONENT);++ return {+ ...(preset === undefined ? {} : { fluxDypePreset: preset }),+ ...(scale === null ? {} : { fluxDypeScale: scale }),+ ...(exponent === null ? {} : { fluxDypeExponent: exponent }),+ };+ }++ if (model.base === 'z-image') {+ const shift = recordedOrDefault('z_image_shift', getRecordedTimestepShift(metadata, 'z_image_shift'), null);+ const enabled = recordedOrDefault(+ 'z_image_seed_variance_enabled',+ getBoolean(metadata, 'z_image_seed_variance_enabled') ?? undefined,+ false+ );+ const strength = getBoundedNumber(metadata, 'z_image_seed_variance_strength', 0, MAX_ZIMAGE_SEED_VARIANCE_STRENGTH);+ const randomizePercent = getBoundedNumber(+ metadata,+ 'z_image_seed_variance_randomize_percent',+ MIN_ZIMAGE_SEED_VARIANCE_RANDOMIZE_PERCENT,+ 100+ );++ return {+ ...(shift === undefined ? {} : { zImageShift: shift }),+ ...(enabled === undefined ? {} : { zImageSeedVarianceEnabled: enabled }),+ ...(strength === null ? {} : { zImageSeedVarianceStrength: strength }),+ ...(randomizePercent === null ? {} : { zImageSeedVarianceRandomizePercent: randomizePercent }),+ };+ }++ if (model.base === 'qwen-image') {+ const shift = recordedOrDefault('qwen_image_shift', getRecordedTimestepShift(metadata, 'qwen_image_shift'), null);+ const quantization = recordedOrDefault(+ 'qwen_image_quantization',+ isQwenImageEncoderQuantization(metadata.qwen_image_quantization) ? metadata.qwen_image_quantization : undefined,+ 'none'+ );++ return {+ ...(shift === undefined ? {} : { qwenImageShift: shift }),+ ...(quantization === undefined ? {} : { qwenImageEncoderQuantization: quantization }),+ };+ }++ return {};+};++const hasModelTuning = (metadata: unknown, model: GenerateModelConfig | undefined): boolean =>+ Object.keys(getMetadataModelTuning(metadata, model)).length > 0;++ /**+ * The canvas records the adapter's weight beside the adapter; only an Anima image can carry it. An out-of-range+ * weight is clamped rather than applied, which would block every inpaint until the user edits it.+ */+ const getMetadataAnimaInpaintAdapterWeight = (+ metadata: unknown,+ model: GenerateModelConfig | undefined+ ): Partial<GenerateWidgetValues> => {+ if (model?.base !== 'anima') {+ return {};+ }++ const weight = getNumber(metadata, 'anima_inpaint_adapter_weight');++ return weight === null ? {} : { animaInpaintAdapterWeight: clampAnimaInpaintAdapterWeight(weight) };+ };++ const hasAnimaInpaintAdapterWeight = (metadata: unknown, model: GenerateModelConfig | undefined): boolean =>+ Object.keys(getMetadataAnimaInpaintAdapterWeight(metadata, model)).length > 0;+type RecalledComponentSetting = keyof Pick<GenerateWidgetValues,+ | 'animaInpaintAdapterModel'| 'clipEmbedModel'| 'componentSourceModel'| 'gemma2EncoderModel'@@@ -817,7 -748,7 +858,8 @@@ export const getImageRecallCapabilitieconst hasReferenceImages = getMetadataReferenceImages(metadata).length > 0;const hasModel = supportedMetadataModel !== null;const hasRebalance = hasKrea2Rebalance(metadata, clipSkipModel);+ const hasTuning = hasModelTuning(metadata, clipSkipModel);+ const hasAdapterWeight = hasAnimaInpaintAdapterWeight(metadata, clipSkipModel);const hasConcepts =(getMetadataConcepts(metadata, models, clipSkipModel, supportedMetadataModel).loras?.length ?? 0) > 0;const hasAnyMetadata =@@@ -833,7 -764,7 +875,8 @@@hasReferenceImages ||hasConcepts ||hasRebalance ||- hasTuning;++ hasTuning ||+ hasAdapterWeight;const hasNonSeedMetadata =hasModel ||hasVae ||@@@ -846,7 -777,7 +889,8 @@@hasReferenceImages ||hasConcepts ||hasRebalance ||- hasTuning;++ hasTuning ||+ hasAdapterWeight;return {all: hasAnyMetadata && isImageRecallKindAvailable('all'),@@@ -916,14 -847,13 +960,21 @@@ export const buildImageRecallSettingsfields.push('krea2Rebalance');}+ const tuningPatch = getMetadataModelTuning(metadata, values.model);++ // A same-family record always restores its switches, so only count the field when one actually changes.+ if (Object.entries(tuningPatch).some(([key, value]) => values[key as keyof GenerateWidgetValues] !== value)) {+ values = { ...values, ...tuningPatch };+ fields.push('modelTuning');+ }++ const adapterWeightPatch = getMetadataAnimaInpaintAdapterWeight(metadata, values.model);++ if (Object.keys(adapterWeightPatch).length > 0) {+ values = { ...values, ...adapterWeightPatch };+ fields.push('animaInpaintAdapterWeight');+ }+const vae = getMetadataVae(metadata, values.model, vaeModels);if (vae !== undefined) {