fix: remove extra node for canvas output catch

This commit is contained in:
blessedcoolant 2023-08-12 22:39:30 +12:00
parent ad96c41156
commit 746c7c59ff
9 changed files with 49 additions and 91 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;