diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts index 76b2f3c83b..56430035c1 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts @@ -17,6 +17,7 @@ import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { CANVAS_INPAINT_GRAPH, CANVAS_OUTPUT, + CANVAS_REFINE_DENOISE_LATENTS, CLIP_SKIP, DENOISE_LATENTS, INPAINT_IMAGE, @@ -60,6 +61,8 @@ export const buildCanvasInpaintGraph = ( shouldUseCpuNoise, maskBlur, maskBlurMethod, + canvasRefineSteps, + canvasRefineStrength, clipSkip, } = state.generation; @@ -138,6 +141,16 @@ export const buildCanvasInpaintGraph = ( denoising_start: 1 - strength, denoising_end: 1, }, + [CANVAS_REFINE_DENOISE_LATENTS]: { + type: 'denoise_latents', + id: DENOISE_LATENTS, + is_intermediate: true, + steps: canvasRefineSteps, + cfg_scale: cfg_scale, + scheduler: scheduler, + denoising_start: 1 - canvasRefineStrength, + denoising_end: 1, + }, [LATENTS_TO_IMAGE]: { type: 'l2i', id: LATENTS_TO_IMAGE, @@ -280,12 +293,63 @@ export const buildCanvasInpaintGraph = ( field: 'seed', }, }, - // Decode Inpainted Latents To Image + // Canvas Refine + { + source: { + node_id: MAIN_MODEL_LOADER, + field: 'unet', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'unet', + }, + }, + { + source: { + node_id: POSITIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'positive_conditioning', + }, + }, + { + source: { + node_id: NEGATIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'negative_conditioning', + }, + }, + { + source: { + node_id: NOISE, + field: 'noise', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'noise', + }, + }, { source: { node_id: DENOISE_LATENTS, field: 'latents', }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'latents', + }, + }, + // Decode Inpainted Latents To Image + { + source: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'latents', + }, destination: { node_id: LATENTS_TO_IMAGE, field: 'latents', diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts index de295720ef..459d80296c 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts @@ -17,6 +17,7 @@ import { addVAEToGraph } from './addVAEToGraph'; import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { CANVAS_OUTPUT, + CANVAS_REFINE_DENOISE_LATENTS, INPAINT_IMAGE, INPAINT_IMAGE_RESIZE_DOWN, INPAINT_IMAGE_RESIZE_UP, @@ -60,6 +61,8 @@ export const buildCanvasSDXLInpaintGraph = ( shouldUseCpuNoise, maskBlur, maskBlurMethod, + canvasRefineSteps, + canvasRefineStrength, } = state.generation; const { @@ -143,6 +146,16 @@ export const buildCanvasSDXLInpaintGraph = ( : 1 - strength, denoising_end: shouldUseSDXLRefiner ? refinerStart : 1, }, + [CANVAS_REFINE_DENOISE_LATENTS]: { + type: 'denoise_latents', + id: SDXL_DENOISE_LATENTS, + is_intermediate: true, + steps: canvasRefineSteps, + cfg_scale: cfg_scale, + scheduler: scheduler, + denoising_start: 1 - canvasRefineStrength, + denoising_end: 1, + }, [LATENTS_TO_IMAGE]: { type: 'l2i', id: LATENTS_TO_IMAGE, @@ -294,12 +307,63 @@ export const buildCanvasSDXLInpaintGraph = ( field: 'seed', }, }, - // Decode inpainted latents to image + // Canvas Refine + { + source: { + node_id: SDXL_MODEL_LOADER, + field: 'unet', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'unet', + }, + }, + { + source: { + node_id: POSITIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'positive_conditioning', + }, + }, + { + source: { + node_id: NEGATIVE_CONDITIONING, + field: 'conditioning', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'negative_conditioning', + }, + }, + { + source: { + node_id: NOISE, + field: 'noise', + }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'noise', + }, + }, { source: { node_id: SDXL_DENOISE_LATENTS, field: 'latents', }, + destination: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'latents', + }, + }, + // Decode Inpainted Latents To Image + { + source: { + node_id: CANVAS_REFINE_DENOISE_LATENTS, + field: 'latents', + }, destination: { node_id: LATENTS_TO_IMAGE, field: 'latents', @@ -479,7 +543,7 @@ export const buildCanvasSDXLInpaintGraph = ( // Add Refiner if enabled if (shouldUseSDXLRefiner) { - addSDXLRefinerToGraph(state, graph, SDXL_DENOISE_LATENTS); + addSDXLRefinerToGraph(state, graph, CANVAS_REFINE_DENOISE_LATENTS); } // optionally add custom VAE