feat: Add Seamless To Canvas Text To Image / Image To Image + SDXL + Refiner

This commit is contained in:
blessedcoolant 2023-08-29 04:26:11 +12:00
parent a08d22587b
commit b5dac99411
6 changed files with 59 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import { addControlNetToLinearGraph } from './addControlNetToLinearGraph';
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph'; import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
import { addLoRAsToGraph } from './addLoRAsToGraph'; import { addLoRAsToGraph } from './addLoRAsToGraph';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph'; import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addSeamlessToLinearGraph } from './addSeamlessToLinearGraph';
import { addVAEToGraph } from './addVAEToGraph'; import { addVAEToGraph } from './addVAEToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import { import {
@ -22,6 +23,7 @@ import {
NEGATIVE_CONDITIONING, NEGATIVE_CONDITIONING,
NOISE, NOISE,
POSITIVE_CONDITIONING, POSITIVE_CONDITIONING,
SEAMLESS,
} from './constants'; } from './constants';
/** /**
@ -44,6 +46,8 @@ export const buildCanvasImageToImageGraph = (
clipSkip, clipSkip,
shouldUseCpuNoise, shouldUseCpuNoise,
shouldUseNoiseSettings, shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation; } = state.generation;
// The bounding box determines width and height, not the width and height params // The bounding box determines width and height, not the width and height params
@ -64,6 +68,8 @@ export const buildCanvasImageToImageGraph = (
throw new Error('No model found in state'); throw new Error('No model found in state');
} }
let modelLoaderNodeId = MAIN_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise ? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise; : initialGenerationState.shouldUseCpuNoise;
@ -340,11 +346,17 @@ export const buildCanvasImageToImageGraph = (
}, },
}); });
// Add Seamless To Graph
if (seamlessXAxis || seamlessYAxis) {
addSeamlessToLinearGraph(state, graph, modelLoaderNodeId);
modelLoaderNodeId = SEAMLESS;
}
// add LoRA support // add LoRA support
addLoRAsToGraph(state, graph, DENOISE_LATENTS); addLoRAsToGraph(state, graph, DENOISE_LATENTS);
// optionally add custom VAE // optionally add custom VAE
addVAEToGraph(state, graph, MAIN_MODEL_LOADER); addVAEToGraph(state, graph, modelLoaderNodeId);
// add dynamic prompts - also sets up core iteration and seed // add dynamic prompts - also sets up core iteration and seed
addDynamicPromptsToGraph(state, graph); addDynamicPromptsToGraph(state, graph);

View File

@ -8,6 +8,7 @@ import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph'; import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addSDXLLoRAsToGraph } from './addSDXLLoRAstoGraph'; import { addSDXLLoRAsToGraph } from './addSDXLLoRAstoGraph';
import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph'; import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph';
import { addSeamlessToLinearGraph } from './addSeamlessToLinearGraph';
import { addVAEToGraph } from './addVAEToGraph'; import { addVAEToGraph } from './addVAEToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import { import {
@ -19,9 +20,11 @@ import {
NEGATIVE_CONDITIONING, NEGATIVE_CONDITIONING,
NOISE, NOISE,
POSITIVE_CONDITIONING, POSITIVE_CONDITIONING,
REFINER_SEAMLESS,
SDXL_CANVAS_IMAGE_TO_IMAGE_GRAPH, SDXL_CANVAS_IMAGE_TO_IMAGE_GRAPH,
SDXL_DENOISE_LATENTS, SDXL_DENOISE_LATENTS,
SDXL_MODEL_LOADER, SDXL_MODEL_LOADER,
SEAMLESS,
} from './constants'; } from './constants';
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt'; import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
@ -44,6 +47,8 @@ export const buildCanvasSDXLImageToImageGraph = (
clipSkip, clipSkip,
shouldUseCpuNoise, shouldUseCpuNoise,
shouldUseNoiseSettings, shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation; } = state.generation;
const { const {
@ -71,6 +76,9 @@ export const buildCanvasSDXLImageToImageGraph = (
throw new Error('No model found in state'); throw new Error('No model found in state');
} }
// Model Loader ID
let modelLoaderNodeId = SDXL_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise ? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise; : initialGenerationState.shouldUseCpuNoise;
@ -351,16 +359,23 @@ export const buildCanvasSDXLImageToImageGraph = (
}, },
}); });
// add LoRA support // Add Seamless To Graph
addSDXLLoRAsToGraph(state, graph, SDXL_DENOISE_LATENTS, SDXL_MODEL_LOADER); if (seamlessXAxis || seamlessYAxis) {
addSeamlessToLinearGraph(state, graph, modelLoaderNodeId);
modelLoaderNodeId = SEAMLESS;
}
// Add Refiner if enabled // Add Refiner if enabled
if (shouldUseSDXLRefiner) { if (shouldUseSDXLRefiner) {
addSDXLRefinerToGraph(state, graph, SDXL_DENOISE_LATENTS); addSDXLRefinerToGraph(state, graph, SDXL_DENOISE_LATENTS);
modelLoaderNodeId = REFINER_SEAMLESS;
} }
// optionally add custom VAE // optionally add custom VAE
addVAEToGraph(state, graph, SDXL_MODEL_LOADER); addVAEToGraph(state, graph, modelLoaderNodeId);
// add LoRA support
addSDXLLoRAsToGraph(state, graph, SDXL_DENOISE_LATENTS, modelLoaderNodeId);
// add dynamic prompts - also sets up core iteration and seed // add dynamic prompts - also sets up core iteration and seed
addDynamicPromptsToGraph(state, graph); addDynamicPromptsToGraph(state, graph);

View File

@ -11,6 +11,7 @@ import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph'; import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addSDXLLoRAsToGraph } from './addSDXLLoRAstoGraph'; import { addSDXLLoRAsToGraph } from './addSDXLLoRAstoGraph';
import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph'; import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph';
import { addSeamlessToLinearGraph } from './addSeamlessToLinearGraph';
import { addVAEToGraph } from './addVAEToGraph'; import { addVAEToGraph } from './addVAEToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import { import {
@ -21,9 +22,11 @@ import {
NOISE, NOISE,
ONNX_MODEL_LOADER, ONNX_MODEL_LOADER,
POSITIVE_CONDITIONING, POSITIVE_CONDITIONING,
REFINER_SEAMLESS,
SDXL_CANVAS_TEXT_TO_IMAGE_GRAPH, SDXL_CANVAS_TEXT_TO_IMAGE_GRAPH,
SDXL_DENOISE_LATENTS, SDXL_DENOISE_LATENTS,
SDXL_MODEL_LOADER, SDXL_MODEL_LOADER,
SEAMLESS,
} from './constants'; } from './constants';
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt'; import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
@ -45,6 +48,8 @@ export const buildCanvasSDXLTextToImageGraph = (
clipSkip, clipSkip,
shouldUseCpuNoise, shouldUseCpuNoise,
shouldUseNoiseSettings, shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation; } = state.generation;
// The bounding box determines width and height, not the width and height params // The bounding box determines width and height, not the width and height params
@ -74,7 +79,7 @@ export const buildCanvasSDXLTextToImageGraph = (
const isUsingOnnxModel = model.model_type === 'onnx'; const isUsingOnnxModel = model.model_type === 'onnx';
const modelLoaderNodeId = isUsingOnnxModel let modelLoaderNodeId = isUsingOnnxModel
? ONNX_MODEL_LOADER ? ONNX_MODEL_LOADER
: SDXL_MODEL_LOADER; : SDXL_MODEL_LOADER;
@ -334,9 +339,16 @@ export const buildCanvasSDXLTextToImageGraph = (
}, },
}); });
// Add Seamless To Graph
if (seamlessXAxis || seamlessYAxis) {
addSeamlessToLinearGraph(state, graph, modelLoaderNodeId);
modelLoaderNodeId = SEAMLESS;
}
// Add Refiner if enabled // Add Refiner if enabled
if (shouldUseSDXLRefiner) { if (shouldUseSDXLRefiner) {
addSDXLRefinerToGraph(state, graph, SDXL_DENOISE_LATENTS); addSDXLRefinerToGraph(state, graph, SDXL_DENOISE_LATENTS);
modelLoaderNodeId = REFINER_SEAMLESS;
} }
// add LoRA support // add LoRA support

View File

@ -10,6 +10,7 @@ import { addControlNetToLinearGraph } from './addControlNetToLinearGraph';
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph'; import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
import { addLoRAsToGraph } from './addLoRAsToGraph'; import { addLoRAsToGraph } from './addLoRAsToGraph';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph'; import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
import { addSeamlessToLinearGraph } from './addSeamlessToLinearGraph';
import { addVAEToGraph } from './addVAEToGraph'; import { addVAEToGraph } from './addVAEToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import { import {
@ -24,6 +25,7 @@ import {
NOISE, NOISE,
ONNX_MODEL_LOADER, ONNX_MODEL_LOADER,
POSITIVE_CONDITIONING, POSITIVE_CONDITIONING,
SEAMLESS,
} from './constants'; } from './constants';
/** /**
@ -44,6 +46,8 @@ export const buildCanvasTextToImageGraph = (
clipSkip, clipSkip,
shouldUseCpuNoise, shouldUseCpuNoise,
shouldUseNoiseSettings, shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation; } = state.generation;
// The bounding box determines width and height, not the width and height params // The bounding box determines width and height, not the width and height params
@ -70,7 +74,7 @@ export const buildCanvasTextToImageGraph = (
const isUsingOnnxModel = model.model_type === 'onnx'; const isUsingOnnxModel = model.model_type === 'onnx';
const modelLoaderNodeId = isUsingOnnxModel let modelLoaderNodeId = isUsingOnnxModel
? ONNX_MODEL_LOADER ? ONNX_MODEL_LOADER
: MAIN_MODEL_LOADER; : MAIN_MODEL_LOADER;
@ -321,6 +325,12 @@ export const buildCanvasTextToImageGraph = (
}, },
}); });
// Add Seamless To Graph
if (seamlessXAxis || seamlessYAxis) {
addSeamlessToLinearGraph(state, graph, modelLoaderNodeId);
modelLoaderNodeId = SEAMLESS;
}
// optionally add custom VAE // optionally add custom VAE
addVAEToGraph(state, graph, modelLoaderNodeId); addVAEToGraph(state, graph, modelLoaderNodeId);

View File

@ -5,6 +5,7 @@ import ParamMaskAdjustmentCollapse from 'features/parameters/components/Paramete
import ParamCanvasCoherencePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamCanvasCoherencePassCollapse'; import ParamCanvasCoherencePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamCanvasCoherencePassCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse'; import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse'; import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import ParamSDXLPromptArea from './ParamSDXLPromptArea'; import ParamSDXLPromptArea from './ParamSDXLPromptArea';
import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse'; import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse';
import SDXLUnifiedCanvasTabCoreParameters from './SDXLUnifiedCanvasTabCoreParameters'; import SDXLUnifiedCanvasTabCoreParameters from './SDXLUnifiedCanvasTabCoreParameters';
@ -22,6 +23,7 @@ export default function SDXLUnifiedCanvasTabParameters() {
<ParamMaskAdjustmentCollapse /> <ParamMaskAdjustmentCollapse />
<ParamInfillAndScalingCollapse /> <ParamInfillAndScalingCollapse />
<ParamCanvasCoherencePassCollapse /> <ParamCanvasCoherencePassCollapse />
<ParamSeamlessCollapse />
</> </>
); );
} }

View File

@ -6,6 +6,7 @@ import ParamMaskAdjustmentCollapse from 'features/parameters/components/Paramete
import ParamCanvasCoherencePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamCanvasCoherencePassCollapse'; import ParamCanvasCoherencePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamCanvasCoherencePassCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse'; import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamPromptArea from 'features/parameters/components/Parameters/Prompt/ParamPromptArea'; import ParamPromptArea from 'features/parameters/components/Parameters/Prompt/ParamPromptArea';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse'; import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse';
import { memo } from 'react'; import { memo } from 'react';
import UnifiedCanvasCoreParameters from './UnifiedCanvasCoreParameters'; import UnifiedCanvasCoreParameters from './UnifiedCanvasCoreParameters';
@ -22,6 +23,7 @@ const UnifiedCanvasParameters = () => {
<ParamMaskAdjustmentCollapse /> <ParamMaskAdjustmentCollapse />
<ParamInfillAndScalingCollapse /> <ParamInfillAndScalingCollapse />
<ParamCanvasCoherencePassCollapse /> <ParamCanvasCoherencePassCollapse />
<ParamSeamlessCollapse />
<ParamAdvancedCollapse /> <ParamAdvancedCollapse />
</> </>
); );