mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
add limited metadata
This commit is contained in:
parent
fb4b3f3350
commit
890a3ce32a
@ -22,6 +22,8 @@ import {
|
|||||||
import { addLoRAs } from './generation/addLoRAs';
|
import { addLoRAs } from './generation/addLoRAs';
|
||||||
import { addSDXLLoRas } from './generation/addSDXLLoRAs';
|
import { addSDXLLoRas } from './generation/addSDXLLoRAs';
|
||||||
import { getBoardField, getSDXLStylePrompts } from './graphBuilderUtils';
|
import { getBoardField, getSDXLStylePrompts } from './graphBuilderUtils';
|
||||||
|
import { fetchModelConfigWithTypeGuard } from '../../../metadata/util/modelFetchingHelpers';
|
||||||
|
import { isNonRefinerMainModelConfig } from '../../../../services/api/types';
|
||||||
|
|
||||||
export const UPSCALE_SCALE = 2;
|
export const UPSCALE_SCALE = 2;
|
||||||
|
|
||||||
@ -36,6 +38,9 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
|||||||
assert(upscaleInitialImage, 'No initial image found in state');
|
assert(upscaleInitialImage, 'No initial image found in state');
|
||||||
assert(tileControlnetModel, 'Tile controlnet is required');
|
assert(tileControlnetModel, 'Tile controlnet is required');
|
||||||
|
|
||||||
|
const outputWidth = ((upscaleInitialImage.width * UPSCALE_SCALE) / 8) * 8
|
||||||
|
const outputHeight = ((upscaleInitialImage.height * UPSCALE_SCALE) / 8) * 8
|
||||||
|
|
||||||
const g = new Graph();
|
const g = new Graph();
|
||||||
|
|
||||||
const unsharpMaskNode1 = g.addNode({
|
const unsharpMaskNode1 = g.addNode({
|
||||||
@ -64,11 +69,12 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
|||||||
|
|
||||||
g.addEdge(upscaleNode, 'image', unsharpMaskNode2, 'image');
|
g.addEdge(upscaleNode, 'image', unsharpMaskNode2, 'image');
|
||||||
|
|
||||||
|
|
||||||
const resizeNode = g.addNode({
|
const resizeNode = g.addNode({
|
||||||
id: RESIZE,
|
id: RESIZE,
|
||||||
type: 'img_resize',
|
type: 'img_resize',
|
||||||
width: ((upscaleInitialImage.width * UPSCALE_SCALE) / 8) * 8,
|
width: outputWidth,
|
||||||
height: ((upscaleInitialImage.height * UPSCALE_SCALE) / 8) * 8,
|
height: outputHeight,
|
||||||
resample_mode: 'lanczos',
|
resample_mode: 'lanczos',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -144,6 +150,23 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
|||||||
g.addEdge(modelNode, 'clip2', negCondNode, 'clip2');
|
g.addEdge(modelNode, 'clip2', negCondNode, 'clip2');
|
||||||
g.addEdge(modelNode, 'unet', tiledMultidiffusionNode, 'unet');
|
g.addEdge(modelNode, 'unet', tiledMultidiffusionNode, 'unet');
|
||||||
addSDXLLoRas(state, g, tiledMultidiffusionNode, modelNode, null, posCondNode, negCondNode);
|
addSDXLLoRas(state, g, tiledMultidiffusionNode, modelNode, null, posCondNode, negCondNode);
|
||||||
|
|
||||||
|
const modelConfig = await fetchModelConfigWithTypeGuard(model.key, isNonRefinerMainModelConfig);
|
||||||
|
|
||||||
|
g.upsertMetadata({
|
||||||
|
cfg_scale,
|
||||||
|
height: outputHeight,
|
||||||
|
width: outputWidth,
|
||||||
|
positive_prompt: positivePrompt,
|
||||||
|
negative_prompt: negativePrompt,
|
||||||
|
positive_style_prompt: positiveStylePrompt,
|
||||||
|
negative_style_prompt: negativeStylePrompt,
|
||||||
|
model: Graph.getModelMetadataField(modelConfig),
|
||||||
|
seed,
|
||||||
|
steps,
|
||||||
|
scheduler,
|
||||||
|
vae: vae ?? undefined,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
posCondNode = g.addNode({
|
posCondNode = g.addNode({
|
||||||
type: 'compel',
|
type: 'compel',
|
||||||
@ -170,8 +193,25 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
|||||||
g.addEdge(clipSkipNode, 'clip', negCondNode, 'clip');
|
g.addEdge(clipSkipNode, 'clip', negCondNode, 'clip');
|
||||||
g.addEdge(modelNode, 'unet', tiledMultidiffusionNode, 'unet');
|
g.addEdge(modelNode, 'unet', tiledMultidiffusionNode, 'unet');
|
||||||
addLoRAs(state, g, tiledMultidiffusionNode, modelNode, null, clipSkipNode, posCondNode, negCondNode);
|
addLoRAs(state, g, tiledMultidiffusionNode, modelNode, null, clipSkipNode, posCondNode, negCondNode);
|
||||||
|
|
||||||
|
const modelConfig = await fetchModelConfigWithTypeGuard(model.key, isNonRefinerMainModelConfig);
|
||||||
|
|
||||||
|
g.upsertMetadata({
|
||||||
|
cfg_scale,
|
||||||
|
height: outputHeight,
|
||||||
|
width: outputWidth,
|
||||||
|
positive_prompt: positivePrompt,
|
||||||
|
negative_prompt: negativePrompt,
|
||||||
|
model: Graph.getModelMetadataField(modelConfig),
|
||||||
|
seed,
|
||||||
|
steps,
|
||||||
|
scheduler,
|
||||||
|
vae: vae ?? undefined,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g.setMetadataReceivingNode(l2iNode);
|
||||||
|
|
||||||
let vaeNode;
|
let vaeNode;
|
||||||
if (vae) {
|
if (vae) {
|
||||||
vaeNode = g.addNode({
|
vaeNode = g.addNode({
|
||||||
|
Loading…
Reference in New Issue
Block a user