fix: SDXL Refiner using the incorrect node during inpainting

This commit is contained in:
blessedcoolant 2023-09-27 04:14:32 +05:30 committed by psychedelicious
parent 98a076260b
commit 8b969053e7
2 changed files with 40 additions and 15 deletions

View File

@ -32,7 +32,8 @@ export const addSDXLRefinerToGraph = (
graph: NonNullableGraph, graph: NonNullableGraph,
baseNodeId: string, baseNodeId: string,
modelLoaderNodeId?: string, modelLoaderNodeId?: string,
canvasInitImage?: ImageDTO canvasInitImage?: ImageDTO,
canvasMaskImage?: ImageDTO
): void => { ): void => {
const { const {
refinerModel, refinerModel,
@ -257,8 +258,30 @@ export const addSDXLRefinerToGraph = (
}; };
} }
graph.edges.push( if (graph.id === SDXL_CANVAS_INPAINT_GRAPH) {
{ if (isUsingScaledDimensions) {
graph.edges.push({
source: {
node_id: MASK_RESIZE_UP,
field: 'image',
},
destination: {
node_id: SDXL_REFINER_INPAINT_CREATE_MASK,
field: 'mask',
},
});
} else {
graph.nodes[SDXL_REFINER_INPAINT_CREATE_MASK] = {
...(graph.nodes[
SDXL_REFINER_INPAINT_CREATE_MASK
] as CreateDenoiseMaskInvocation),
mask: canvasMaskImage,
};
}
}
if (graph.id === SDXL_CANVAS_OUTPAINT_GRAPH) {
graph.edges.push({
source: { source: {
node_id: isUsingScaledDimensions ? MASK_RESIZE_UP : MASK_COMBINE, node_id: isUsingScaledDimensions ? MASK_RESIZE_UP : MASK_COMBINE,
field: 'image', field: 'image',
@ -267,8 +290,10 @@ export const addSDXLRefinerToGraph = (
node_id: SDXL_REFINER_INPAINT_CREATE_MASK, node_id: SDXL_REFINER_INPAINT_CREATE_MASK,
field: 'mask', field: 'mask',
}, },
}, });
{ }
graph.edges.push({
source: { source: {
node_id: SDXL_REFINER_INPAINT_CREATE_MASK, node_id: SDXL_REFINER_INPAINT_CREATE_MASK,
field: 'denoise_mask', field: 'denoise_mask',
@ -277,8 +302,7 @@ export const addSDXLRefinerToGraph = (
node_id: SDXL_REFINER_DENOISE_LATENTS, node_id: SDXL_REFINER_DENOISE_LATENTS,
field: 'denoise_mask', field: 'denoise_mask',
}, },
} });
);
} }
if ( if (

View File

@ -663,7 +663,8 @@ export const buildCanvasSDXLInpaintGraph = (
graph, graph,
CANVAS_COHERENCE_DENOISE_LATENTS, CANVAS_COHERENCE_DENOISE_LATENTS,
modelLoaderNodeId, modelLoaderNodeId,
canvasInitImage canvasInitImage,
canvasMaskImage
); );
if (seamlessXAxis || seamlessYAxis) { if (seamlessXAxis || seamlessYAxis) {
modelLoaderNodeId = SDXL_REFINER_SEAMLESS; modelLoaderNodeId = SDXL_REFINER_SEAMLESS;