diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addVAEToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addVAEToGraph.ts index 85e8fed572..384eae8c38 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addVAEToGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addVAEToGraph.ts @@ -2,6 +2,7 @@ import { RootState } from 'app/store/store'; import { NonNullableGraph } from 'features/nodes/types/types'; import { MetadataAccumulatorInvocation } from 'services/api/types'; import { + CANVAS_OUTPUT, IMAGE_TO_IMAGE_GRAPH, IMAGE_TO_LATENTS, INPAINT_GRAPH, @@ -35,11 +36,21 @@ export const addVAEToGraph = ( }; } const isOnnxModel = modelLoaderNodeId == ONNX_MODEL_LOADER; - if ( - graph.id === TEXT_TO_IMAGE_GRAPH || - graph.id === IMAGE_TO_IMAGE_GRAPH || - graph.id === INPAINT_GRAPH - ) { + + if (graph.id === TEXT_TO_IMAGE_GRAPH || graph.id === IMAGE_TO_IMAGE_GRAPH) { + graph.edges.push({ + source: { + node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER, + field: isAutoVae && isOnnxModel ? 'vae_decoder' : 'vae', + }, + destination: { + node_id: CANVAS_OUTPUT, + field: 'vae', + }, + }); + } + + if (graph.id === INPAINT_GRAPH) { graph.edges.push({ source: { node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER, diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasImageToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasImageToImageGraph.ts index e8a5b46639..04636a19b7 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasImageToImageGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasImageToImageGraph.ts @@ -19,7 +19,6 @@ import { DENOISE_LATENTS, IMAGE_TO_IMAGE_GRAPH, IMAGE_TO_LATENTS, - LATENTS_TO_IMAGE, MAIN_MODEL_LOADER, METADATA_ACCUMULATOR, NEGATIVE_CONDITIONING, @@ -125,14 +124,10 @@ export const buildCanvasImageToImageGraph = ( denoising_start: 1 - strength, denoising_end: 1, }, - [LATENTS_TO_IMAGE]: { - type: 'l2i', - id: LATENTS_TO_IMAGE, - is_intermediate: !shouldAutoSave, - }, [CANVAS_OUTPUT]: { - type: 'load_image', + type: 'l2i', id: CANVAS_OUTPUT, + is_intermediate: !shouldAutoSave, }, }, edges: [ @@ -225,20 +220,9 @@ export const buildCanvasImageToImageGraph = ( node_id: DENOISE_LATENTS, field: 'latents', }, - destination: { - node_id: LATENTS_TO_IMAGE, - field: 'latents', - }, - }, - // Canvas Output - { - source: { - node_id: LATENTS_TO_IMAGE, - field: 'image', - }, destination: { node_id: CANVAS_OUTPUT, - field: 'image', + field: 'latents', }, }, ], @@ -339,7 +323,7 @@ export const buildCanvasImageToImageGraph = ( field: 'metadata', }, destination: { - node_id: LATENTS_TO_IMAGE, + node_id: CANVAS_OUTPUT, field: 'metadata', }, }); @@ -359,12 +343,12 @@ export const buildCanvasImageToImageGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph; 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 6ecb73b992..a1e5c27083 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts @@ -373,12 +373,12 @@ export const buildCanvasInpaintGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph, INPAINT); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph, INPAINT); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts index 2ed0cc952a..3f4737134a 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts @@ -458,12 +458,12 @@ export const buildCanvasOutpaintGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph, INPAINT); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph, INPAINT); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLImageToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLImageToImageGraph.ts index 5b198e0bc3..f81bd8376b 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLImageToImageGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLImageToImageGraph.ts @@ -19,7 +19,6 @@ import { DENOISE_LATENTS, IMAGE_TO_IMAGE_GRAPH, IMAGE_TO_LATENTS, - LATENTS_TO_IMAGE, METADATA_ACCUMULATOR, NEGATIVE_CONDITIONING, NOISE, @@ -132,14 +131,10 @@ export const buildCanvasSDXLImageToImageGraph = ( : 1 - strength, denoising_end: shouldUseSDXLRefiner ? refinerStart : 1, }, - [LATENTS_TO_IMAGE]: { - type: 'l2i', - id: LATENTS_TO_IMAGE, - is_intermediate: !shouldAutoSave, - }, [CANVAS_OUTPUT]: { - type: 'load_image', + type: 'l2i', id: CANVAS_OUTPUT, + is_intermediate: !shouldAutoSave, }, }, edges: [ @@ -242,14 +237,14 @@ export const buildCanvasSDXLImageToImageGraph = ( field: 'latents', }, destination: { - node_id: LATENTS_TO_IMAGE, + node_id: CANVAS_OUTPUT, field: 'latents', }, }, // Canvas Output { source: { - node_id: LATENTS_TO_IMAGE, + node_id: CANVAS_OUTPUT, field: 'image', }, destination: { @@ -355,7 +350,7 @@ export const buildCanvasSDXLImageToImageGraph = ( field: 'metadata', }, destination: { - node_id: LATENTS_TO_IMAGE, + node_id: CANVAS_OUTPUT, field: 'metadata', }, }); @@ -380,12 +375,12 @@ export const buildCanvasSDXLImageToImageGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph; 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 a8e190bcd1..091778a569 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts @@ -391,12 +391,12 @@ export const buildCanvasSDXLInpaintGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph, INPAINT); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph, INPAINT); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts index da7eb6b6d3..5db564ba6c 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts @@ -476,12 +476,12 @@ export const buildCanvasSDXLOutpaintGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph, INPAINT); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph, INPAINT); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLTextToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLTextToImageGraph.ts index 391cccd7a9..f1559ace5c 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLTextToImageGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLTextToImageGraph.ts @@ -16,7 +16,6 @@ import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { CANVAS_OUTPUT, DENOISE_LATENTS, - LATENTS_TO_IMAGE, METADATA_ACCUMULATOR, NEGATIVE_CONDITIONING, NOISE, @@ -144,14 +143,10 @@ export const buildCanvasSDXLTextToImageGraph = ( use_cpu, }, [t2lNode.id]: t2lNode, - [LATENTS_TO_IMAGE]: { - type: isUsingOnnxModel ? 'l2i_onnx' : 'l2i', - id: LATENTS_TO_IMAGE, - is_intermediate: !shouldAutoSave, - }, [CANVAS_OUTPUT]: { - type: 'load_image', + type: isUsingOnnxModel ? 'l2i_onnx' : 'l2i', id: CANVAS_OUTPUT, + is_intermediate: !shouldAutoSave, }, }, edges: [ @@ -243,20 +238,9 @@ export const buildCanvasSDXLTextToImageGraph = ( node_id: DENOISE_LATENTS, field: 'latents', }, - destination: { - node_id: LATENTS_TO_IMAGE, - field: 'latents', - }, - }, - // Canvas Output - { - source: { - node_id: LATENTS_TO_IMAGE, - field: 'image', - }, destination: { node_id: CANVAS_OUTPUT, - field: 'image', + field: 'latents', }, }, ], @@ -289,7 +273,7 @@ export const buildCanvasSDXLTextToImageGraph = ( field: 'metadata', }, destination: { - node_id: LATENTS_TO_IMAGE, + node_id: CANVAS_OUTPUT, field: 'metadata', }, }); @@ -314,12 +298,12 @@ export const buildCanvasSDXLTextToImageGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasTextToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasTextToImageGraph.ts index 6301ad6c9f..8d25f13a47 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasTextToImageGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasTextToImageGraph.ts @@ -16,7 +16,6 @@ import { CANVAS_OUTPUT, CLIP_SKIP, DENOISE_LATENTS, - LATENTS_TO_IMAGE, MAIN_MODEL_LOADER, METADATA_ACCUMULATOR, NEGATIVE_CONDITIONING, @@ -137,14 +136,10 @@ export const buildCanvasTextToImageGraph = ( use_cpu, }, [t2lNode.id]: t2lNode, - [LATENTS_TO_IMAGE]: { - type: isUsingOnnxModel ? 'l2i_onnx' : 'l2i', - id: LATENTS_TO_IMAGE, - is_intermediate: !shouldAutoSave, - }, [CANVAS_OUTPUT]: { - type: 'load_image', + type: isUsingOnnxModel ? 'l2i_onnx' : 'l2i', id: CANVAS_OUTPUT, + is_intermediate: !shouldAutoSave, }, }, edges: [ @@ -227,20 +222,9 @@ export const buildCanvasTextToImageGraph = ( node_id: DENOISE_LATENTS, field: 'latents', }, - destination: { - node_id: LATENTS_TO_IMAGE, - field: 'latents', - }, - }, - // Canvas Output - { - source: { - node_id: LATENTS_TO_IMAGE, - field: 'image', - }, destination: { node_id: CANVAS_OUTPUT, - field: 'image', + field: 'latents', }, }, ], @@ -273,7 +257,7 @@ export const buildCanvasTextToImageGraph = ( field: 'metadata', }, destination: { - node_id: LATENTS_TO_IMAGE, + node_id: CANVAS_OUTPUT, field: 'metadata', }, }); @@ -293,12 +277,12 @@ export const buildCanvasTextToImageGraph = ( // NSFW & watermark - must be last thing added to graph if (state.system.shouldUseNSFWChecker) { // must add before watermarker! - addNSFWCheckerToGraph(state, graph); + addNSFWCheckerToGraph(state, graph, CANVAS_OUTPUT); } if (state.system.shouldUseWatermarker) { // must add after nsfw checker! - addWatermarkerToGraph(state, graph); + addWatermarkerToGraph(state, graph, CANVAS_OUTPUT); } return graph;