mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Add Save Intermediates Step Count
For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com>
This commit is contained in:
parent
6173e3e9ca
commit
383905d5d2
@ -616,7 +616,7 @@ class InvokeAIWebServer:
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
generation_parameters["progress_images"]
|
generation_parameters["progress_images"]
|
||||||
and step % 5 == 0
|
and step % generation_parameters['save_intermediates'] == 0
|
||||||
and step < generation_parameters["steps"] - 1
|
and step < generation_parameters["steps"] - 1
|
||||||
):
|
):
|
||||||
image = self.generate.sample_to_image(sample)
|
image = self.generate.sample_to_image(sample)
|
||||||
|
@ -62,7 +62,8 @@ export const frontendToBackendParameters = (
|
|||||||
shouldRandomizeSeed,
|
shouldRandomizeSeed,
|
||||||
} = optionsState;
|
} = optionsState;
|
||||||
|
|
||||||
const { shouldDisplayInProgressType } = systemState;
|
const { shouldDisplayInProgressType, saveIntermediatesInterval } =
|
||||||
|
systemState;
|
||||||
|
|
||||||
const generationParameters: { [k: string]: any } = {
|
const generationParameters: { [k: string]: any } = {
|
||||||
prompt,
|
prompt,
|
||||||
@ -78,6 +79,7 @@ export const frontendToBackendParameters = (
|
|||||||
seed,
|
seed,
|
||||||
progress_images: shouldDisplayInProgressType === 'full-res',
|
progress_images: shouldDisplayInProgressType === 'full-res',
|
||||||
progress_latents: shouldDisplayInProgressType === 'latents',
|
progress_latents: shouldDisplayInProgressType === 'latents',
|
||||||
|
save_intermediates: saveIntermediatesInterval,
|
||||||
};
|
};
|
||||||
|
|
||||||
generationParameters.seed = shouldRandomizeSeed
|
generationParameters.seed = shouldRandomizeSeed
|
||||||
|
@ -19,6 +19,7 @@ import { RootState, useAppDispatch, useAppSelector } from '../../../app/store';
|
|||||||
import { persistor } from '../../../main';
|
import { persistor } from '../../../main';
|
||||||
import {
|
import {
|
||||||
InProgressImageType,
|
InProgressImageType,
|
||||||
|
setSaveIntermediatesInterval,
|
||||||
setShouldConfirmOnDelete,
|
setShouldConfirmOnDelete,
|
||||||
setShouldDisplayGuides,
|
setShouldDisplayGuides,
|
||||||
setShouldDisplayInProgressType,
|
setShouldDisplayInProgressType,
|
||||||
@ -28,6 +29,7 @@ import ModelList from './ModelList';
|
|||||||
import { IN_PROGRESS_IMAGE_TYPES } from '../../../app/constants';
|
import { IN_PROGRESS_IMAGE_TYPES } from '../../../app/constants';
|
||||||
import IAISwitch from '../../../common/components/IAISwitch';
|
import IAISwitch from '../../../common/components/IAISwitch';
|
||||||
import IAISelect from '../../../common/components/IAISelect';
|
import IAISelect from '../../../common/components/IAISelect';
|
||||||
|
import IAINumberInput from '../../../common/components/IAINumberInput';
|
||||||
|
|
||||||
const systemSelector = createSelector(
|
const systemSelector = createSelector(
|
||||||
(state: RootState) => state.system,
|
(state: RootState) => state.system,
|
||||||
@ -64,6 +66,12 @@ type SettingsModalProps = {
|
|||||||
const SettingsModal = ({ children }: SettingsModalProps) => {
|
const SettingsModal = ({ children }: SettingsModalProps) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
|
const saveIntermediatesInterval = useAppSelector(
|
||||||
|
(state: RootState) => state.system.saveIntermediatesInterval
|
||||||
|
);
|
||||||
|
|
||||||
|
const steps = useAppSelector((state: RootState) => state.options.steps);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isOpen: isSettingsModalOpen,
|
isOpen: isSettingsModalOpen,
|
||||||
onOpen: onSettingsModalOpen,
|
onOpen: onSettingsModalOpen,
|
||||||
@ -93,6 +101,12 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleChangeIntermediateSteps = (value: number) => {
|
||||||
|
if (value > steps) value = steps;
|
||||||
|
if (value < 1) value = 1;
|
||||||
|
dispatch(setSaveIntermediatesInterval(value));
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{cloneElement(children, {
|
{cloneElement(children, {
|
||||||
@ -109,8 +123,11 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
|
|||||||
<div className="settings-modal-item">
|
<div className="settings-modal-item">
|
||||||
<ModelList />
|
<ModelList />
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className="settings-modal-item"
|
||||||
|
style={{ gridAutoFlow: 'row', rowGap: '0.5rem' }}
|
||||||
|
>
|
||||||
<IAISelect
|
<IAISelect
|
||||||
styleClass="settings-modal-item"
|
|
||||||
label={'Display In-Progress Images'}
|
label={'Display In-Progress Images'}
|
||||||
validValues={IN_PROGRESS_IMAGE_TYPES}
|
validValues={IN_PROGRESS_IMAGE_TYPES}
|
||||||
value={shouldDisplayInProgressType}
|
value={shouldDisplayInProgressType}
|
||||||
@ -122,7 +139,19 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
{shouldDisplayInProgressType === 'full-res' && (
|
||||||
|
<IAINumberInput
|
||||||
|
label="Save images every n steps"
|
||||||
|
min={1}
|
||||||
|
max={steps}
|
||||||
|
step={1}
|
||||||
|
onChange={handleChangeIntermediateSteps}
|
||||||
|
value={saveIntermediatesInterval}
|
||||||
|
width="auto"
|
||||||
|
textAlign="center"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<IAISwitch
|
<IAISwitch
|
||||||
styleClass="settings-modal-item"
|
styleClass="settings-modal-item"
|
||||||
label={'Confirm on Delete'}
|
label={'Confirm on Delete'}
|
||||||
|
@ -43,6 +43,7 @@ export interface SystemState
|
|||||||
shouldDisplayGuides: boolean;
|
shouldDisplayGuides: boolean;
|
||||||
wasErrorSeen: boolean;
|
wasErrorSeen: boolean;
|
||||||
isCancelable: boolean;
|
isCancelable: boolean;
|
||||||
|
saveIntermediatesInterval: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialSystemState: SystemState = {
|
const initialSystemState: SystemState = {
|
||||||
@ -72,6 +73,7 @@ const initialSystemState: SystemState = {
|
|||||||
hasError: false,
|
hasError: false,
|
||||||
wasErrorSeen: true,
|
wasErrorSeen: true,
|
||||||
isCancelable: true,
|
isCancelable: true,
|
||||||
|
saveIntermediatesInterval: 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const systemSlice = createSlice({
|
export const systemSlice = createSlice({
|
||||||
@ -186,6 +188,9 @@ export const systemSlice = createSlice({
|
|||||||
state.isProcessing = true;
|
state.isProcessing = true;
|
||||||
state.currentStatusHasSteps = false;
|
state.currentStatusHasSteps = false;
|
||||||
},
|
},
|
||||||
|
setSaveIntermediatesInterval: (state, action: PayloadAction<number>) => {
|
||||||
|
state.saveIntermediatesInterval = action.payload;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -208,6 +213,7 @@ export const {
|
|||||||
setModelList,
|
setModelList,
|
||||||
setIsCancelable,
|
setIsCancelable,
|
||||||
modelChangeRequested,
|
modelChangeRequested,
|
||||||
|
setSaveIntermediatesInterval,
|
||||||
} = systemSlice.actions;
|
} = systemSlice.actions;
|
||||||
|
|
||||||
export default systemSlice.reducer;
|
export default systemSlice.reducer;
|
||||||
|
Loading…
Reference in New Issue
Block a user