mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
hook up sharpness, structure, and creativity
This commit is contained in:
parent
2847f1b5ac
commit
d9b217d908
@ -61,8 +61,8 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
||||
const resizeNode = g.addNode({
|
||||
id: RESIZE,
|
||||
type: 'img_resize',
|
||||
width: upscaleInitialImage.width * SCALE, // TODO: handle floats
|
||||
height: upscaleInitialImage.height * SCALE, // TODO: handle floats
|
||||
width: ((upscaleInitialImage.width * SCALE) / 8) * 8,
|
||||
height: ((upscaleInitialImage.height * SCALE) / 8) * 8,
|
||||
resample_mode: "lanczos",
|
||||
})
|
||||
|
||||
@ -99,8 +99,8 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
||||
const tiledMultidiffusionNode = g.addNode({
|
||||
id: TILED_MULTI_DIFFUSION_DENOISE_LATENTS,
|
||||
type: 'tiled_multi_diffusion_denoise_latents',
|
||||
tile_height: 1024,
|
||||
tile_width: 1024,
|
||||
tile_height: 1024, // is this dependent on base model
|
||||
tile_width: 1024, // is this dependent on base model
|
||||
tile_overlap: 128,
|
||||
steps,
|
||||
cfg_scale,
|
||||
@ -109,12 +109,6 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
||||
denoising_end: 1
|
||||
});
|
||||
|
||||
const clipSkipNode = g.addNode({
|
||||
type: 'clip_skip',
|
||||
id: CLIP_SKIP,
|
||||
});
|
||||
|
||||
|
||||
let posCondNode; let negCondNode; let modelNode;
|
||||
|
||||
if (model.base === "sdxl") {
|
||||
@ -137,6 +131,10 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
||||
id: SDXL_MODEL_LOADER,
|
||||
model,
|
||||
});
|
||||
g.addEdge(modelNode, 'clip', posCondNode, 'clip');
|
||||
g.addEdge(modelNode, 'clip', negCondNode, 'clip');
|
||||
g.addEdge(modelNode, 'clip2', posCondNode, 'clip2');
|
||||
g.addEdge(modelNode, 'clip2', negCondNode, 'clip2');
|
||||
addSDXLLoRas(state, g, tiledMultidiffusionNode, modelNode, null, posCondNode, negCondNode);
|
||||
} else {
|
||||
posCondNode = g.addNode({
|
||||
@ -154,12 +152,17 @@ export const buildMultidiffusionUpscsaleGraph = async (state: RootState): Promis
|
||||
id: MAIN_MODEL_LOADER,
|
||||
model,
|
||||
});
|
||||
const clipSkipNode = g.addNode({
|
||||
type: 'clip_skip',
|
||||
id: CLIP_SKIP,
|
||||
});
|
||||
|
||||
g.addEdge(modelNode, 'clip', clipSkipNode, 'clip');
|
||||
g.addEdge(clipSkipNode, 'clip', posCondNode, 'clip');
|
||||
g.addEdge(clipSkipNode, 'clip', negCondNode, 'clip');
|
||||
addLoRAs(state, g, tiledMultidiffusionNode, modelNode, null, clipSkipNode, posCondNode, negCondNode);
|
||||
}
|
||||
|
||||
g.addEdge(modelNode, 'clip', clipSkipNode, 'clip');
|
||||
g.addEdge(clipSkipNode, 'clip', posCondNode, 'clip');
|
||||
g.addEdge(clipSkipNode, 'clip', negCondNode, 'clip');
|
||||
|
||||
let vaeNode;
|
||||
if (vae) {
|
||||
|
@ -1,36 +1,33 @@
|
||||
import { CompositeNumberInput, CompositeSlider, FormControl, FormLabel } from '@invoke-ai/ui-library';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
|
||||
import { setSteps } from 'features/parameters/store/generationSlice';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { creativityChanged } from '../../store/upscaleSlice';
|
||||
|
||||
const ParamCreativity = () => {
|
||||
const steps = useAppSelector((s) => s.generation.steps);
|
||||
const initial = useAppSelector((s) => s.config.sd.steps.initial);
|
||||
const sliderMin = useAppSelector((s) => s.config.sd.steps.sliderMin);
|
||||
const sliderMax = useAppSelector((s) => s.config.sd.steps.sliderMax);
|
||||
const numberInputMin = useAppSelector((s) => s.config.sd.steps.numberInputMin);
|
||||
const numberInputMax = useAppSelector((s) => s.config.sd.steps.numberInputMax);
|
||||
const coarseStep = useAppSelector((s) => s.config.sd.steps.coarseStep);
|
||||
const fineStep = useAppSelector((s) => s.config.sd.steps.fineStep);
|
||||
const creativity = useAppSelector((s) => s.upscale.creativity);
|
||||
const initial = 0;
|
||||
const sliderMin = -5;
|
||||
const sliderMax = 5;
|
||||
const numberInputMin = -5;
|
||||
const numberInputMax = 5;
|
||||
const coarseStep = 1;
|
||||
const fineStep = 1;
|
||||
const dispatch = useAppDispatch();
|
||||
const { t } = useTranslation();
|
||||
const marks = useMemo(() => [sliderMin, Math.floor(sliderMax / 2), sliderMax], [sliderMax, sliderMin]);
|
||||
const marks = useMemo(() => [sliderMin, 0, sliderMax], [sliderMax, sliderMin]);
|
||||
const onChange = useCallback(
|
||||
(v: number) => {
|
||||
dispatch(setSteps(v));
|
||||
dispatch(creativityChanged(v));
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
return (
|
||||
<FormControl>
|
||||
<InformationalPopover feature="paramSteps">
|
||||
<FormLabel>Creativity</FormLabel>
|
||||
</InformationalPopover>
|
||||
<FormLabel>Creativity</FormLabel>
|
||||
<CompositeSlider
|
||||
value={steps}
|
||||
value={creativity}
|
||||
defaultValue={initial}
|
||||
min={sliderMin}
|
||||
max={sliderMax}
|
||||
@ -40,7 +37,7 @@ const ParamCreativity = () => {
|
||||
marks={marks}
|
||||
/>
|
||||
<CompositeNumberInput
|
||||
value={steps}
|
||||
value={creativity}
|
||||
defaultValue={initial}
|
||||
min={numberInputMin}
|
||||
max={numberInputMax}
|
||||
|
@ -1,36 +1,33 @@
|
||||
import { CompositeNumberInput, CompositeSlider, FormControl, FormLabel } from '@invoke-ai/ui-library';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
|
||||
import { setSteps } from 'features/parameters/store/generationSlice';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { sharpnessChanged } from '../../store/upscaleSlice';
|
||||
|
||||
const ParamSharpness = () => {
|
||||
const steps = useAppSelector((s) => s.generation.steps);
|
||||
const initial = useAppSelector((s) => s.config.sd.steps.initial);
|
||||
const sliderMin = useAppSelector((s) => s.config.sd.steps.sliderMin);
|
||||
const sliderMax = useAppSelector((s) => s.config.sd.steps.sliderMax);
|
||||
const numberInputMin = useAppSelector((s) => s.config.sd.steps.numberInputMin);
|
||||
const numberInputMax = useAppSelector((s) => s.config.sd.steps.numberInputMax);
|
||||
const coarseStep = useAppSelector((s) => s.config.sd.steps.coarseStep);
|
||||
const fineStep = useAppSelector((s) => s.config.sd.steps.fineStep);
|
||||
const sharpness = useAppSelector((s) => s.upscale.sharpness);
|
||||
const initial = 0;
|
||||
const sliderMin = -5;
|
||||
const sliderMax = 5;
|
||||
const numberInputMin = -5;
|
||||
const numberInputMax = 5;
|
||||
const coarseStep = 1;
|
||||
const fineStep = 1;
|
||||
const dispatch = useAppDispatch();
|
||||
const { t } = useTranslation();
|
||||
const marks = useMemo(() => [sliderMin, Math.floor(sliderMax / 2), sliderMax], [sliderMax, sliderMin]);
|
||||
const marks = useMemo(() => [sliderMin, 0, sliderMax], [sliderMax, sliderMin]);
|
||||
const onChange = useCallback(
|
||||
(v: number) => {
|
||||
dispatch(setSteps(v));
|
||||
dispatch(sharpnessChanged(v));
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
return (
|
||||
<FormControl>
|
||||
<InformationalPopover feature="paramSteps">
|
||||
<FormLabel>Sharpness</FormLabel>
|
||||
</InformationalPopover>
|
||||
<FormLabel>Sharpness</FormLabel>
|
||||
<CompositeSlider
|
||||
value={steps}
|
||||
value={sharpness}
|
||||
defaultValue={initial}
|
||||
min={sliderMin}
|
||||
max={sliderMax}
|
||||
@ -40,7 +37,7 @@ const ParamSharpness = () => {
|
||||
marks={marks}
|
||||
/>
|
||||
<CompositeNumberInput
|
||||
value={steps}
|
||||
value={sharpness}
|
||||
defaultValue={initial}
|
||||
min={numberInputMin}
|
||||
max={numberInputMax}
|
||||
|
@ -1,36 +1,33 @@
|
||||
import { CompositeNumberInput, CompositeSlider, FormControl, FormLabel } from '@invoke-ai/ui-library';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
|
||||
import { setSteps } from 'features/parameters/store/generationSlice';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { structureChanged } from '../../store/upscaleSlice';
|
||||
|
||||
const ParamStructure = () => {
|
||||
const steps = useAppSelector((s) => s.generation.steps);
|
||||
const initial = useAppSelector((s) => s.config.sd.steps.initial);
|
||||
const sliderMin = useAppSelector((s) => s.config.sd.steps.sliderMin);
|
||||
const sliderMax = useAppSelector((s) => s.config.sd.steps.sliderMax);
|
||||
const numberInputMin = useAppSelector((s) => s.config.sd.steps.numberInputMin);
|
||||
const numberInputMax = useAppSelector((s) => s.config.sd.steps.numberInputMax);
|
||||
const coarseStep = useAppSelector((s) => s.config.sd.steps.coarseStep);
|
||||
const fineStep = useAppSelector((s) => s.config.sd.steps.fineStep);
|
||||
const structure = useAppSelector((s) => s.upscale.structure);
|
||||
const initial = 0;
|
||||
const sliderMin = -5;
|
||||
const sliderMax = 5;
|
||||
const numberInputMin = -5;
|
||||
const numberInputMax = 5;
|
||||
const coarseStep = 1;
|
||||
const fineStep = 1;
|
||||
const dispatch = useAppDispatch();
|
||||
const { t } = useTranslation();
|
||||
const marks = useMemo(() => [sliderMin, Math.floor(sliderMax / 2), sliderMax], [sliderMax, sliderMin]);
|
||||
const marks = useMemo(() => [sliderMin, 0, sliderMax], [sliderMax, sliderMin]);
|
||||
const onChange = useCallback(
|
||||
(v: number) => {
|
||||
dispatch(setSteps(v));
|
||||
dispatch(structureChanged(v));
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
return (
|
||||
<FormControl>
|
||||
<InformationalPopover feature="paramSteps">
|
||||
<FormLabel>Structure</FormLabel>
|
||||
</InformationalPopover>
|
||||
<FormLabel>Structure</FormLabel>
|
||||
<CompositeSlider
|
||||
value={steps}
|
||||
value={structure}
|
||||
defaultValue={initial}
|
||||
min={sliderMin}
|
||||
max={sliderMax}
|
||||
@ -40,7 +37,7 @@ const ParamStructure = () => {
|
||||
marks={marks}
|
||||
/>
|
||||
<CompositeNumberInput
|
||||
value={steps}
|
||||
value={structure}
|
||||
defaultValue={initial}
|
||||
min={numberInputMin}
|
||||
max={numberInputMax}
|
||||
|
@ -38,10 +38,19 @@ export const upscaleSlice = createSlice({
|
||||
tiledVAEChanged: (state, action: PayloadAction<boolean>) => {
|
||||
state.tiledVAE = action.payload;
|
||||
},
|
||||
structureChanged: (state, action: PayloadAction<number>) => {
|
||||
state.structure = action.payload;
|
||||
},
|
||||
creativityChanged: (state, action: PayloadAction<number>) => {
|
||||
state.creativity = action.payload;
|
||||
},
|
||||
sharpnessChanged: (state, action: PayloadAction<number>) => {
|
||||
state.sharpness = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { upscaleModelChanged, upscaleInitialImageChanged, tiledVAEChanged } = upscaleSlice.actions;
|
||||
export const { upscaleModelChanged, upscaleInitialImageChanged, tiledVAEChanged, structureChanged, creativityChanged, sharpnessChanged } = upscaleSlice.actions;
|
||||
|
||||
export const selectUpscalelice = (state: RootState) => state.upscale;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user