mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Only generate 1 iteration when seed fixed & variations disabled
This commit is contained in:
parent
620cf84d3d
commit
7e55bdefce
@ -66,7 +66,8 @@ export const frontendToBackendParameters = (
|
||||
|
||||
const generationParameters: { [k: string]: any } = {
|
||||
prompt,
|
||||
iterations,
|
||||
iterations:
|
||||
shouldRandomizeSeed || shouldGenerateVariations ? iterations : 1,
|
||||
steps,
|
||||
cfg_scale: cfgScale,
|
||||
threshold,
|
||||
@ -76,7 +77,7 @@ export const frontendToBackendParameters = (
|
||||
sampler_name: sampler,
|
||||
seed,
|
||||
progress_images: shouldDisplayInProgressType === 'full-res',
|
||||
progress_latents: shouldDisplayInProgressType === 'latents'
|
||||
progress_latents: shouldDisplayInProgressType === 'latents',
|
||||
};
|
||||
|
||||
generationParameters.seed = shouldRandomizeSeed
|
||||
|
@ -1,13 +1,33 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import { RootState, useAppDispatch, useAppSelector } from '../../../app/store';
|
||||
import IAINumberInput from '../../../common/components/IAINumberInput';
|
||||
import { setIterations } from '../optionsSlice';
|
||||
import { mayGenerateMultipleImagesSelector } from '../optionsSelectors';
|
||||
import { OptionsState, setIterations } from '../optionsSlice';
|
||||
import { fontSize, inputWidth } from './MainOptions';
|
||||
|
||||
const mainIterationsSelector = createSelector(
|
||||
[(state: RootState) => state.options, mayGenerateMultipleImagesSelector],
|
||||
(options: OptionsState, mayGenerateMultipleImages) => {
|
||||
const { iterations } = options;
|
||||
|
||||
return {
|
||||
iterations,
|
||||
mayGenerateMultipleImages,
|
||||
};
|
||||
},
|
||||
{
|
||||
memoizeOptions: {
|
||||
resultEqualityCheck: _.isEqual,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
export default function MainIterations() {
|
||||
const dispatch = useAppDispatch();
|
||||
const iterations = useAppSelector(
|
||||
(state: RootState) => state.options.iterations
|
||||
const { iterations, mayGenerateMultipleImages } = useAppSelector(
|
||||
mainIterationsSelector
|
||||
);
|
||||
|
||||
const handleChangeIterations = (v: number) => dispatch(setIterations(v));
|
||||
@ -18,6 +38,7 @@ export default function MainIterations() {
|
||||
step={1}
|
||||
min={1}
|
||||
max={9999}
|
||||
isDisabled={!mayGenerateMultipleImages}
|
||||
onChange={handleChangeIterations}
|
||||
value={iterations}
|
||||
width={inputWidth}
|
||||
|
@ -13,3 +13,17 @@ export const activeTabNameSelector = createSelector(
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
export const mayGenerateMultipleImagesSelector = createSelector(
|
||||
(state: RootState) => state.options,
|
||||
(options: OptionsState) => {
|
||||
const { shouldRandomizeSeed, shouldGenerateVariations } = options;
|
||||
|
||||
return shouldRandomizeSeed || shouldGenerateVariations;
|
||||
},
|
||||
{
|
||||
memoizeOptions: {
|
||||
resultEqualityCheck: _.isEqual,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user