mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Give each graph its own unique id
This commit is contained in:
parent
746c7c59ff
commit
55d27f71a3
@ -2,10 +2,13 @@ import { RootState } from 'app/store/store';
|
|||||||
import { NonNullableGraph } from 'features/nodes/types/types';
|
import { NonNullableGraph } from 'features/nodes/types/types';
|
||||||
import { MetadataAccumulatorInvocation } from 'services/api/types';
|
import { MetadataAccumulatorInvocation } from 'services/api/types';
|
||||||
import {
|
import {
|
||||||
|
CANVAS_IMAGE_TO_IMAGE_GRAPH,
|
||||||
|
CANVAS_INPAINT_GRAPH,
|
||||||
|
CANVAS_OUTPAINT_GRAPH,
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
|
CANVAS_TEXT_TO_IMAGE_GRAPH,
|
||||||
IMAGE_TO_IMAGE_GRAPH,
|
IMAGE_TO_IMAGE_GRAPH,
|
||||||
IMAGE_TO_LATENTS,
|
IMAGE_TO_LATENTS,
|
||||||
INPAINT_GRAPH,
|
|
||||||
INPAINT_IMAGE,
|
INPAINT_IMAGE,
|
||||||
LATENTS_TO_IMAGE,
|
LATENTS_TO_IMAGE,
|
||||||
MAIN_MODEL_LOADER,
|
MAIN_MODEL_LOADER,
|
||||||
@ -38,19 +41,6 @@ export const addVAEToGraph = (
|
|||||||
const isOnnxModel = modelLoaderNodeId == ONNX_MODEL_LOADER;
|
const isOnnxModel = modelLoaderNodeId == ONNX_MODEL_LOADER;
|
||||||
|
|
||||||
if (graph.id === TEXT_TO_IMAGE_GRAPH || graph.id === IMAGE_TO_IMAGE_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({
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
||||||
@ -63,7 +53,26 @@ export const addVAEToGraph = (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.id === IMAGE_TO_IMAGE_GRAPH) {
|
if (
|
||||||
|
graph.id === CANVAS_TEXT_TO_IMAGE_GRAPH ||
|
||||||
|
graph.id === CANVAS_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 === IMAGE_TO_IMAGE_GRAPH ||
|
||||||
|
graph.id === CANVAS_IMAGE_TO_IMAGE_GRAPH
|
||||||
|
) {
|
||||||
graph.edges.push({
|
graph.edges.push({
|
||||||
source: {
|
source: {
|
||||||
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
||||||
@ -76,17 +85,29 @@ export const addVAEToGraph = (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.id === INPAINT_GRAPH) {
|
if (graph.id === CANVAS_INPAINT_GRAPH || graph.id == CANVAS_OUTPAINT_GRAPH) {
|
||||||
graph.edges.push({
|
graph.edges.push(
|
||||||
source: {
|
{
|
||||||
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
source: {
|
||||||
field: isAutoVae && isOnnxModel ? 'vae_decoder' : 'vae',
|
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
||||||
|
field: isAutoVae && isOnnxModel ? 'vae_decoder' : 'vae',
|
||||||
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: INPAINT_IMAGE,
|
||||||
|
field: 'vae',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
destination: {
|
{
|
||||||
node_id: INPAINT_IMAGE,
|
source: {
|
||||||
field: 'vae',
|
node_id: isAutoVae ? modelLoaderNodeId : VAE_LOADER,
|
||||||
},
|
field: isAutoVae && isOnnxModel ? 'vae_decoder' : 'vae',
|
||||||
});
|
},
|
||||||
|
destination: {
|
||||||
|
node_id: LATENTS_TO_IMAGE,
|
||||||
|
field: 'vae',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vae && metadataAccumulator) {
|
if (vae && metadataAccumulator) {
|
||||||
|
@ -14,10 +14,10 @@ import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
|
|||||||
import { addVAEToGraph } from './addVAEToGraph';
|
import { addVAEToGraph } from './addVAEToGraph';
|
||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
|
CANVAS_IMAGE_TO_IMAGE_GRAPH,
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
CLIP_SKIP,
|
CLIP_SKIP,
|
||||||
DENOISE_LATENTS,
|
DENOISE_LATENTS,
|
||||||
IMAGE_TO_IMAGE_GRAPH,
|
|
||||||
IMAGE_TO_LATENTS,
|
IMAGE_TO_LATENTS,
|
||||||
MAIN_MODEL_LOADER,
|
MAIN_MODEL_LOADER,
|
||||||
METADATA_ACCUMULATOR,
|
METADATA_ACCUMULATOR,
|
||||||
@ -73,7 +73,7 @@ export const buildCanvasImageToImageGraph = (
|
|||||||
|
|
||||||
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: IMAGE_TO_IMAGE_GRAPH,
|
id: CANVAS_IMAGE_TO_IMAGE_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[MAIN_MODEL_LOADER]: {
|
[MAIN_MODEL_LOADER]: {
|
||||||
type: 'main_model_loader',
|
type: 'main_model_loader',
|
||||||
|
@ -12,11 +12,11 @@ import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
|
|||||||
import { addVAEToGraph } from './addVAEToGraph';
|
import { addVAEToGraph } from './addVAEToGraph';
|
||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
|
CANVAS_INPAINT_GRAPH,
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
CLIP_SKIP,
|
CLIP_SKIP,
|
||||||
COLOR_CORRECT,
|
COLOR_CORRECT,
|
||||||
INPAINT,
|
INPAINT,
|
||||||
INPAINT_GRAPH,
|
|
||||||
INPAINT_IMAGE,
|
INPAINT_IMAGE,
|
||||||
ITERATE,
|
ITERATE,
|
||||||
LATENTS_TO_IMAGE,
|
LATENTS_TO_IMAGE,
|
||||||
@ -78,7 +78,7 @@ export const buildCanvasInpaintGraph = (
|
|||||||
: shouldUseCpuNoise;
|
: shouldUseCpuNoise;
|
||||||
|
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: INPAINT_GRAPH,
|
id: CANVAS_INPAINT_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[MAIN_MODEL_LOADER]: {
|
[MAIN_MODEL_LOADER]: {
|
||||||
type: 'main_model_loader',
|
type: 'main_model_loader',
|
||||||
|
@ -14,11 +14,11 @@ import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
|
|||||||
import { addVAEToGraph } from './addVAEToGraph';
|
import { addVAEToGraph } from './addVAEToGraph';
|
||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
|
CANVAS_OUTPAINT_GRAPH,
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
CLIP_SKIP,
|
CLIP_SKIP,
|
||||||
COLOR_CORRECT,
|
COLOR_CORRECT,
|
||||||
INPAINT,
|
INPAINT,
|
||||||
INPAINT_GRAPH,
|
|
||||||
INPAINT_IMAGE,
|
INPAINT_IMAGE,
|
||||||
INPAINT_INFILL,
|
INPAINT_INFILL,
|
||||||
ITERATE,
|
ITERATE,
|
||||||
@ -102,7 +102,7 @@ export const buildCanvasOutpaintGraph = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: INPAINT_GRAPH,
|
id: CANVAS_OUTPAINT_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[MAIN_MODEL_LOADER]: {
|
[MAIN_MODEL_LOADER]: {
|
||||||
type: 'main_model_loader',
|
type: 'main_model_loader',
|
||||||
|
@ -15,9 +15,9 @@ import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph';
|
|||||||
import { addVAEToGraph } from './addVAEToGraph';
|
import { addVAEToGraph } from './addVAEToGraph';
|
||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
|
CANVAS_IMAGE_TO_IMAGE_GRAPH,
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
DENOISE_LATENTS,
|
DENOISE_LATENTS,
|
||||||
IMAGE_TO_IMAGE_GRAPH,
|
|
||||||
IMAGE_TO_LATENTS,
|
IMAGE_TO_LATENTS,
|
||||||
METADATA_ACCUMULATOR,
|
METADATA_ACCUMULATOR,
|
||||||
NEGATIVE_CONDITIONING,
|
NEGATIVE_CONDITIONING,
|
||||||
@ -81,7 +81,7 @@ export const buildCanvasSDXLImageToImageGraph = (
|
|||||||
|
|
||||||
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: IMAGE_TO_IMAGE_GRAPH,
|
id: CANVAS_IMAGE_TO_IMAGE_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[SDXL_MODEL_LOADER]: {
|
[SDXL_MODEL_LOADER]: {
|
||||||
type: 'sdxl_model_loader',
|
type: 'sdxl_model_loader',
|
||||||
|
@ -13,10 +13,10 @@ import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph';
|
|||||||
import { addVAEToGraph } from './addVAEToGraph';
|
import { addVAEToGraph } from './addVAEToGraph';
|
||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
|
CANVAS_INPAINT_GRAPH,
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
COLOR_CORRECT,
|
COLOR_CORRECT,
|
||||||
INPAINT,
|
INPAINT,
|
||||||
INPAINT_GRAPH,
|
|
||||||
INPAINT_IMAGE,
|
INPAINT_IMAGE,
|
||||||
ITERATE,
|
ITERATE,
|
||||||
LATENTS_TO_IMAGE,
|
LATENTS_TO_IMAGE,
|
||||||
@ -85,7 +85,7 @@ export const buildCanvasSDXLInpaintGraph = (
|
|||||||
: shouldUseCpuNoise;
|
: shouldUseCpuNoise;
|
||||||
|
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: INPAINT_GRAPH,
|
id: CANVAS_INPAINT_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[SDXL_MODEL_LOADER]: {
|
[SDXL_MODEL_LOADER]: {
|
||||||
type: 'sdxl_model_loader',
|
type: 'sdxl_model_loader',
|
||||||
|
@ -15,10 +15,10 @@ import { addSDXLRefinerToGraph } from './addSDXLRefinerToGraph';
|
|||||||
import { addVAEToGraph } from './addVAEToGraph';
|
import { addVAEToGraph } from './addVAEToGraph';
|
||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
|
CANVAS_OUTPAINT_GRAPH,
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
COLOR_CORRECT,
|
COLOR_CORRECT,
|
||||||
INPAINT,
|
INPAINT,
|
||||||
INPAINT_GRAPH,
|
|
||||||
INPAINT_IMAGE,
|
INPAINT_IMAGE,
|
||||||
INPAINT_INFILL,
|
INPAINT_INFILL,
|
||||||
ITERATE,
|
ITERATE,
|
||||||
@ -109,7 +109,7 @@ export const buildCanvasSDXLOutpaintGraph = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: INPAINT_GRAPH,
|
id: CANVAS_OUTPAINT_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[SDXL_MODEL_LOADER]: {
|
[SDXL_MODEL_LOADER]: {
|
||||||
type: 'sdxl_model_loader',
|
type: 'sdxl_model_loader',
|
||||||
|
@ -15,6 +15,7 @@ import { addVAEToGraph } from './addVAEToGraph';
|
|||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
|
CANVAS_TEXT_TO_IMAGE_GRAPH,
|
||||||
DENOISE_LATENTS,
|
DENOISE_LATENTS,
|
||||||
METADATA_ACCUMULATOR,
|
METADATA_ACCUMULATOR,
|
||||||
NEGATIVE_CONDITIONING,
|
NEGATIVE_CONDITIONING,
|
||||||
@ -22,7 +23,6 @@ import {
|
|||||||
ONNX_MODEL_LOADER,
|
ONNX_MODEL_LOADER,
|
||||||
POSITIVE_CONDITIONING,
|
POSITIVE_CONDITIONING,
|
||||||
SDXL_MODEL_LOADER,
|
SDXL_MODEL_LOADER,
|
||||||
TEXT_TO_IMAGE_GRAPH,
|
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +108,7 @@ export const buildCanvasSDXLTextToImageGraph = (
|
|||||||
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
||||||
// TODO: Actually create the graph correctly for ONNX
|
// TODO: Actually create the graph correctly for ONNX
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: TEXT_TO_IMAGE_GRAPH,
|
id: CANVAS_TEXT_TO_IMAGE_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[modelLoaderNodeId]: {
|
[modelLoaderNodeId]: {
|
||||||
type: modelLoaderNodeType,
|
type: modelLoaderNodeType,
|
||||||
|
@ -14,6 +14,7 @@ import { addVAEToGraph } from './addVAEToGraph';
|
|||||||
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
|
||||||
import {
|
import {
|
||||||
CANVAS_OUTPUT,
|
CANVAS_OUTPUT,
|
||||||
|
CANVAS_TEXT_TO_IMAGE_GRAPH,
|
||||||
CLIP_SKIP,
|
CLIP_SKIP,
|
||||||
DENOISE_LATENTS,
|
DENOISE_LATENTS,
|
||||||
MAIN_MODEL_LOADER,
|
MAIN_MODEL_LOADER,
|
||||||
@ -22,7 +23,6 @@ import {
|
|||||||
NOISE,
|
NOISE,
|
||||||
ONNX_MODEL_LOADER,
|
ONNX_MODEL_LOADER,
|
||||||
POSITIVE_CONDITIONING,
|
POSITIVE_CONDITIONING,
|
||||||
TEXT_TO_IMAGE_GRAPH,
|
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +101,7 @@ export const buildCanvasTextToImageGraph = (
|
|||||||
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
||||||
// TODO: Actually create the graph correctly for ONNX
|
// TODO: Actually create the graph correctly for ONNX
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: TEXT_TO_IMAGE_GRAPH,
|
id: CANVAS_TEXT_TO_IMAGE_GRAPH,
|
||||||
nodes: {
|
nodes: {
|
||||||
[modelLoaderNodeId]: {
|
[modelLoaderNodeId]: {
|
||||||
type: modelLoaderNodeType,
|
type: modelLoaderNodeType,
|
||||||
|
@ -49,7 +49,10 @@ export const SDXL_REFINER_LATENTS_TO_LATENTS = 'l2l_sdxl_refiner';
|
|||||||
|
|
||||||
// friendly graph ids
|
// friendly graph ids
|
||||||
export const TEXT_TO_IMAGE_GRAPH = 'text_to_image_graph';
|
export const TEXT_TO_IMAGE_GRAPH = 'text_to_image_graph';
|
||||||
|
export const IMAGE_TO_IMAGE_GRAPH = 'image_to_image_graph';
|
||||||
|
export const CANVAS_TEXT_TO_IMAGE_GRAPH = 'canvas_text_to_image_graph';
|
||||||
|
export const CANVAS_IMAGE_TO_IMAGE_GRAPH = 'canvas_image_to_image_graph';
|
||||||
|
export const CANVAS_INPAINT_GRAPH = 'canvas_inpaint_graph';
|
||||||
|
export const CANVAS_OUTPAINT_GRAPH = 'canvas_outpaint_graph';
|
||||||
export const SDXL_TEXT_TO_IMAGE_GRAPH = 'sdxl_text_to_image_graph';
|
export const SDXL_TEXT_TO_IMAGE_GRAPH = 'sdxl_text_to_image_graph';
|
||||||
export const SDXL_IMAGE_TO_IMAGE_GRAPH = 'sxdl_image_to_image_graph';
|
export const SDXL_IMAGE_TO_IMAGE_GRAPH = 'sxdl_image_to_image_graph';
|
||||||
export const IMAGE_TO_IMAGE_GRAPH = 'image_to_image_graph';
|
|
||||||
export const INPAINT_GRAPH = 'inpaint_graph';
|
|
||||||
|
Loading…
Reference in New Issue
Block a user