mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): missing vae precision in graph builders
This commit is contained in:
parent
059b7a0fcf
commit
17d3275086
@ -14,7 +14,8 @@ export const addImageToImage = async (
|
||||
originalSize: Dimensions,
|
||||
scaledSize: Dimensions,
|
||||
bbox: CanvasV2State['bbox'],
|
||||
denoising_start: number
|
||||
denoising_start: number,
|
||||
fp32: boolean
|
||||
): Promise<Invocation<'img_resize' | 'l2i'>> => {
|
||||
denoise.denoising_start = denoising_start;
|
||||
|
||||
@ -28,7 +29,7 @@ export const addImageToImage = async (
|
||||
image: { image_name },
|
||||
...scaledSize,
|
||||
});
|
||||
const i2l = g.addNode({ id: 'i2l', type: 'i2l' });
|
||||
const i2l = g.addNode({ id: 'i2l', type: 'i2l', fp32 });
|
||||
const resizeImageToOriginalSize = g.addNode({
|
||||
type: 'img_resize',
|
||||
id: getPrefixedId('initial_image_resize_out'),
|
||||
@ -43,8 +44,8 @@ export const addImageToImage = async (
|
||||
// This is the new output node
|
||||
return resizeImageToOriginalSize;
|
||||
} else {
|
||||
// No need to resize, just denoise
|
||||
const i2l = g.addNode({ id: 'i2l', type: 'i2l', image: { image_name } });
|
||||
// No need to resize, just decode
|
||||
const i2l = g.addNode({ id: 'i2l', type: 'i2l', image: { image_name }, fp32 });
|
||||
g.addEdge(vaeSource, 'vae', i2l, 'vae');
|
||||
g.addEdge(i2l, 'latents', denoise, 'latents');
|
||||
return l2i;
|
||||
|
@ -3,7 +3,6 @@ import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
|
||||
import { getPrefixedId } from 'features/controlLayers/konva/util';
|
||||
import type { CanvasV2State, Dimensions } from 'features/controlLayers/store/types';
|
||||
import type { Graph } from 'features/nodes/util/graph/generation/Graph';
|
||||
import type { ParameterPrecision } from 'features/parameters/types/parameterSchemas';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
|
||||
@ -20,7 +19,7 @@ export const addInpaint = async (
|
||||
bbox: CanvasV2State['bbox'],
|
||||
compositing: CanvasV2State['compositing'],
|
||||
denoising_start: number,
|
||||
vaePrecision: ParameterPrecision
|
||||
fp32: boolean
|
||||
): Promise<Invocation<'canvas_v2_mask_and_crop'>> => {
|
||||
denoise.denoising_start = denoising_start;
|
||||
|
||||
@ -30,7 +29,7 @@ export const addInpaint = async (
|
||||
|
||||
if (!isEqual(scaledSize, originalSize)) {
|
||||
// Scale before processing requires some resizing
|
||||
const i2l = g.addNode({ id: getPrefixedId('i2l'), type: 'i2l' });
|
||||
const i2l = g.addNode({ id: getPrefixedId('i2l'), type: 'i2l', fp32 });
|
||||
const resizeImageToScaledSize = g.addNode({
|
||||
type: 'img_resize',
|
||||
id: getPrefixedId('resize_image_to_scaled_size'),
|
||||
@ -64,7 +63,7 @@ export const addInpaint = async (
|
||||
coherence_mode: compositing.canvasCoherenceMode,
|
||||
minimum_denoise: compositing.canvasCoherenceMinDenoise,
|
||||
edge_radius: compositing.canvasCoherenceEdgeSize,
|
||||
fp32: vaePrecision === 'fp32',
|
||||
fp32,
|
||||
});
|
||||
const canvasPasteBack = g.addNode({
|
||||
id: getPrefixedId('canvas_v2_mask_and_crop'),
|
||||
@ -100,7 +99,12 @@ export const addInpaint = async (
|
||||
return canvasPasteBack;
|
||||
} else {
|
||||
// No scale before processing, much simpler
|
||||
const i2l = g.addNode({ id: getPrefixedId('i2l'), type: 'i2l', image: { image_name: initialImage.image_name } });
|
||||
const i2l = g.addNode({
|
||||
id: getPrefixedId('i2l'),
|
||||
type: 'i2l',
|
||||
image: { image_name: initialImage.image_name },
|
||||
fp32,
|
||||
});
|
||||
const alphaToMask = g.addNode({
|
||||
id: getPrefixedId('alpha_to_mask'),
|
||||
type: 'tomask',
|
||||
@ -113,7 +117,7 @@ export const addInpaint = async (
|
||||
coherence_mode: compositing.canvasCoherenceMode,
|
||||
minimum_denoise: compositing.canvasCoherenceMinDenoise,
|
||||
edge_radius: compositing.canvasCoherenceEdgeSize,
|
||||
fp32: vaePrecision === 'fp32',
|
||||
fp32,
|
||||
image: { image_name: initialImage.image_name },
|
||||
});
|
||||
const canvasPasteBack = g.addNode({
|
||||
|
@ -4,7 +4,6 @@ import { getPrefixedId } from 'features/controlLayers/konva/util';
|
||||
import type { CanvasV2State, Dimensions } from 'features/controlLayers/store/types';
|
||||
import type { Graph } from 'features/nodes/util/graph/generation/Graph';
|
||||
import { getInfill } from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import type { ParameterPrecision } from 'features/parameters/types/parameterSchemas';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
|
||||
@ -21,7 +20,7 @@ export const addOutpaint = async (
|
||||
bbox: CanvasV2State['bbox'],
|
||||
compositing: CanvasV2State['compositing'],
|
||||
denoising_start: number,
|
||||
vaePrecision: ParameterPrecision
|
||||
fp32: boolean
|
||||
): Promise<Invocation<'canvas_v2_mask_and_crop'>> => {
|
||||
denoise.denoising_start = denoising_start;
|
||||
|
||||
@ -76,7 +75,7 @@ export const addOutpaint = async (
|
||||
coherence_mode: compositing.canvasCoherenceMode,
|
||||
minimum_denoise: compositing.canvasCoherenceMinDenoise,
|
||||
edge_radius: compositing.canvasCoherenceEdgeSize,
|
||||
fp32: vaePrecision === 'fp32',
|
||||
fp32,
|
||||
});
|
||||
g.addEdge(infill, 'image', createGradientMask, 'image');
|
||||
g.addEdge(resizeInputMaskToScaledSize, 'image', createGradientMask, 'mask');
|
||||
@ -85,7 +84,7 @@ export const addOutpaint = async (
|
||||
g.addEdge(createGradientMask, 'denoise_mask', denoise, 'denoise_mask');
|
||||
|
||||
// Decode infilled image and connect to denoise
|
||||
const i2l = g.addNode({ id: getPrefixedId('i2l'), type: 'i2l' });
|
||||
const i2l = g.addNode({ id: getPrefixedId('i2l'), type: 'i2l', fp32 });
|
||||
g.addEdge(infill, 'image', i2l, 'image');
|
||||
g.addEdge(vaeSource, 'vae', i2l, 'vae');
|
||||
g.addEdge(i2l, 'latents', denoise, 'latents');
|
||||
@ -125,7 +124,7 @@ export const addOutpaint = async (
|
||||
} else {
|
||||
infill.image = { image_name: initialImage.image_name };
|
||||
// No scale before processing, much simpler
|
||||
const i2l = g.addNode({ id: getPrefixedId('i2l'), type: 'i2l' });
|
||||
const i2l = g.addNode({ id: getPrefixedId('i2l'), type: 'i2l', fp32 });
|
||||
const maskAlphaToMask = g.addNode({
|
||||
id: getPrefixedId('mask_alpha_to_mask'),
|
||||
type: 'tomask',
|
||||
@ -147,7 +146,7 @@ export const addOutpaint = async (
|
||||
coherence_mode: compositing.canvasCoherenceMode,
|
||||
minimum_denoise: compositing.canvasCoherenceMinDenoise,
|
||||
edge_radius: compositing.canvasCoherenceEdgeSize,
|
||||
fp32: vaePrecision === 'fp32',
|
||||
fp32,
|
||||
image: { image_name: initialImage.image_name },
|
||||
});
|
||||
const canvasPasteBack = g.addNode({
|
||||
|
@ -48,8 +48,8 @@ export const buildSD1Graph = async (
|
||||
|
||||
assert(model, 'No model found in state');
|
||||
|
||||
const fp32 = vaePrecision === 'fp32';
|
||||
const { positivePrompt, negativePrompt } = getPresetModifiedPrompts(state);
|
||||
|
||||
const { originalSize, scaledSize } = getSizes(bbox);
|
||||
|
||||
const g = new Graph(getPrefixedId('sd1_graph'));
|
||||
@ -102,7 +102,7 @@ export const buildSD1Graph = async (
|
||||
const l2i = g.addNode({
|
||||
type: 'l2i',
|
||||
id: getPrefixedId('l2i'),
|
||||
fp32: vaePrecision === 'fp32',
|
||||
fp32,
|
||||
});
|
||||
const vaeLoader =
|
||||
vae?.base === model.base
|
||||
@ -168,7 +168,8 @@ export const buildSD1Graph = async (
|
||||
originalSize,
|
||||
scaledSize,
|
||||
bbox,
|
||||
1 - params.img2imgStrength
|
||||
1 - params.img2imgStrength,
|
||||
vaePrecision === 'fp32'
|
||||
);
|
||||
} else if (generationMode === 'inpaint') {
|
||||
const { compositing } = state.canvasV2;
|
||||
@ -185,7 +186,7 @@ export const buildSD1Graph = async (
|
||||
bbox,
|
||||
compositing,
|
||||
1 - params.img2imgStrength,
|
||||
vaePrecision
|
||||
vaePrecision === 'fp32'
|
||||
);
|
||||
} else if (generationMode === 'outpaint') {
|
||||
const { compositing } = state.canvasV2;
|
||||
@ -202,7 +203,7 @@ export const buildSD1Graph = async (
|
||||
bbox,
|
||||
compositing,
|
||||
1 - params.img2imgStrength,
|
||||
vaePrecision
|
||||
fp32
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ export const buildSDXLGraph = async (
|
||||
|
||||
assert(model, 'No model found in state');
|
||||
|
||||
const fp32 = vaePrecision === 'fp32';
|
||||
const { originalSize, scaledSize } = getSizes(bbox);
|
||||
|
||||
const { positivePrompt, negativePrompt, positiveStylePrompt, negativeStylePrompt } = getPresetModifiedPrompts(state);
|
||||
|
||||
const g = new Graph(getPrefixedId('sdxl_graph'));
|
||||
@ -100,7 +100,7 @@ export const buildSDXLGraph = async (
|
||||
const l2i = g.addNode({
|
||||
type: 'l2i',
|
||||
id: getPrefixedId('l2i'),
|
||||
fp32: vaePrecision === 'fp32',
|
||||
fp32,
|
||||
});
|
||||
const vaeLoader =
|
||||
vae?.base === model.base
|
||||
@ -171,7 +171,8 @@ export const buildSDXLGraph = async (
|
||||
originalSize,
|
||||
scaledSize,
|
||||
bbox,
|
||||
refinerModel ? Math.min(refinerStart, 1 - params.img2imgStrength) : 1 - params.img2imgStrength
|
||||
refinerModel ? Math.min(refinerStart, 1 - params.img2imgStrength) : 1 - params.img2imgStrength,
|
||||
fp32
|
||||
);
|
||||
} else if (generationMode === 'inpaint') {
|
||||
const { compositing } = state.canvasV2;
|
||||
@ -188,7 +189,7 @@ export const buildSDXLGraph = async (
|
||||
bbox,
|
||||
compositing,
|
||||
refinerModel ? Math.min(refinerStart, 1 - params.img2imgStrength) : 1 - params.img2imgStrength,
|
||||
vaePrecision
|
||||
fp32
|
||||
);
|
||||
} else if (generationMode === 'outpaint') {
|
||||
const { compositing } = state.canvasV2;
|
||||
@ -205,7 +206,7 @@ export const buildSDXLGraph = async (
|
||||
bbox,
|
||||
compositing,
|
||||
refinerModel ? Math.min(refinerStart, 1 - params.img2imgStrength) : 1 - params.img2imgStrength,
|
||||
vaePrecision
|
||||
fp32
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user