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

View File

@ -19,6 +19,7 @@ import { addVAEToGraph } from './addVAEToGraph';
import { addWatermarkerToGraph } from './addWatermarkerToGraph'; import { addWatermarkerToGraph } from './addWatermarkerToGraph';
import { import {
CANVAS_OUTPUT, CANVAS_OUTPUT,
CANVAS_REFINE_DENOISE_LATENTS,
INPAINT_IMAGE, INPAINT_IMAGE,
INPAINT_IMAGE_RESIZE_DOWN, INPAINT_IMAGE_RESIZE_DOWN,
INPAINT_IMAGE_RESIZE_UP, INPAINT_IMAGE_RESIZE_UP,
@ -33,7 +34,6 @@ import {
MASK_RESIZE_UP, MASK_RESIZE_UP,
NEGATIVE_CONDITIONING, NEGATIVE_CONDITIONING,
NOISE, NOISE,
OUTPAINT_REFINE_DENOISE_LATENTS,
POSITIVE_CONDITIONING, POSITIVE_CONDITIONING,
RANDOM_INT, RANDOM_INT,
RANGE_OF_SIZE, RANGE_OF_SIZE,
@ -67,8 +67,8 @@ export const buildCanvasSDXLOutpaintGraph = (
shouldUseCpuNoise, shouldUseCpuNoise,
maskBlur, maskBlur,
maskBlurMethod, maskBlurMethod,
refineSteps, canvasRefineSteps,
refineStrength, canvasRefineStrength,
tileSize, tileSize,
infillMethod, infillMethod,
} = state.generation; } = state.generation;
@ -172,14 +172,14 @@ export const buildCanvasSDXLOutpaintGraph = (
: 1 - strength, : 1 - strength,
denoising_end: shouldUseSDXLRefiner ? refinerStart : 1, denoising_end: shouldUseSDXLRefiner ? refinerStart : 1,
}, },
[OUTPAINT_REFINE_DENOISE_LATENTS]: { [CANVAS_REFINE_DENOISE_LATENTS]: {
type: 'denoise_latents', type: 'denoise_latents',
id: OUTPAINT_REFINE_DENOISE_LATENTS, id: CANVAS_REFINE_DENOISE_LATENTS,
is_intermediate: true, is_intermediate: true,
steps: refineSteps, steps: canvasRefineSteps,
cfg_scale: cfg_scale, cfg_scale: cfg_scale,
scheduler: scheduler, scheduler: scheduler,
denoising_start: 1 - refineStrength, denoising_start: 1 - canvasRefineStrength,
denoising_end: 1, denoising_end: 1,
}, },
[LATENTS_TO_IMAGE]: { [LATENTS_TO_IMAGE]: {
@ -361,7 +361,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'unet', field: 'unet',
}, },
destination: { destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS, node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'unet', field: 'unet',
}, },
}, },
@ -371,7 +371,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'conditioning', field: 'conditioning',
}, },
destination: { destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS, node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'positive_conditioning', field: 'positive_conditioning',
}, },
}, },
@ -381,7 +381,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'conditioning', field: 'conditioning',
}, },
destination: { destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS, node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'negative_conditioning', field: 'negative_conditioning',
}, },
}, },
@ -391,7 +391,7 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'noise', field: 'noise',
}, },
destination: { destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS, node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'noise', field: 'noise',
}, },
}, },
@ -401,14 +401,14 @@ export const buildCanvasSDXLOutpaintGraph = (
field: 'latents', field: 'latents',
}, },
destination: { destination: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS, node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'latents', field: 'latents',
}, },
}, },
// Decode inpainted latents to image // Decode inpainted latents to image
{ {
source: { source: {
node_id: OUTPAINT_REFINE_DENOISE_LATENTS, node_id: CANVAS_REFINE_DENOISE_LATENTS,
field: 'latents', field: 'latents',
}, },
destination: { destination: {
@ -664,7 +664,7 @@ export const buildCanvasSDXLOutpaintGraph = (
// Add Refiner if enabled // Add Refiner if enabled
if (shouldUseSDXLRefiner) { if (shouldUseSDXLRefiner) {
addSDXLRefinerToGraph(state, graph, OUTPAINT_REFINE_DENOISE_LATENTS); addSDXLRefinerToGraph(state, graph, CANVAS_REFINE_DENOISE_LATENTS);
} }
// optionally add custom VAE // 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 = 'inpaint_infill';
export const INPAINT_INFILL_RESIZE_DOWN = 'inpaint_infill_resize_down'; export const INPAINT_INFILL_RESIZE_DOWN = 'inpaint_infill_resize_down';
export const INPAINT_FINAL_IMAGE = 'inpaint_final_image'; export const INPAINT_FINAL_IMAGE = 'inpaint_final_image';
export const OUTPAINT_REFINE_DENOISE_LATENTS = export const CANVAS_REFINE_DENOISE_LATENTS = 'canvas_refine_denoise_latents';
'outpaint_refine_denoise_latents';
export const MASK_FROM_ALPHA = 'tomask'; export const MASK_FROM_ALPHA = 'tomask';
export const MASK_EDGE = 'mask_edge'; export const MASK_EDGE = 'mask_edge';
export const MASK_BLUR = 'mask_blur'; 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 IAICollapse from 'common/components/IAICollapse';
import { memo } from 'react'; import { memo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import ParamRefineSteps from './ParamRefineSteps'; import ParamCanvasRefineSteps from './ParamCanvasRefineSteps';
import ParamRefineStrength from './ParamRefineStrength'; import ParamCanvasRefineStrength from './ParamCanvasRefineStrength';
const ParamRefinePassCollapse = () => { const ParamCanvasRefinePassCollapse = () => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<IAICollapse label={t('parameters.refinePassHeader')}> <IAICollapse label={t('parameters.refinePassHeader')}>
<Flex sx={{ flexDirection: 'column', gap: 2, paddingBottom: 2 }}> <Flex sx={{ flexDirection: 'column', gap: 2, paddingBottom: 2 }}>
<ParamRefineSteps /> <ParamCanvasRefineSteps />
<ParamRefineStrength /> <ParamCanvasRefineStrength />
</Flex> </Flex>
</IAICollapse> </IAICollapse>
); );
}; };
export default memo(ParamRefinePassCollapse); export default memo(ParamCanvasRefinePassCollapse);

View File

@ -1,14 +1,14 @@
import type { RootState } from 'app/store/store'; import type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAISlider from 'common/components/IAISlider'; 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 { memo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const ParamRefineSteps = () => { const ParamCanvasRefineSteps = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const refineSteps = useAppSelector( const canvasRefineSteps = useAppSelector(
(state: RootState) => state.generation.refineSteps (state: RootState) => state.generation.canvasRefineSteps
); );
const { t } = useTranslation(); const { t } = useTranslation();
@ -19,18 +19,18 @@ const ParamRefineSteps = () => {
max={100} max={100}
step={1} step={1}
sliderNumberInputProps={{ max: 999 }} sliderNumberInputProps={{ max: 999 }}
value={refineSteps} value={canvasRefineSteps}
onChange={(v) => { onChange={(v) => {
dispatch(setRefineSteps(v)); dispatch(setCanvasRefineSteps(v));
}} }}
withInput withInput
withSliderMarks withSliderMarks
withReset withReset
handleReset={() => { 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 type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAISlider from 'common/components/IAISlider'; 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 { memo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const ParamRefineStrength = () => { const ParamCanvasRefineStrength = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const refineStrength = useAppSelector( const canvasRefineStrength = useAppSelector(
(state: RootState) => state.generation.refineStrength (state: RootState) => state.generation.canvasRefineStrength
); );
const { t } = useTranslation(); const { t } = useTranslation();
@ -19,18 +19,18 @@ const ParamRefineStrength = () => {
max={1} max={1}
step={0.01} step={0.01}
sliderNumberInputProps={{ max: 999 }} sliderNumberInputProps={{ max: 999 }}
value={refineStrength} value={canvasRefineStrength}
onChange={(v) => { onChange={(v) => {
dispatch(setRefineStrength(v)); dispatch(setCanvasRefineStrength(v));
}} }}
withInput withInput
withSliderMarks withSliderMarks
withReset withReset
handleReset={() => { 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; scheduler: SchedulerParam;
maskBlur: number; maskBlur: number;
maskBlurMethod: MaskBlurMethodParam; maskBlurMethod: MaskBlurMethodParam;
refineSteps: number; canvasRefineSteps: number;
refineStrength: StrengthParam; canvasRefineStrength: StrengthParam;
seed: SeedParam; seed: SeedParam;
seedWeights: string; seedWeights: string;
shouldFitToWidthHeight: boolean; shouldFitToWidthHeight: boolean;
@ -76,8 +76,8 @@ export const initialGenerationState: GenerationState = {
scheduler: 'euler', scheduler: 'euler',
maskBlur: 16, maskBlur: 16,
maskBlurMethod: 'box', maskBlurMethod: 'box',
refineSteps: 20, canvasRefineSteps: 20,
refineStrength: 0.3, canvasRefineStrength: 0.3,
seed: 0, seed: 0,
seedWeights: '', seedWeights: '',
shouldFitToWidthHeight: true, shouldFitToWidthHeight: true,
@ -204,11 +204,11 @@ export const generationSlice = createSlice({
setMaskBlurMethod: (state, action: PayloadAction<MaskBlurMethodParam>) => { setMaskBlurMethod: (state, action: PayloadAction<MaskBlurMethodParam>) => {
state.maskBlurMethod = action.payload; state.maskBlurMethod = action.payload;
}, },
setRefineSteps: (state, action: PayloadAction<number>) => { setCanvasRefineSteps: (state, action: PayloadAction<number>) => {
state.refineSteps = action.payload; state.canvasRefineSteps = action.payload;
}, },
setRefineStrength: (state, action: PayloadAction<number>) => { setCanvasRefineStrength: (state, action: PayloadAction<number>) => {
state.refineStrength = action.payload; state.canvasRefineStrength = action.payload;
}, },
setTileSize: (state, action: PayloadAction<number>) => { setTileSize: (state, action: PayloadAction<number>) => {
state.tileSize = action.payload; state.tileSize = action.payload;
@ -318,8 +318,8 @@ export const {
setScheduler, setScheduler,
setMaskBlur, setMaskBlur,
setMaskBlurMethod, setMaskBlurMethod,
setRefineSteps, setCanvasRefineSteps,
setRefineStrength, setCanvasRefineStrength,
setSeed, setSeed,
setSeedWeights, setSeedWeights,
setShouldFitToWidthHeight, setShouldFitToWidthHeight,

View File

@ -2,7 +2,7 @@ import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/Para
import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse'; import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse'; import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse';
import ParamMaskAdjustmentCollapse from 'features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskAdjustmentCollapse'; 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 ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse'; import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamSDXLPromptArea from './ParamSDXLPromptArea'; import ParamSDXLPromptArea from './ParamSDXLPromptArea';
@ -21,7 +21,7 @@ export default function SDXLUnifiedCanvasTabParameters() {
<ParamNoiseCollapse /> <ParamNoiseCollapse />
<ParamMaskAdjustmentCollapse /> <ParamMaskAdjustmentCollapse />
<ParamInfillAndScalingCollapse /> <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 ParamAdvancedCollapse from 'features/parameters/components/Parameters/Advanced/ParamAdvancedCollapse';
import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse'; import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse';
import ParamMaskAdjustmentCollapse from 'features/parameters/components/Parameters/Canvas/MaskAdjustment/ParamMaskAdjustmentCollapse'; 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 ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamPromptArea from 'features/parameters/components/Parameters/Prompt/ParamPromptArea'; import ParamPromptArea from 'features/parameters/components/Parameters/Prompt/ParamPromptArea';
import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse'; import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse';
@ -21,7 +21,7 @@ const UnifiedCanvasParameters = () => {
<ParamSymmetryCollapse /> <ParamSymmetryCollapse />
<ParamMaskAdjustmentCollapse /> <ParamMaskAdjustmentCollapse />
<ParamInfillAndScalingCollapse /> <ParamInfillAndScalingCollapse />
<ParamRefinePassCollapse /> <ParamCanvasRefinePassCollapse />
<ParamAdvancedCollapse /> <ParamAdvancedCollapse />
</> </>
); );