fix: SDXL LoRA's not working with seamless

This commit is contained in:
blessedcoolant 2023-08-29 06:44:18 +12:00
parent aaae471910
commit 577464091c

View File

@ -11,9 +11,11 @@ import {
METADATA_ACCUMULATOR,
NEGATIVE_CONDITIONING,
POSITIVE_CONDITIONING,
REFINER_SEAMLESS,
SDXL_CANVAS_INPAINT_GRAPH,
SDXL_CANVAS_OUTPAINT_GRAPH,
SDXL_MODEL_LOADER,
SEAMLESS,
} from './constants';
export const addSDXLLoRAsToGraph = (
@ -36,20 +38,25 @@ export const addSDXLLoRAsToGraph = (
| MetadataAccumulatorInvocation
| undefined;
// Handle Seamless Plugs
const unetLoaderId = modelLoaderNodeId;
let clipLoaderId = modelLoaderNodeId;
if ([SEAMLESS, REFINER_SEAMLESS].includes(modelLoaderNodeId)) {
clipLoaderId = SDXL_MODEL_LOADER;
}
if (loraCount > 0) {
// Remove modelLoaderNodeId unet/clip/clip2 connections to feed it to LoRAs
graph.edges = graph.edges.filter(
(e) =>
!(
e.source.node_id === modelLoaderNodeId &&
['unet'].includes(e.source.field)
e.source.node_id === unetLoaderId && ['unet'].includes(e.source.field)
) &&
!(
e.source.node_id === modelLoaderNodeId &&
['clip'].includes(e.source.field)
e.source.node_id === clipLoaderId && ['clip'].includes(e.source.field)
) &&
!(
e.source.node_id === modelLoaderNodeId &&
e.source.node_id === clipLoaderId &&
['clip2'].includes(e.source.field)
)
);
@ -88,7 +95,7 @@ export const addSDXLLoRAsToGraph = (
// first lora = start the lora chain, attach directly to model loader
graph.edges.push({
source: {
node_id: modelLoaderNodeId,
node_id: unetLoaderId,
field: 'unet',
},
destination: {
@ -99,7 +106,7 @@ export const addSDXLLoRAsToGraph = (
graph.edges.push({
source: {
node_id: modelLoaderNodeId,
node_id: clipLoaderId,
field: 'clip',
},
destination: {
@ -110,7 +117,7 @@ export const addSDXLLoRAsToGraph = (
graph.edges.push({
source: {
node_id: modelLoaderNodeId,
node_id: clipLoaderId,
field: 'clip2',
},
destination: {