fix(ui): revise metadata edges in linear graphs

- always add metadata to l2i nodes
- no metadata handling for inpaint, removed
This commit is contained in:
psychedelicious 2023-07-27 09:43:45 +10:00
parent c90c4a32ee
commit 049e666412
7 changed files with 66 additions and 133 deletions

View File

@ -312,6 +312,17 @@ export const buildCanvasImageToImageGraph = (
init_image: initialImage.image_name,
};
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
// add LoRA support
addLoRAsToGraph(state, graph, LATENTS_TO_LATENTS);
@ -335,21 +346,5 @@ export const buildCanvasImageToImageGraph = (
addWatermarkerToGraph(state, graph);
}
if (
!state.system.shouldUseNSFWChecker &&
!state.system.shouldUseWatermarker
) {
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
}
return graph;
};

View File

@ -252,27 +252,6 @@ export const buildCanvasInpaintGraph = (
(graph.nodes[RANGE_OF_SIZE] as RangeOfSizeInvocation).start = seed;
}
// add metadata accumulator, which is only mostly populated - some fields are added later
graph.nodes[METADATA_ACCUMULATOR] = {
id: METADATA_ACCUMULATOR,
type: 'metadata_accumulator',
generation_mode: 'txt2img',
cfg_scale,
height,
width,
positive_prompt: '', // set in addDynamicPromptsToGraph
negative_prompt: negativePrompt,
model,
seed: 0, // set in addDynamicPromptsToGraph
steps,
rand_device: 'cpu',
scheduler,
vae: undefined, // option; set in addVAEToGraph
controlnets: [], // populated in addControlNetToLinearGraph
loras: [], // populated in addLoRAsToGraph
clip_skip: clipSkip,
};
// NSFW & watermark - must be last thing added to graph
if (state.system.shouldUseNSFWChecker) {
// must add before watermarker!
@ -284,21 +263,5 @@ export const buildCanvasInpaintGraph = (
addWatermarkerToGraph(state, graph, INPAINT);
}
if (
!state.system.shouldUseNSFWChecker &&
!state.system.shouldUseWatermarker
) {
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: INPAINT,
field: 'metadata',
},
});
}
return graph;
};

View File

@ -217,6 +217,17 @@ export const buildCanvasTextToImageGraph = (
clip_skip: clipSkip,
};
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
// add LoRA support
addLoRAsToGraph(state, graph, TEXT_TO_LATENTS);
@ -240,21 +251,5 @@ export const buildCanvasTextToImageGraph = (
addWatermarkerToGraph(state, graph);
}
if (
!state.system.shouldUseNSFWChecker &&
!state.system.shouldUseWatermarker
) {
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
}
return graph;
};

View File

@ -322,6 +322,17 @@ export const buildLinearImageToImageGraph = (
init_image: initialImage.imageName,
};
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
// add LoRA support
addLoRAsToGraph(state, graph, LATENTS_TO_LATENTS);
@ -345,21 +356,5 @@ export const buildLinearImageToImageGraph = (
addWatermarkerToGraph(state, graph);
}
if (
!state.system.shouldUseNSFWChecker &&
!state.system.shouldUseWatermarker
) {
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
}
return graph;
};

View File

@ -353,6 +353,17 @@ export const buildLinearSDXLImageToImageGraph = (
negative_style_prompt: negativeStylePrompt,
};
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
// Add Refiner if enabled
if (shouldUseSDXLRefiner) {
addSDXLRefinerToGraph(state, graph, SDXL_LATENTS_TO_LATENTS);
@ -372,21 +383,5 @@ export const buildLinearSDXLImageToImageGraph = (
addWatermarkerToGraph(state, graph);
}
if (
!state.system.shouldUseNSFWChecker &&
!state.system.shouldUseWatermarker
) {
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
}
return graph;
};

View File

@ -235,6 +235,17 @@ export const buildLinearSDXLTextToImageGraph = (
negative_style_prompt: negativeStylePrompt,
};
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
// Add Refiner if enabled
if (shouldUseSDXLRefiner) {
addSDXLRefinerToGraph(state, graph, SDXL_TEXT_TO_LATENTS);
@ -254,21 +265,5 @@ export const buildLinearSDXLTextToImageGraph = (
addWatermarkerToGraph(state, graph);
}
if (
!state.system.shouldUseNSFWChecker &&
!state.system.shouldUseWatermarker
) {
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
}
return graph;
};

View File

@ -206,6 +206,17 @@ export const buildLinearTextToImageGraph = (
clip_skip: clipSkip,
};
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
// add LoRA support
addLoRAsToGraph(state, graph, TEXT_TO_LATENTS);
@ -229,21 +240,5 @@ export const buildLinearTextToImageGraph = (
addWatermarkerToGraph(state, graph);
}
if (
!state.system.shouldUseNSFWChecker &&
!state.system.shouldUseWatermarker
) {
graph.edges.push({
source: {
node_id: METADATA_ACCUMULATOR,
field: 'metadata',
},
destination: {
node_id: LATENTS_TO_IMAGE,
field: 'metadata',
},
});
}
return graph;
};