mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'main' into feat/controlnet_extras
This commit is contained in:
commit
32883adf6e
@ -133,20 +133,19 @@ class StepParamEasingInvocation(BaseInvocation):
|
|||||||
postlist = list(num_poststeps * [self.post_end_value])
|
postlist = list(num_poststeps * [self.post_end_value])
|
||||||
|
|
||||||
if log_diagnostics:
|
if log_diagnostics:
|
||||||
logger = InvokeAILogger.getLogger(name="StepParamEasing")
|
context.services.logger.debug("start_step: " + str(start_step))
|
||||||
logger.debug("start_step: " + str(start_step))
|
context.services.logger.debug("end_step: " + str(end_step))
|
||||||
logger.debug("end_step: " + str(end_step))
|
context.services.logger.debug("num_easing_steps: " + str(num_easing_steps))
|
||||||
logger.debug("num_easing_steps: " + str(num_easing_steps))
|
context.services.logger.debug("num_presteps: " + str(num_presteps))
|
||||||
logger.debug("num_presteps: " + str(num_presteps))
|
context.services.logger.debug("num_poststeps: " + str(num_poststeps))
|
||||||
logger.debug("num_poststeps: " + str(num_poststeps))
|
context.services.logger.debug("prelist size: " + str(len(prelist)))
|
||||||
logger.debug("prelist size: " + str(len(prelist)))
|
context.services.logger.debug("postlist size: " + str(len(postlist)))
|
||||||
logger.debug("postlist size: " + str(len(postlist)))
|
context.services.logger.debug("prelist: " + str(prelist))
|
||||||
logger.debug("prelist: " + str(prelist))
|
context.services.logger.debug("postlist: " + str(postlist))
|
||||||
logger.debug("postlist: " + str(postlist))
|
|
||||||
|
|
||||||
easing_class = EASING_FUNCTIONS_MAP[self.easing]
|
easing_class = EASING_FUNCTIONS_MAP[self.easing]
|
||||||
if log_diagnostics:
|
if log_diagnostics:
|
||||||
logger.debug("easing class: " + str(easing_class))
|
context.services.logger.debug("easing class: " + str(easing_class))
|
||||||
easing_list = list()
|
easing_list = list()
|
||||||
if self.mirror: # "expected" mirroring
|
if self.mirror: # "expected" mirroring
|
||||||
# if number of steps is even, squeeze duration down to (number_of_steps)/2
|
# if number of steps is even, squeeze duration down to (number_of_steps)/2
|
||||||
@ -156,7 +155,7 @@ class StepParamEasingInvocation(BaseInvocation):
|
|||||||
# but if even then number_of_steps/2 === ceil(number_of_steps/2), so can just use ceil always
|
# but if even then number_of_steps/2 === ceil(number_of_steps/2), so can just use ceil always
|
||||||
|
|
||||||
base_easing_duration = int(np.ceil(num_easing_steps/2.0))
|
base_easing_duration = int(np.ceil(num_easing_steps/2.0))
|
||||||
if log_diagnostics: logger.debug("base easing duration: " + str(base_easing_duration))
|
if log_diagnostics: context.services.logger.debug("base easing duration: " + str(base_easing_duration))
|
||||||
even_num_steps = (num_easing_steps % 2 == 0) # even number of steps
|
even_num_steps = (num_easing_steps % 2 == 0) # even number of steps
|
||||||
easing_function = easing_class(start=self.start_value,
|
easing_function = easing_class(start=self.start_value,
|
||||||
end=self.end_value,
|
end=self.end_value,
|
||||||
@ -166,14 +165,14 @@ class StepParamEasingInvocation(BaseInvocation):
|
|||||||
easing_val = easing_function.ease(step_index)
|
easing_val = easing_function.ease(step_index)
|
||||||
base_easing_vals.append(easing_val)
|
base_easing_vals.append(easing_val)
|
||||||
if log_diagnostics:
|
if log_diagnostics:
|
||||||
logger.debug("step_index: " + str(step_index) + ", easing_val: " + str(easing_val))
|
context.services.logger.debug("step_index: " + str(step_index) + ", easing_val: " + str(easing_val))
|
||||||
if even_num_steps:
|
if even_num_steps:
|
||||||
mirror_easing_vals = list(reversed(base_easing_vals))
|
mirror_easing_vals = list(reversed(base_easing_vals))
|
||||||
else:
|
else:
|
||||||
mirror_easing_vals = list(reversed(base_easing_vals[0:-1]))
|
mirror_easing_vals = list(reversed(base_easing_vals[0:-1]))
|
||||||
if log_diagnostics:
|
if log_diagnostics:
|
||||||
logger.debug("base easing vals: " + str(base_easing_vals))
|
context.services.logger.debug("base easing vals: " + str(base_easing_vals))
|
||||||
logger.debug("mirror easing vals: " + str(mirror_easing_vals))
|
context.services.logger.debug("mirror easing vals: " + str(mirror_easing_vals))
|
||||||
easing_list = base_easing_vals + mirror_easing_vals
|
easing_list = base_easing_vals + mirror_easing_vals
|
||||||
|
|
||||||
# FIXME: add alt_mirror option (alternative to default or mirror), or remove entirely
|
# FIXME: add alt_mirror option (alternative to default or mirror), or remove entirely
|
||||||
@ -206,12 +205,12 @@ class StepParamEasingInvocation(BaseInvocation):
|
|||||||
step_val = easing_function.ease(step_index)
|
step_val = easing_function.ease(step_index)
|
||||||
easing_list.append(step_val)
|
easing_list.append(step_val)
|
||||||
if log_diagnostics:
|
if log_diagnostics:
|
||||||
logger.debug("step_index: " + str(step_index) + ", easing_val: " + str(step_val))
|
context.services.logger.debug("step_index: " + str(step_index) + ", easing_val: " + str(step_val))
|
||||||
|
|
||||||
if log_diagnostics:
|
if log_diagnostics:
|
||||||
logger.debug("prelist size: " + str(len(prelist)))
|
context.services.logger.debug("prelist size: " + str(len(prelist)))
|
||||||
logger.debug("easing_list size: " + str(len(easing_list)))
|
context.services.logger.debug("easing_list size: " + str(len(easing_list)))
|
||||||
logger.debug("postlist size: " + str(len(postlist)))
|
context.services.logger.debug("postlist size: " + str(len(postlist)))
|
||||||
|
|
||||||
param_list = prelist + easing_list + postlist
|
param_list = prelist + easing_list + postlist
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ const ParamDynamicPromptsCollapse = () => {
|
|||||||
withSwitch
|
withSwitch
|
||||||
>
|
>
|
||||||
<Flex sx={{ gap: 2, flexDir: 'column' }}>
|
<Flex sx={{ gap: 2, flexDir: 'column' }}>
|
||||||
<ParamDynamicPromptsMaxPrompts />
|
|
||||||
<ParamDynamicPromptsCombinatorial />
|
<ParamDynamicPromptsCombinatorial />
|
||||||
|
<ParamDynamicPromptsMaxPrompts />
|
||||||
</Flex>
|
</Flex>
|
||||||
</IAICollapse>
|
</IAICollapse>
|
||||||
);
|
);
|
||||||
|
@ -9,17 +9,18 @@ import { stateSelector } from 'app/store/store';
|
|||||||
const selector = createSelector(
|
const selector = createSelector(
|
||||||
stateSelector,
|
stateSelector,
|
||||||
(state) => {
|
(state) => {
|
||||||
const { maxPrompts } = state.dynamicPrompts;
|
const { maxPrompts, combinatorial } = state.dynamicPrompts;
|
||||||
const { min, sliderMax, inputMax } =
|
const { min, sliderMax, inputMax } =
|
||||||
state.config.sd.dynamicPrompts.maxPrompts;
|
state.config.sd.dynamicPrompts.maxPrompts;
|
||||||
|
|
||||||
return { maxPrompts, min, sliderMax, inputMax };
|
return { maxPrompts, min, sliderMax, inputMax, combinatorial };
|
||||||
},
|
},
|
||||||
defaultSelectorOptions
|
defaultSelectorOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
const ParamDynamicPromptsMaxPrompts = () => {
|
const ParamDynamicPromptsMaxPrompts = () => {
|
||||||
const { maxPrompts, min, sliderMax, inputMax } = useAppSelector(selector);
|
const { maxPrompts, min, sliderMax, inputMax, combinatorial } =
|
||||||
|
useAppSelector(selector);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const handleChange = useCallback(
|
const handleChange = useCallback(
|
||||||
@ -36,6 +37,7 @@ const ParamDynamicPromptsMaxPrompts = () => {
|
|||||||
return (
|
return (
|
||||||
<IAISlider
|
<IAISlider
|
||||||
label="Max Prompts"
|
label="Max Prompts"
|
||||||
|
isDisabled={!combinatorial}
|
||||||
min={min}
|
min={min}
|
||||||
max={sliderMax}
|
max={sliderMax}
|
||||||
value={maxPrompts}
|
value={maxPrompts}
|
||||||
|
@ -37,7 +37,7 @@ export const addDynamicPromptsToGraph = (
|
|||||||
const dynamicPromptNode: DynamicPromptInvocation = {
|
const dynamicPromptNode: DynamicPromptInvocation = {
|
||||||
id: DYNAMIC_PROMPT,
|
id: DYNAMIC_PROMPT,
|
||||||
type: 'dynamic_prompt',
|
type: 'dynamic_prompt',
|
||||||
max_prompts: maxPrompts,
|
max_prompts: combinatorial ? maxPrompts : iterations,
|
||||||
combinatorial,
|
combinatorial,
|
||||||
prompt: positivePrompt,
|
prompt: positivePrompt,
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,8 @@ const selector = createSelector([stateSelector], (state) => {
|
|||||||
state.config.sd.iterations;
|
state.config.sd.iterations;
|
||||||
const { iterations } = state.generation;
|
const { iterations } = state.generation;
|
||||||
const { shouldUseSliders } = state.ui;
|
const { shouldUseSliders } = state.ui;
|
||||||
const isDisabled = state.dynamicPrompts.isEnabled;
|
const isDisabled =
|
||||||
|
state.dynamicPrompts.isEnabled && state.dynamicPrompts.combinatorial;
|
||||||
|
|
||||||
const step = state.hotkeys.shift ? fineStep : coarseStep;
|
const step = state.hotkeys.shift ? fineStep : coarseStep;
|
||||||
|
|
||||||
|
122
invokeai/frontend/web/src/services/api/types.d.ts
vendored
122
invokeai/frontend/web/src/services/api/types.d.ts
vendored
@ -4,91 +4,89 @@ import { components } from './schema';
|
|||||||
type schemas = components['schemas'];
|
type schemas = components['schemas'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper type to extract the invocation type from the schema.
|
* Extracts the schema type from the schema.
|
||||||
* Also flags the `type` property as required.
|
|
||||||
*/
|
*/
|
||||||
type Invocation<T extends keyof schemas> = O.Required<schemas[T], 'type'>;
|
type S<T extends keyof components['schemas']> = components['schemas'][T];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Types from the API, re-exported from the types generated by `openapi-typescript`.
|
* Extracts the node type from the schema.
|
||||||
|
* Also flags the `type` property as required.
|
||||||
*/
|
*/
|
||||||
|
type N<T extends keyof components['schemas']> = O.Required<
|
||||||
|
components['schemas'][T],
|
||||||
|
'type'
|
||||||
|
>;
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
export type ImageDTO = schemas['ImageDTO'];
|
export type ImageDTO = S<'ImageDTO'>;
|
||||||
export type BoardDTO = schemas['BoardDTO'];
|
export type BoardDTO = S<'BoardDTO'>;
|
||||||
export type BoardChanges = schemas['BoardChanges'];
|
export type BoardChanges = S<'BoardChanges'>;
|
||||||
export type ImageChanges = schemas['ImageRecordChanges'];
|
export type ImageChanges = S<'ImageRecordChanges'>;
|
||||||
export type ImageCategory = schemas['ImageCategory'];
|
export type ImageCategory = S<'ImageCategory'>;
|
||||||
export type ResourceOrigin = schemas['ResourceOrigin'];
|
export type ResourceOrigin = S<'ResourceOrigin'>;
|
||||||
export type ImageField = schemas['ImageField'];
|
export type ImageField = S<'ImageField'>;
|
||||||
export type OffsetPaginatedResults_BoardDTO_ =
|
export type OffsetPaginatedResults_BoardDTO_ =
|
||||||
schemas['OffsetPaginatedResults_BoardDTO_'];
|
S<'OffsetPaginatedResults_BoardDTO_'>;
|
||||||
export type OffsetPaginatedResults_ImageDTO_ =
|
export type OffsetPaginatedResults_ImageDTO_ =
|
||||||
schemas['OffsetPaginatedResults_ImageDTO_'];
|
S<'OffsetPaginatedResults_ImageDTO_'>;
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
export type ModelType = schemas['ModelType'];
|
export type ModelType = S<'ModelType'>;
|
||||||
export type BaseModelType = schemas['BaseModelType'];
|
export type BaseModelType = S<'BaseModelType'>;
|
||||||
export type PipelineModelField = schemas['PipelineModelField'];
|
export type PipelineModelField = S<'PipelineModelField'>;
|
||||||
export type ModelsList = schemas['ModelsList'];
|
export type ModelsList = S<'ModelsList'>;
|
||||||
|
|
||||||
// Graphs
|
// Graphs
|
||||||
export type Graph = schemas['Graph'];
|
export type Graph = S<'Graph'>;
|
||||||
export type Edge = schemas['Edge'];
|
export type Edge = S<'Edge'>;
|
||||||
export type GraphExecutionState = schemas['GraphExecutionState'];
|
export type GraphExecutionState = S<'GraphExecutionState'>;
|
||||||
|
|
||||||
// General nodes
|
// General nodes
|
||||||
export type CollectInvocation = Invocation<'CollectInvocation'>;
|
export type CollectInvocation = N<'CollectInvocation'>;
|
||||||
export type IterateInvocation = Invocation<'IterateInvocation'>;
|
export type IterateInvocation = N<'IterateInvocation'>;
|
||||||
export type RangeInvocation = Invocation<'RangeInvocation'>;
|
export type RangeInvocation = N<'RangeInvocation'>;
|
||||||
export type RandomRangeInvocation = Invocation<'RandomRangeInvocation'>;
|
export type RandomRangeInvocation = N<'RandomRangeInvocation'>;
|
||||||
export type RangeOfSizeInvocation = Invocation<'RangeOfSizeInvocation'>;
|
export type RangeOfSizeInvocation = N<'RangeOfSizeInvocation'>;
|
||||||
export type InpaintInvocation = Invocation<'InpaintInvocation'>;
|
export type InpaintInvocation = N<'InpaintInvocation'>;
|
||||||
export type ImageResizeInvocation = Invocation<'ImageResizeInvocation'>;
|
export type ImageResizeInvocation = N<'ImageResizeInvocation'>;
|
||||||
export type RandomIntInvocation = Invocation<'RandomIntInvocation'>;
|
export type RandomIntInvocation = N<'RandomIntInvocation'>;
|
||||||
export type CompelInvocation = Invocation<'CompelInvocation'>;
|
export type CompelInvocation = N<'CompelInvocation'>;
|
||||||
export type DynamicPromptInvocation = Invocation<'DynamicPromptInvocation'>;
|
export type DynamicPromptInvocation = N<'DynamicPromptInvocation'>;
|
||||||
export type NoiseInvocation = Invocation<'NoiseInvocation'>;
|
export type NoiseInvocation = N<'NoiseInvocation'>;
|
||||||
export type TextToLatentsInvocation = Invocation<'TextToLatentsInvocation'>;
|
export type TextToLatentsInvocation = N<'TextToLatentsInvocation'>;
|
||||||
export type LatentsToLatentsInvocation =
|
export type LatentsToLatentsInvocation = N<'LatentsToLatentsInvocation'>;
|
||||||
Invocation<'LatentsToLatentsInvocation'>;
|
export type ImageToLatentsInvocation = N<'ImageToLatentsInvocation'>;
|
||||||
export type ImageToLatentsInvocation = Invocation<'ImageToLatentsInvocation'>;
|
export type LatentsToImageInvocation = N<'LatentsToImageInvocation'>;
|
||||||
export type LatentsToImageInvocation = Invocation<'LatentsToImageInvocation'>;
|
export type PipelineModelLoaderInvocation = N<'PipelineModelLoaderInvocation'>;
|
||||||
export type PipelineModelLoaderInvocation =
|
|
||||||
Invocation<'PipelineModelLoaderInvocation'>;
|
|
||||||
|
|
||||||
// ControlNet Nodes
|
// ControlNet Nodes
|
||||||
export type ControlNetInvocation = Invocation<'ControlNetInvocation'>;
|
export type ControlNetInvocation = N<'ControlNetInvocation'>;
|
||||||
export type CannyImageProcessorInvocation =
|
export type CannyImageProcessorInvocation = N<'CannyImageProcessorInvocation'>;
|
||||||
Invocation<'CannyImageProcessorInvocation'>;
|
|
||||||
export type ContentShuffleImageProcessorInvocation =
|
export type ContentShuffleImageProcessorInvocation =
|
||||||
Invocation<'ContentShuffleImageProcessorInvocation'>;
|
N<'ContentShuffleImageProcessorInvocation'>;
|
||||||
export type HedImageProcessorInvocation =
|
export type HedImageProcessorInvocation = N<'HedImageProcessorInvocation'>;
|
||||||
Invocation<'HedImageProcessorInvocation'>;
|
|
||||||
export type LineartAnimeImageProcessorInvocation =
|
export type LineartAnimeImageProcessorInvocation =
|
||||||
Invocation<'LineartAnimeImageProcessorInvocation'>;
|
N<'LineartAnimeImageProcessorInvocation'>;
|
||||||
export type LineartImageProcessorInvocation =
|
export type LineartImageProcessorInvocation =
|
||||||
Invocation<'LineartImageProcessorInvocation'>;
|
N<'LineartImageProcessorInvocation'>;
|
||||||
export type MediapipeFaceProcessorInvocation =
|
export type MediapipeFaceProcessorInvocation =
|
||||||
Invocation<'MediapipeFaceProcessorInvocation'>;
|
N<'MediapipeFaceProcessorInvocation'>;
|
||||||
export type MidasDepthImageProcessorInvocation =
|
export type MidasDepthImageProcessorInvocation =
|
||||||
Invocation<'MidasDepthImageProcessorInvocation'>;
|
N<'MidasDepthImageProcessorInvocation'>;
|
||||||
export type MlsdImageProcessorInvocation =
|
export type MlsdImageProcessorInvocation = N<'MlsdImageProcessorInvocation'>;
|
||||||
Invocation<'MlsdImageProcessorInvocation'>;
|
|
||||||
export type NormalbaeImageProcessorInvocation =
|
export type NormalbaeImageProcessorInvocation =
|
||||||
Invocation<'NormalbaeImageProcessorInvocation'>;
|
N<'NormalbaeImageProcessorInvocation'>;
|
||||||
export type OpenposeImageProcessorInvocation =
|
export type OpenposeImageProcessorInvocation =
|
||||||
Invocation<'OpenposeImageProcessorInvocation'>;
|
N<'OpenposeImageProcessorInvocation'>;
|
||||||
export type PidiImageProcessorInvocation =
|
export type PidiImageProcessorInvocation = N<'PidiImageProcessorInvocation'>;
|
||||||
Invocation<'PidiImageProcessorInvocation'>;
|
|
||||||
export type ZoeDepthImageProcessorInvocation =
|
export type ZoeDepthImageProcessorInvocation =
|
||||||
Invocation<'ZoeDepthImageProcessorInvocation'>;
|
N<'ZoeDepthImageProcessorInvocation'>;
|
||||||
|
|
||||||
// Node Outputs
|
// Node Outputs
|
||||||
export type ImageOutput = schemas['ImageOutput'];
|
export type ImageOutput = S<'ImageOutput'>;
|
||||||
export type MaskOutput = schemas['MaskOutput'];
|
export type MaskOutput = S<'MaskOutput'>;
|
||||||
export type PromptOutput = schemas['PromptOutput'];
|
export type PromptOutput = S<'PromptOutput'>;
|
||||||
export type IterateInvocationOutput = schemas['IterateInvocationOutput'];
|
export type IterateInvocationOutput = S<'IterateInvocationOutput'>;
|
||||||
export type CollectInvocationOutput = schemas['CollectInvocationOutput'];
|
export type CollectInvocationOutput = S<'CollectInvocationOutput'>;
|
||||||
export type LatentsOutput = schemas['LatentsOutput'];
|
export type LatentsOutput = S<'LatentsOutput'>;
|
||||||
export type GraphInvocationOutput = schemas['GraphInvocationOutput'];
|
export type GraphInvocationOutput = S<'GraphInvocationOutput'>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user