chore: Rename canvas refine elements to have more apt names

This commit is contained in:
blessedcoolant 2023-08-24 05:28:34 +12:00 committed by Kent Keirsey
parent 5141e82f88
commit 7e4009a58e
9 changed files with 64 additions and 65 deletions

View File

@ -19,6 +19,7 @@ import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import {
CANVAS_OUTPAINT_GRAPH,
CANVAS_OUTPUT,
CANVAS_REFINE_DENOISE_LATENTS,
CLIP_SKIP,
DENOISE_LATENTS,
INPAINT_IMAGE,
@ -36,7 +37,6 @@ import {
MASK_RESIZE_UP,
NEGATIVE_CONDITIONING,
NOISE,
OUTPAINT_REFINE_DENOISE_LATENTS,
POSITIVE_CONDITIONING,
RANDOM_INT,
RANGE_OF_SIZE,
@ -67,8 +67,8 @@ export const buildCanvasOutpaintGraph = (
shouldUseCpuNoise,
maskBlur,
maskBlurMethod,
refineSteps,
refineStrength,
canvasRefineSteps,
canvasRefineStrength,
tileSize,
infillMethod,
clipSkip,
@ -167,14 +167,14 @@ export const buildCanvasOutpaintGraph = (
denoising_start: 1 - strength,
denoising_end: 1,
},
[OUTPAINT_REFINE_DENOISE_LATENTS]: {
[CANVAS_REFINE_DENOISE_LATENTS]: {
type: 'denoise_latents',
id: OUTPAINT_REFINE_DENOISE_LATENTS,
id: CANVAS_REFINE_DENOISE_LATENTS,
is_intermediate: true,
steps: refineSteps,
steps: canvasRefineSteps,
cfg_scale: cfg_scale,
scheduler: scheduler,
denoising_start: 1 - refineStrength,
denoising_start: 1 - canvasRefineStrength,
denoising_end: 1,
},
[LATENTS_TO_IMAGE]: {
@ -347,7 +347,7 @@ export const buildCanvasOutpaintGraph = (
field: 'unet',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'unet',
},
},
@ -357,7 +357,7 @@ export const buildCanvasOutpaintGraph = (
field: 'conditioning',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'positive_conditioning',
},
},
@ -367,7 +367,7 @@ export const buildCanvasOutpaintGraph = (
field: 'conditioning',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'negative_conditioning',
},
},
@ -377,7 +377,7 @@ export const buildCanvasOutpaintGraph = (
field: 'noise',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'noise',
},
},
@ -387,14 +387,14 @@ export const buildCanvasOutpaintGraph = (
field: 'latents',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'latents',
},
},
// Decode the result from Inpaint
{
source: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'latents',
},
destination: {

View File

@ -19,6 +19,7 @@ import { addVAEToGraph } from './addVAEToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import {
CANVAS_OUTPUT,
CANVAS_REFINE_DENOISE_LATENTS,
INPAINT_IMAGE,
INPAINT_IMAGE_RESIZE_DOWN,
INPAINT_IMAGE_RESIZE_UP,
@ -33,7 +34,6 @@ import {
MASK_RESIZE_UP,
NEGATIVE_CONDITIONING,
NOISE,
OUTPAINT_REFINE_DENOISE_LATENTS,
POSITIVE_CONDITIONING,
RANDOM_INT,
RANGE_OF_SIZE,
@ -67,8 +67,8 @@ export const buildCanvasSDXLOutpaintGraph = (
shouldUseCpuNoise,
maskBlur,
maskBlurMethod,
refineSteps,
refineStrength,
canvasRefineSteps,
canvasRefineStrength,
tileSize,
infillMethod,
} = state.generation;
@ -172,14 +172,14 @@ export const buildCanvasSDXLOutpaintGraph = (
: 1 - strength,
denoising_end: shouldUseSDXLRefiner ? refinerStart : 1,
},
[OUTPAINT_REFINE_DENOISE_LATENTS]: {
[CANVAS_REFINE_DENOISE_LATENTS]: {
type: 'denoise_latents',
id: OUTPAINT_REFINE_DENOISE_LATENTS,
id: CANVAS_REFINE_DENOISE_LATENTS,
is_intermediate: true,
steps: refineSteps,
steps: canvasRefineSteps,
cfg_scale: cfg_scale,
scheduler: scheduler,
denoising_start: 1 - refineStrength,
denoising_start: 1 - canvasRefineStrength,
denoising_end: 1,
},
[LATENTS_TO_IMAGE]: {
@ -361,7 +361,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'unet',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'unet',
},
},
@ -371,7 +371,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'conditioning',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'positive_conditioning',
},
},
@ -381,7 +381,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'conditioning',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'negative_conditioning',
},
},
@ -391,7 +391,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'noise',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'noise',
},
},
@ -401,14 +401,14 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'latents',
},
destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'latents',
},
},
// Decode inpainted latents to image
{
source: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS,
node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'latents',
},
destination: {
@ -664,7 +664,7 @@ export const buildCanvasSDXLOutpaintGraph = (
// Add Refiner if enabled
if (shouldUseSDXLRefiner) {
addSDXLRefinerToGraph(state, graph, OUTPAINT_REFINE_DENOISE_LATENTS);
addSDXLRefinerToGraph(state, graph, CANVAS_REFINE_DENOISE_LATENTS);
}
// optionally add custom VAE

View File

@ -25,8 +25,7 @@ export const INPAINT_IMAGE_RESIZE_DOWN = 'inpaint_image_resize_down';
export const INPAINT_INFILL = 'inpaint_infill';
export const INPAINT_INFILL_RESIZE_DOWN = 'inpaint_infill_resize_down';
export const INPAINT_FINAL_IMAGE = 'inpaint_final_image';
export const OUTPAINT_REFINE_DENOISE_LATENTS =
'outpaint_refine_denoise_latents';
export const CANVAS_REFINE_DENOISE_LATENTS = 'canvas_refine_denoise_latents';
export const MASK_FROM_ALPHA = 'tomask';
export const MASK_EDGE = 'mask_edge';
export const MASK_BLUR = 'mask_blur';

View File

@ -2,20 +2,20 @@ import { Flex } from '@chakra-ui/react';
import IAICollapse from 'common/components/IAICollapse';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import ParamRefineSteps from './ParamRefineSteps';
import ParamRefineStrength from './ParamRefineStrength';
import ParamCanvasRefineSteps from './ParamCanvasRefineSteps';
import ParamCanvasRefineStrength from './ParamCanvasRefineStrength';
const ParamRefinePassCollapse = () => {
const ParamCanvasRefinePassCollapse = () => {
const { t } = useTranslation();
return (
<IAICollapse label={t('parameters.refinePassHeader')}>
<Flex sx={{ flexDirection: 'column', gap: 2, paddingBottom: 2 }}>
<ParamRefineSteps />
<ParamRefineStrength />
<ParamCanvasRefineSteps />
<ParamCanvasRefineStrength />
</Flex>
</IAICollapse>
);
};
export default memo(ParamRefinePassCollapse);
export default memo(ParamCanvasRefinePassCollapse);

View File

@ -1,14 +1,14 @@
import type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAISlider from 'common/components/IAISlider';
import { setRefineSteps } from 'features/parameters/store/generationSlice';
import { setCanvasRefineSteps } from 'features/parameters/store/generationSlice';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const ParamRefineSteps = () => {
const ParamCanvasRefineSteps = () => {
const dispatch = useAppDispatch();
const refineSteps = useAppSelector(
(state: RootState) => state.generation.refineSteps
const canvasRefineSteps = useAppSelector(
(state: RootState) => state.generation.canvasRefineSteps
);
const { t } = useTranslation();
@ -19,18 +19,18 @@ const ParamRefineSteps = () => {
max={100}
step={1}
sliderNumberInputProps={{ max: 999 }}
value={refineSteps}
value={canvasRefineSteps}
onChange={(v) => {
dispatch(setRefineSteps(v));
dispatch(setCanvasRefineSteps(v));
}}
withInput
withSliderMarks
withReset
handleReset={() => {
dispatch(setRefineSteps(20));
dispatch(setCanvasRefineSteps(20));
}}
/>
);
};
export default memo(ParamRefineSteps);
export default memo(ParamCanvasRefineSteps);

View File

@ -1,14 +1,14 @@
import type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAISlider from 'common/components/IAISlider';
import { setRefineStrength } from 'features/parameters/store/generationSlice';
import { setCanvasRefineStrength } from 'features/parameters/store/generationSlice';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const ParamRefineStrength = () => {
const ParamCanvasRefineStrength = () => {
const dispatch = useAppDispatch();
const refineStrength = useAppSelector(
(state: RootState) => state.generation.refineStrength
const canvasRefineStrength = useAppSelector(
(state: RootState) => state.generation.canvasRefineStrength
);
const { t } = useTranslation();
@ -19,18 +19,18 @@ const ParamRefineStrength = () => {
max={1}
step={0.01}
sliderNumberInputProps={{ max: 999 }}
value={refineStrength}
value={canvasRefineStrength}
onChange={(v) => {
dispatch(setRefineStrength(v));
dispatch(setCanvasRefineStrength(v));
}}
withInput
withSliderMarks
withReset
handleReset={() => {
dispatch(setRefineStrength(0.3));
dispatch(setCanvasRefineStrength(0.3));
}}
/>
);
};
export default memo(ParamRefineStrength);
export default memo(ParamCanvasRefineStrength);

View File

@ -37,8 +37,8 @@ export interface GenerationState {
scheduler: SchedulerParam;
maskBlur: number;
maskBlurMethod: MaskBlurMethodParam;
refineSteps: number;
refineStrength: StrengthParam;
canvasRefineSteps: number;
canvasRefineStrength: StrengthParam;
seed: SeedParam;
seedWeights: string;
shouldFitToWidthHeight: boolean;
@ -76,8 +76,8 @@ export const initialGenerationState: GenerationState = {
scheduler: 'euler',
maskBlur: 16,
maskBlurMethod: 'box',
refineSteps: 20,
refineStrength: 0.3,
canvasRefineSteps: 20,
canvasRefineStrength: 0.3,
seed: 0,
seedWeights: '',
shouldFitToWidthHeight: true,
@ -204,11 +204,11 @@ export const generationSlice = createSlice({
setMaskBlurMethod: (state, action: PayloadAction<MaskBlurMethodParam>) => {
state.maskBlurMethod = action.payload;
},
setRefineSteps: (state, action: PayloadAction<number>) => {
state.refineSteps = action.payload;
setCanvasRefineSteps: (state, action: PayloadAction<number>) => {
state.canvasRefineSteps = action.payload;
},
setRefineStrength: (state, action: PayloadAction<number>) => {
state.refineStrength = action.payload;
setCanvasRefineStrength: (state, action: PayloadAction<number>) => {
state.canvasRefineStrength = action.payload;
},
setTileSize: (state, action: PayloadAction<number>) => {
state.tileSize = action.payload;
@ -318,8 +318,8 @@ export const {
setScheduler,
setMaskBlur,
setMaskBlurMethod,
setRefineSteps,
setRefineStrength,
setCanvasRefineSteps,
setCanvasRefineStrength,
setSeed,
setSeedWeights,
setShouldFitToWidthHeight,

View File

@ -2,7 +2,7 @@ import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/Para
import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse';
import ParamMaskAdjustmentCollapse from 'features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskAdjustmentCollapse';
import ParamRefinePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamRefinePassCollapse';
import ParamCanvasRefinePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamCanvasRefinePassCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamSDXLPromptArea from './ParamSDXLPromptArea';
@ -21,7 +21,7 @@ export default function SDXLUnifiedCanvasTabParameters() {
<ParamNoiseCollapse />
<ParamMaskAdjustmentCollapse />
<ParamInfillAndScalingCollapse />
<ParamRefinePassCollapse />
<ParamCanvasRefinePassCollapse />
</>
);
}

View File

@ -3,7 +3,7 @@ import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamAdvancedCollapse from 'features/parameters/components/Parameters/Advanced/ParamAdvancedCollapse';
import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse';
import ParamMaskAdjustmentCollapse from 'features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskAdjustmentCollapse';
import ParamRefinePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamRefinePassCollapse';
import ParamCanvasRefinePassCollapse from 'features/parameters/components/Parameters/Canvas/SeamPainting/ParamCanvasRefinePassCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamPromptArea from 'features/parameters/components/Parameters/Prompt/ParamPromptArea';
import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse';
@ -21,7 +21,7 @@ const UnifiedCanvasParameters = () => {
<ParamSymmetryCollapse />
<ParamMaskAdjustmentCollapse />
<ParamInfillAndScalingCollapse />
<ParamRefinePassCollapse />
<ParamCanvasRefinePassCollapse />
<ParamAdvancedCollapse />
</>
);