mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'main' into fix/ui/fix-progress-toggle
This commit is contained in:
commit
2c78ac4a13
@ -56,7 +56,6 @@ export type IAIFullSliderProps = {
|
|||||||
withInput?: boolean;
|
withInput?: boolean;
|
||||||
isInteger?: boolean;
|
isInteger?: boolean;
|
||||||
inputWidth?: string | number;
|
inputWidth?: string | number;
|
||||||
inputReadOnly?: boolean;
|
|
||||||
withReset?: boolean;
|
withReset?: boolean;
|
||||||
handleReset?: () => void;
|
handleReset?: () => void;
|
||||||
tooltipSuffix?: string;
|
tooltipSuffix?: string;
|
||||||
@ -90,7 +89,6 @@ const IAISlider = (props: IAIFullSliderProps) => {
|
|||||||
withInput = false,
|
withInput = false,
|
||||||
isInteger = false,
|
isInteger = false,
|
||||||
inputWidth = 16,
|
inputWidth = 16,
|
||||||
inputReadOnly = false,
|
|
||||||
withReset = false,
|
withReset = false,
|
||||||
hideTooltip = false,
|
hideTooltip = false,
|
||||||
isCompact = false,
|
isCompact = false,
|
||||||
@ -152,6 +150,7 @@ const IAISlider = (props: IAIFullSliderProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleInputChange = useCallback((v: number | string) => {
|
const handleInputChange = useCallback((v: number | string) => {
|
||||||
|
console.log('input');
|
||||||
setLocalInputValue(v);
|
setLocalInputValue(v);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -311,7 +310,6 @@ const IAISlider = (props: IAIFullSliderProps) => {
|
|||||||
{...sliderNumberInputProps}
|
{...sliderNumberInputProps}
|
||||||
>
|
>
|
||||||
<NumberInputField
|
<NumberInputField
|
||||||
readOnly={inputReadOnly}
|
|
||||||
minWidth={inputWidth}
|
minWidth={inputWidth}
|
||||||
{...sliderNumberInputFieldProps}
|
{...sliderNumberInputFieldProps}
|
||||||
/>
|
/>
|
||||||
|
@ -235,7 +235,6 @@ const IAICanvasToolChooserOptions = () => {
|
|||||||
withInput
|
withInput
|
||||||
onChange={(newSize) => dispatch(setBrushSize(newSize))}
|
onChange={(newSize) => dispatch(setBrushSize(newSize))}
|
||||||
sliderNumberInputProps={{ max: 500 }}
|
sliderNumberInputProps={{ max: 500 }}
|
||||||
inputReadOnly={false}
|
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
<IAIColorPicker
|
<IAIColorPicker
|
||||||
|
@ -51,7 +51,6 @@ const ParamDynamicPromptsMaxPrompts = () => {
|
|||||||
sliderNumberInputProps={{ max: inputMax }}
|
sliderNumberInputProps={{ max: inputMax }}
|
||||||
withSliderMarks
|
withSliderMarks
|
||||||
withInput
|
withInput
|
||||||
inputReadOnly
|
|
||||||
withReset
|
withReset
|
||||||
handleReset={handleReset}
|
handleReset={handleReset}
|
||||||
/>
|
/>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { log } from 'app/logging/useLogger';
|
import { log } from 'app/logging/useLogger';
|
||||||
import { RootState } from 'app/store/store';
|
import { RootState } from 'app/store/store';
|
||||||
import { NonNullableGraph } from 'features/nodes/types/types';
|
import { NonNullableGraph } from 'features/nodes/types/types';
|
||||||
|
import { initialGenerationState } from 'features/parameters/store/generationSlice';
|
||||||
import {
|
import {
|
||||||
ImageDTO,
|
ImageDTO,
|
||||||
ImageResizeInvocation,
|
ImageResizeInvocation,
|
||||||
@ -42,9 +43,8 @@ export const buildCanvasImageToImageGraph = (
|
|||||||
steps,
|
steps,
|
||||||
img2imgStrength: strength,
|
img2imgStrength: strength,
|
||||||
clipSkip,
|
clipSkip,
|
||||||
iterations,
|
shouldUseCpuNoise,
|
||||||
seed,
|
shouldUseNoiseSettings,
|
||||||
shouldRandomizeSeed,
|
|
||||||
} = state.generation;
|
} = state.generation;
|
||||||
|
|
||||||
// The bounding box determines width and height, not the width and height params
|
// The bounding box determines width and height, not the width and height params
|
||||||
@ -52,6 +52,10 @@ export const buildCanvasImageToImageGraph = (
|
|||||||
|
|
||||||
const model = modelIdToMainModelField(currentModel?.id || '');
|
const model = modelIdToMainModelField(currentModel?.id || '');
|
||||||
|
|
||||||
|
const use_cpu = shouldUseNoiseSettings
|
||||||
|
? shouldUseCpuNoise
|
||||||
|
: initialGenerationState.shouldUseCpuNoise;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
||||||
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
||||||
@ -78,6 +82,7 @@ export const buildCanvasImageToImageGraph = (
|
|||||||
[NOISE]: {
|
[NOISE]: {
|
||||||
type: 'noise',
|
type: 'noise',
|
||||||
id: NOISE,
|
id: NOISE,
|
||||||
|
use_cpu,
|
||||||
},
|
},
|
||||||
[MAIN_MODEL_LOADER]: {
|
[MAIN_MODEL_LOADER]: {
|
||||||
type: 'main_model_loader',
|
type: 'main_model_loader',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { RootState } from 'app/store/store';
|
import { RootState } from 'app/store/store';
|
||||||
import { NonNullableGraph } from 'features/nodes/types/types';
|
import { NonNullableGraph } from 'features/nodes/types/types';
|
||||||
|
import { initialGenerationState } from 'features/parameters/store/generationSlice';
|
||||||
import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph';
|
import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph';
|
||||||
import { modelIdToMainModelField } from '../modelIdToMainModelField';
|
import { modelIdToMainModelField } from '../modelIdToMainModelField';
|
||||||
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
|
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
|
||||||
@ -30,9 +31,8 @@ export const buildCanvasTextToImageGraph = (
|
|||||||
scheduler,
|
scheduler,
|
||||||
steps,
|
steps,
|
||||||
clipSkip,
|
clipSkip,
|
||||||
iterations,
|
shouldUseCpuNoise,
|
||||||
seed,
|
shouldUseNoiseSettings,
|
||||||
shouldRandomizeSeed,
|
|
||||||
} = state.generation;
|
} = state.generation;
|
||||||
|
|
||||||
// The bounding box determines width and height, not the width and height params
|
// The bounding box determines width and height, not the width and height params
|
||||||
@ -40,6 +40,10 @@ export const buildCanvasTextToImageGraph = (
|
|||||||
|
|
||||||
const model = modelIdToMainModelField(currentModel?.id || '');
|
const model = modelIdToMainModelField(currentModel?.id || '');
|
||||||
|
|
||||||
|
const use_cpu = shouldUseNoiseSettings
|
||||||
|
? shouldUseCpuNoise
|
||||||
|
: initialGenerationState.shouldUseCpuNoise;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
||||||
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
||||||
@ -68,6 +72,7 @@ export const buildCanvasTextToImageGraph = (
|
|||||||
id: NOISE,
|
id: NOISE,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
use_cpu,
|
||||||
},
|
},
|
||||||
[TEXT_TO_LATENTS]: {
|
[TEXT_TO_LATENTS]: {
|
||||||
type: 't2l',
|
type: 't2l',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { log } from 'app/logging/useLogger';
|
import { log } from 'app/logging/useLogger';
|
||||||
import { RootState } from 'app/store/store';
|
import { RootState } from 'app/store/store';
|
||||||
import { NonNullableGraph } from 'features/nodes/types/types';
|
import { NonNullableGraph } from 'features/nodes/types/types';
|
||||||
|
import { initialGenerationState } from 'features/parameters/store/generationSlice';
|
||||||
import {
|
import {
|
||||||
ImageCollectionInvocation,
|
ImageCollectionInvocation,
|
||||||
ImageResizeInvocation,
|
ImageResizeInvocation,
|
||||||
@ -48,6 +49,8 @@ export const buildLinearImageToImageGraph = (
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
clipSkip,
|
clipSkip,
|
||||||
|
shouldUseCpuNoise,
|
||||||
|
shouldUseNoiseSettings,
|
||||||
} = state.generation;
|
} = state.generation;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -75,6 +78,10 @@ export const buildLinearImageToImageGraph = (
|
|||||||
|
|
||||||
const model = modelIdToMainModelField(currentModel?.id || '');
|
const model = modelIdToMainModelField(currentModel?.id || '');
|
||||||
|
|
||||||
|
const use_cpu = shouldUseNoiseSettings
|
||||||
|
? shouldUseCpuNoise
|
||||||
|
: initialGenerationState.shouldUseCpuNoise;
|
||||||
|
|
||||||
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
// copy-pasted graph from node editor, filled in with state values & friendly node ids
|
||||||
const graph: NonNullableGraph = {
|
const graph: NonNullableGraph = {
|
||||||
id: IMAGE_TO_IMAGE_GRAPH,
|
id: IMAGE_TO_IMAGE_GRAPH,
|
||||||
@ -102,6 +109,7 @@ export const buildLinearImageToImageGraph = (
|
|||||||
[NOISE]: {
|
[NOISE]: {
|
||||||
type: 'noise',
|
type: 'noise',
|
||||||
id: NOISE,
|
id: NOISE,
|
||||||
|
use_cpu,
|
||||||
},
|
},
|
||||||
[LATENTS_TO_IMAGE]: {
|
[LATENTS_TO_IMAGE]: {
|
||||||
type: 'l2i',
|
type: 'l2i',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { RootState } from 'app/store/store';
|
import { RootState } from 'app/store/store';
|
||||||
import { NonNullableGraph } from 'features/nodes/types/types';
|
import { NonNullableGraph } from 'features/nodes/types/types';
|
||||||
|
import { initialGenerationState } from 'features/parameters/store/generationSlice';
|
||||||
import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph';
|
import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph';
|
||||||
import { modelIdToMainModelField } from '../modelIdToMainModelField';
|
import { modelIdToMainModelField } from '../modelIdToMainModelField';
|
||||||
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
|
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
|
||||||
@ -29,10 +30,16 @@ export const buildLinearTextToImageGraph = (
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
clipSkip,
|
clipSkip,
|
||||||
|
shouldUseCpuNoise,
|
||||||
|
shouldUseNoiseSettings,
|
||||||
} = state.generation;
|
} = state.generation;
|
||||||
|
|
||||||
const model = modelIdToMainModelField(currentModel?.id || '');
|
const model = modelIdToMainModelField(currentModel?.id || '');
|
||||||
|
|
||||||
|
const use_cpu = shouldUseNoiseSettings
|
||||||
|
? shouldUseCpuNoise
|
||||||
|
: initialGenerationState.shouldUseCpuNoise;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
|
||||||
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
* full graph here as a template. Then use the parameters from app state and set friendlier node
|
||||||
@ -71,6 +78,7 @@ export const buildLinearTextToImageGraph = (
|
|||||||
id: NOISE,
|
id: NOISE,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
use_cpu,
|
||||||
},
|
},
|
||||||
[TEXT_TO_LATENTS]: {
|
[TEXT_TO_LATENTS]: {
|
||||||
type: 't2l',
|
type: 't2l',
|
||||||
|
@ -59,7 +59,6 @@ const ParamBoundingBoxWidth = () => {
|
|||||||
sliderNumberInputProps={{ max: 4096 }}
|
sliderNumberInputProps={{ max: 4096 }}
|
||||||
withSliderMarks
|
withSliderMarks
|
||||||
withInput
|
withInput
|
||||||
inputReadOnly
|
|
||||||
withReset
|
withReset
|
||||||
handleReset={handleResetHeight}
|
handleReset={handleResetHeight}
|
||||||
/>
|
/>
|
||||||
|
@ -59,7 +59,6 @@ const ParamBoundingBoxWidth = () => {
|
|||||||
sliderNumberInputProps={{ max: 4096 }}
|
sliderNumberInputProps={{ max: 4096 }}
|
||||||
withSliderMarks
|
withSliderMarks
|
||||||
withInput
|
withInput
|
||||||
inputReadOnly
|
|
||||||
withReset
|
withReset
|
||||||
handleReset={handleResetWidth}
|
handleReset={handleResetWidth}
|
||||||
/>
|
/>
|
||||||
|
@ -58,7 +58,6 @@ const ParamScaledHeight = () => {
|
|||||||
sliderNumberInputProps={{ max: 4096 }}
|
sliderNumberInputProps={{ max: 4096 }}
|
||||||
withSliderMarks
|
withSliderMarks
|
||||||
withInput
|
withInput
|
||||||
inputReadOnly
|
|
||||||
withReset
|
withReset
|
||||||
handleReset={handleResetScaledHeight}
|
handleReset={handleResetScaledHeight}
|
||||||
/>
|
/>
|
||||||
|
@ -56,7 +56,6 @@ const ParamScaledWidth = () => {
|
|||||||
sliderNumberInputProps={{ max: 4096 }}
|
sliderNumberInputProps={{ max: 4096 }}
|
||||||
withSliderMarks
|
withSliderMarks
|
||||||
withInput
|
withInput
|
||||||
inputReadOnly
|
|
||||||
withReset
|
withReset
|
||||||
handleReset={handleResetScaledWidth}
|
handleReset={handleResetScaledWidth}
|
||||||
/>
|
/>
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
|
import { stateSelector } from 'app/store/store';
|
||||||
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
|
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
|
||||||
|
import IAISwitch from 'common/components/IAISwitch';
|
||||||
|
import { shouldUseCpuNoiseChanged } from 'features/parameters/store/generationSlice';
|
||||||
|
import { ChangeEvent } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
const selector = createSelector(
|
||||||
|
stateSelector,
|
||||||
|
(state) => {
|
||||||
|
const { shouldUseNoiseSettings, shouldUseCpuNoise } = state.generation;
|
||||||
|
return {
|
||||||
|
isDisabled: !shouldUseNoiseSettings,
|
||||||
|
shouldUseCpuNoise,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
defaultSelectorOptions
|
||||||
|
);
|
||||||
|
|
||||||
|
export const ParamCpuNoiseToggle = () => {
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
const { isDisabled, shouldUseCpuNoise } = useAppSelector(selector);
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const handleChange = (e: ChangeEvent<HTMLInputElement>) =>
|
||||||
|
dispatch(shouldUseCpuNoiseChanged(e.target.checked));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IAISwitch
|
||||||
|
isDisabled={isDisabled}
|
||||||
|
label="Use CPU Noise"
|
||||||
|
isChecked={shouldUseCpuNoise}
|
||||||
|
onChange={handleChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
@ -7,6 +7,7 @@ import IAICollapse from 'common/components/IAICollapse';
|
|||||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { ParamCpuNoiseToggle } from './ParamCpuNoise';
|
||||||
import ParamNoiseThreshold from './ParamNoiseThreshold';
|
import ParamNoiseThreshold from './ParamNoiseThreshold';
|
||||||
import { ParamNoiseToggle } from './ParamNoiseToggle';
|
import { ParamNoiseToggle } from './ParamNoiseToggle';
|
||||||
import ParamPerlinNoise from './ParamPerlinNoise';
|
import ParamPerlinNoise from './ParamPerlinNoise';
|
||||||
@ -40,6 +41,7 @@ const ParamNoiseCollapse = () => {
|
|||||||
>
|
>
|
||||||
<Flex sx={{ gap: 2, flexDirection: 'column' }}>
|
<Flex sx={{ gap: 2, flexDirection: 'column' }}>
|
||||||
<ParamNoiseToggle />
|
<ParamNoiseToggle />
|
||||||
|
<ParamCpuNoiseToggle />
|
||||||
<ParamPerlinNoise />
|
<ParamPerlinNoise />
|
||||||
<ParamNoiseThreshold />
|
<ParamNoiseThreshold />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -55,6 +55,7 @@ export interface GenerationState {
|
|||||||
seamlessXAxis: boolean;
|
seamlessXAxis: boolean;
|
||||||
seamlessYAxis: boolean;
|
seamlessYAxis: boolean;
|
||||||
clipSkip: number;
|
clipSkip: number;
|
||||||
|
shouldUseCpuNoise: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialGenerationState: GenerationState = {
|
export const initialGenerationState: GenerationState = {
|
||||||
@ -90,6 +91,7 @@ export const initialGenerationState: GenerationState = {
|
|||||||
seamlessXAxis: false,
|
seamlessXAxis: false,
|
||||||
seamlessYAxis: false,
|
seamlessYAxis: false,
|
||||||
clipSkip: 0,
|
clipSkip: 0,
|
||||||
|
shouldUseCpuNoise: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialState: GenerationState = initialGenerationState;
|
const initialState: GenerationState = initialGenerationState;
|
||||||
@ -239,6 +241,9 @@ export const generationSlice = createSlice({
|
|||||||
setClipSkip: (state, action: PayloadAction<number>) => {
|
setClipSkip: (state, action: PayloadAction<number>) => {
|
||||||
state.clipSkip = action.payload;
|
state.clipSkip = action.payload;
|
||||||
},
|
},
|
||||||
|
shouldUseCpuNoiseChanged: (state, action: PayloadAction<boolean>) => {
|
||||||
|
state.shouldUseCpuNoise = action.payload;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
builder.addCase(configChanged, (state, action) => {
|
builder.addCase(configChanged, (state, action) => {
|
||||||
@ -298,6 +303,7 @@ export const {
|
|||||||
setSeamlessXAxis,
|
setSeamlessXAxis,
|
||||||
setSeamlessYAxis,
|
setSeamlessYAxis,
|
||||||
setClipSkip,
|
setClipSkip,
|
||||||
|
shouldUseCpuNoiseChanged,
|
||||||
} = generationSlice.actions;
|
} = generationSlice.actions;
|
||||||
|
|
||||||
export default generationSlice.reducer;
|
export default generationSlice.reducer;
|
||||||
|
@ -48,7 +48,6 @@ export default function UnifiedCanvasBrushSize() {
|
|||||||
withInput
|
withInput
|
||||||
onChange={(newSize) => dispatch(setBrushSize(newSize))}
|
onChange={(newSize) => dispatch(setBrushSize(newSize))}
|
||||||
sliderNumberInputProps={{ max: 500 }}
|
sliderNumberInputProps={{ max: 500 }}
|
||||||
inputReadOnly={false}
|
|
||||||
isCompact
|
isCompact
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user