fix(ui): remove unused scale param

This commit is contained in:
psychedelicious 2024-07-19 14:43:42 +10:00
parent d0265e21b0
commit 5266e9e682
2 changed files with 6 additions and 32 deletions

View File

@ -12,7 +12,6 @@ import {
NEGATIVE_CONDITIONING,
NOISE,
POSITIVE_CONDITIONING,
RESIZE,
SDXL_MODEL_LOADER,
SPANDREL,
TILED_MULTI_DIFFUSION_DENOISE_LATENTS,
@ -26,13 +25,12 @@ import { getBoardField, getSDXLStylePrompts } from './graphBuilderUtils';
export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promise<GraphType> => {
const { model, cfgScale: cfg_scale, scheduler, steps, vaePrecision, seed, vae } = state.generation;
const { positivePrompt, negativePrompt } = state.controlLayers.present;
const { upscaleModel, upscaleInitialImage, sharpness, structure, creativity, tiledVAE, scale, tileControlnetModel } =
const { upscaleModel, upscaleInitialImage, sharpness, structure, creativity, tiledVAE, tileControlnetModel } =
state.upscale;
assert(model, 'No model found in state');
assert(upscaleModel, 'No upscale model found in state');
assert(upscaleInitialImage, 'No initial image found in state');
assert(scale, 'Scale is required');
assert(tileControlnetModel, 'Tile controlnet is required');
const g = new Graph();
@ -63,24 +61,14 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
g.addEdge(upscaleNode, 'image', unsharpMaskNode2, 'image');
const resizeNode = g.addNode({
id: RESIZE,
type: 'img_resize',
width: ((upscaleInitialImage.width * scale) / 8) * 8,
height: ((upscaleInitialImage.height * scale) / 8) * 8,
resample_mode: 'lanczos',
});
g.addEdge(unsharpMaskNode2, 'image', resizeNode, 'image');
const noiseNode = g.addNode({
id: NOISE,
type: 'noise',
seed,
});
g.addEdge(resizeNode, 'width', noiseNode, 'width');
g.addEdge(resizeNode, 'height', noiseNode, 'height');
g.addEdge(unsharpMaskNode2, 'width', noiseNode, 'width');
g.addEdge(unsharpMaskNode2, 'height', noiseNode, 'height');
const i2lNode = g.addNode({
id: IMAGE_TO_LATENTS,
@ -89,7 +77,7 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
tiled: tiledVAE,
});
g.addEdge(resizeNode, 'image', i2lNode, 'image');
g.addEdge(unsharpMaskNode2, 'image', i2lNode, 'image');
const l2iNode = g.addNode({
type: 'l2i',
@ -199,7 +187,7 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
end_step_percent: (structure + 10) * 0.025 + 0.3,
});
g.addEdge(resizeNode, 'image', controlnetNode1, 'image');
g.addEdge(unsharpMaskNode2, 'image', controlnetNode1, 'image');
const controlnetNode2 = g.addNode({
id: 'controlnet_2',
@ -212,7 +200,7 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
end_step_percent: 0.8,
});
g.addEdge(resizeNode, 'image', controlnetNode2, 'image');
g.addEdge(unsharpMaskNode2, 'image', controlnetNode2, 'image');
const collectNode = g.addNode({
id: CONTROL_NET_COLLECT,

View File

@ -12,7 +12,6 @@ interface UpscaleState {
structure: number;
creativity: number;
tiledVAE: boolean;
scale: number | null;
tileControlnetModel: ControlNetModelConfig | null;
}
@ -24,7 +23,6 @@ const initialUpscaleState: UpscaleState = {
structure: 0,
creativity: 0,
tiledVAE: false,
scale: null,
tileControlnetModel: null,
};
@ -34,14 +32,6 @@ export const upscaleSlice = createSlice({
reducers: {
upscaleModelChanged: (state, action: PayloadAction<ParameterSpandrelImageToImageModel | null>) => {
state.upscaleModel = action.payload;
if (state.upscaleModel) {
const upscaleFactor = state.upscaleModel.name.match(/x(\d+)/);
if (upscaleFactor && upscaleFactor[1]) {
const scale = parseInt(upscaleFactor[1], 10);
state.scale = scale;
}
}
},
upscaleInitialImageChanged: (state, action: PayloadAction<ImageDTO | null>) => {
state.upscaleInitialImage = action.payload;
@ -58,9 +48,6 @@ export const upscaleSlice = createSlice({
sharpnessChanged: (state, action: PayloadAction<number>) => {
state.sharpness = action.payload;
},
scaleChanged: (state, action: PayloadAction<number | null>) => {
state.scale = action.payload;
},
tileControlnetModelChanged: (state, action: PayloadAction<ControlNetModelConfig | null>) => {
state.tileControlnetModel = action.payload;
},
@ -74,7 +61,6 @@ export const {
structureChanged,
creativityChanged,
sharpnessChanged,
scaleChanged,
tileControlnetModelChanged,
} = upscaleSlice.actions;