From fd715026a73db6f81d3f86dd6a557155ef60fdaf Mon Sep 17 00:00:00 2001 From: user1 Date: Sun, 11 Jun 2023 02:00:39 -0700 Subject: [PATCH 01/13] First pass at ControlNet "guess mode" implementation. --- .../controlnet_image_processors.py | 6 +- invokeai/app/invocations/latent.py | 4 +- .../stable_diffusion/diffusers_pipeline.py | 108 ++++++++++++++---- 3 files changed, 93 insertions(+), 25 deletions(-) diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index b32afe4941..dc172d9270 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -1,7 +1,7 @@ # InvokeAI nodes for ControlNet image preprocessors # initial implementation by Gregg Helt, 2023 # heavily leverages controlnet_aux package: https://github.com/patrickvonplaten/controlnet_aux -from builtins import float +from builtins import float, bool import numpy as np from typing import Literal, Optional, Union, List @@ -94,6 +94,7 @@ CONTROLNET_DEFAULT_MODELS = [ ] CONTROLNET_NAME_VALUES = Literal[tuple(CONTROLNET_DEFAULT_MODELS)] +# CONTROLNET_MODE_VALUES = Literal[tuple(["BALANCED", "PROMPT", "CONTROL"])] class ControlField(BaseModel): image: ImageField = Field(default=None, description="The control image") @@ -104,6 +105,7 @@ class ControlField(BaseModel): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") + guess_mode: bool = Field(default=False, description="Toggle for guess mode") @validator("control_weight") def abs_le_one(cls, v): """validate that all abs(values) are <=1""" @@ -149,6 +151,7 @@ class ControlNetInvocation(BaseInvocation): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") + guess_mode: bool = Field(default=False, description="Toggle for guess mode") # fmt: on class Config(InvocationConfig): @@ -174,6 +177,7 @@ class ControlNetInvocation(BaseInvocation): control_weight=self.control_weight, begin_step_percent=self.begin_step_percent, end_step_percent=self.end_step_percent, + guess_mode=self.guess_mode, ), ) diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index dbd419b6e5..7b7cced33f 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -337,12 +337,14 @@ class TextToLatentsInvocation(BaseInvocation): # num_images_per_prompt=num_images_per_prompt, device=control_model.device, dtype=control_model.dtype, + guess_mode=control_info.guess_mode, ) control_item = ControlNetData(model=control_model, image_tensor=control_image, weight=control_info.control_weight, begin_step_percent=control_info.begin_step_percent, - end_step_percent=control_info.end_step_percent) + end_step_percent=control_info.end_step_percent, + guess_mode=control_info.guess_mode,) control_data.append(control_item) # MultiControlNetModel has been refactored out, just need list[ControlNetData] return control_data diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 6a11891979..52880b5e3f 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -217,10 +217,12 @@ class GeneratorToCallbackinator(Generic[ParamType, ReturnType, CallbackType]): @dataclass class ControlNetData: model: ControlNetModel = Field(default=None) - image_tensor: torch.Tensor= Field(default=None) - weight: Union[float, List[float]]= Field(default=1.0) + image_tensor: torch.Tensor = Field(default=None) + weight: Union[float, List[float]] = Field(default=1.0) begin_step_percent: float = Field(default=0.0) end_step_percent: float = Field(default=1.0) + # FIXME: replace with guess_mode with enum control_mode: BALANCED, MORE_PROMPT, MORE_CONTROL + guess_mode: bool = Field(default=False) # guess_mode can work with or without prompt @dataclass(frozen=True) class ConditioningData: @@ -656,21 +658,34 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): # TODO: should this scaling happen here or inside self._unet_forward? # i.e. before or after passing it to InvokeAIDiffuserComponent - latent_model_input = self.scheduler.scale_model_input(latents, timestep) + unet_latent_input = self.scheduler.scale_model_input(latents, timestep) + + # # guess mode handling from diffusers + # if guess_mode and do_classifier_free_guidance: + # # Infer ControlNet only for the conditional batch. + # control_model_input = latents + # control_model_input = self.scheduler.scale_model_input(control_model_input, t) + # controlnet_prompt_embeds = prompt_embeds.chunk(2)[1] + # else: + # control_model_input = unet_latent_input + # controlnet_prompt_embeds = prompt_embeds # default is no controlnet, so set controlnet processing output to None down_block_res_samples, mid_block_res_sample = None, None if control_data is not None: - # FIXME: make sure guidance_scale < 1.0 is handled correctly if doing per-step guidance setting + # FIXME: make sure guidance_scale <= 1.0 is handled correctly if doing per-step guidance setting + # UPDATE: I think this is fixed now with pydantic validator for cfg_scale? + # So we should _never_ have guidance_scale <= 1.0 # if conditioning_data.guidance_scale > 1.0: - if conditioning_data.guidance_scale is not None: - # expand the latents input to control model if doing classifier free guidance - # (which I think for now is always true, there is conditional elsewhere that stops execution if - # classifier_free_guidance is <= 1.0 ?) - latent_control_input = torch.cat([latent_model_input] * 2) - else: - latent_control_input = latent_model_input + # if conditioning_data.guidance_scale is not None: + # if guess_mode is False: + # # expand the latents input to control model if doing classifier free guidance + # # (which I think for now is always true, there is conditional elsewhere that stops execution if + # # classifier_free_guidance is <= 1.0 ?) + # control_latent_input = torch.cat([unet_latent_input] * 2) + # else: + # control_latent_input = unet_latent_input # control_data should be type List[ControlNetData] # this loop covers both ControlNet (one ControlNetData in list) # and MultiControlNet (multiple ControlNetData in list) @@ -680,24 +695,62 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): last_control_step = math.ceil(control_datum.end_step_percent * total_step_count) # only apply controlnet if current step is within the controlnet's begin/end step range if step_index >= first_control_step and step_index <= last_control_step: - # print("running controlnet", i, "for step", step_index) + guess_mode = control_datum.guess_mode + if guess_mode: + control_latent_input = unet_latent_input + else: + # expand the latents input to control model if doing classifier free guidance + # (which I think for now is always true, there is conditional elsewhere that stops execution if + # classifier_free_guidance is <= 1.0 ?) + control_latent_input = torch.cat([unet_latent_input] * 2) + + print("running controlnet", i, "for step", step_index) + print("guess mode: ", guess_mode) + print("guess mode type: ", type(guess_mode)) + if guess_mode: # only using prompt conditioning in unconditioned + encoder_hidden_states = torch.cat([conditioning_data.unconditioned_embeddings]) + else: + encoder_hidden_states = torch.cat([conditioning_data.unconditioned_embeddings, + conditioning_data.text_embeddings]) + print("encoder_hidden_states.shape", encoder_hidden_states.shape) if isinstance(control_datum.weight, list): # if controlnet has multiple weights, use the weight for the current step controlnet_weight = control_datum.weight[step_index] else: # if controlnet has a single weight, use it for all steps controlnet_weight = control_datum.weight + + # guess mode handling from diffusers controlnet pipeline: + # if guess_mode and do_classifier_free_guidance: + # # Infer ControlNet only for the conditional batch. + # latent_control_input = latents + # latent_control_input = self.scheduler.scale_model_input(control_model_input, t) + # controlnet_prompt_embeds = prompt_embeds.chunk(2)[1] + # else: + # control_model_input = unet_latent_input + # controlnet_prompt_embeds = prompt_embeds + + # controlnet(s) inference down_samples, mid_sample = control_datum.model( - sample=latent_control_input, + sample=control_latent_input, timestep=timestep, - encoder_hidden_states=torch.cat([conditioning_data.unconditioned_embeddings, - conditioning_data.text_embeddings]), + # encoder_hidden_states=torch.cat([conditioning_data.unconditioned_embeddings, + # conditioning_data.text_embeddings]), + encoder_hidden_states=encoder_hidden_states, controlnet_cond=control_datum.image_tensor, - conditioning_scale=controlnet_weight, + conditioning_scale=controlnet_weight, # controlnet specific, NOT the guidance scale # cross_attention_kwargs, - guess_mode=False, + guess_mode=guess_mode, return_dict=False, ) + print("finished ControlNetModel() call, step", step_index) + if guess_mode: + # Inferred ControlNet only for the conditional batch. + # To apply the output of ControlNet to both the unconditional and conditional batches, + # add 0 to the unconditional batch to keep it unchanged. + down_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_samples] + mid_sample = torch.cat([torch.zeros_like(mid_sample), mid_sample]) + if down_block_res_samples is None and mid_block_res_sample is None: down_block_res_samples, mid_block_res_sample = down_samples, mid_sample else: @@ -708,13 +761,21 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): ] mid_block_res_sample += mid_sample + # guess mode handling from diffusers controlnet pipeline: + # if guess_mode and do_classifier_free_guidance: + # # Inferred ControlNet only for the conditional batch. + # # To apply the output of ControlNet to both the unconditional and conditional batches, + # # add 0 to the unconditional batch to keep it unchanged. + # down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples] + # mid_block_res_sample = torch.cat([torch.zeros_like(mid_block_res_sample), mid_block_res_sample]) + # predict the noise residual noise_pred = self.invokeai_diffuser.do_diffusion_step( - latent_model_input, - t, - conditioning_data.unconditioned_embeddings, - conditioning_data.text_embeddings, - conditioning_data.guidance_scale, + x=unet_latent_input, + sigma=t, + unconditioning=conditioning_data.unconditioned_embeddings, + conditioning=conditioning_data.text_embeddings, + unconditional_guidance_scale=conditioning_data.guidance_scale, step_index=step_index, total_step_count=total_step_count, down_block_additional_residuals=down_block_res_samples, # from controlnet(s) @@ -1038,6 +1099,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): device="cuda", dtype=torch.float16, do_classifier_free_guidance=True, + guess_mode=False, ): if not isinstance(image, torch.Tensor): @@ -1068,6 +1130,6 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): repeat_by = num_images_per_prompt image = image.repeat_interleave(repeat_by, dim=0) image = image.to(device=device, dtype=dtype) - if do_classifier_free_guidance: + if do_classifier_free_guidance and not guess_mode: image = torch.cat([image] * 2) return image From 9e0e26f4c4eb347cf360aa8d05724037735fd0ca Mon Sep 17 00:00:00 2001 From: user1 Date: Mon, 12 Jun 2023 23:57:57 -0700 Subject: [PATCH 02/13] Moving from ControlNet guess_mode to separate booleans for cfg_injection and soft_injection for testing control modes --- .../app/invocations/controlnet_image_processors.py | 12 +++++++++--- invokeai/app/invocations/latent.py | 9 +++++++-- .../backend/stable_diffusion/diffusers_pipeline.py | 13 ++++++++++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index dc172d9270..84e18e69bd 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -105,7 +105,9 @@ class ControlField(BaseModel): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") - guess_mode: bool = Field(default=False, description="Toggle for guess mode") + # guess_mode: bool = Field(default=False, description="Toggle for guess mode") + cfg_injection: bool = Field(default=False, description="Toggle for cfg injection") + soft_injection: bool = Field(default=False, description="Toggle for soft injection") @validator("control_weight") def abs_le_one(cls, v): """validate that all abs(values) are <=1""" @@ -151,7 +153,9 @@ class ControlNetInvocation(BaseInvocation): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") - guess_mode: bool = Field(default=False, description="Toggle for guess mode") + # guess_mode: bool = Field(default=False, description="Toggle for guess mode") + cfg_injection: bool = Field(default=False, description="Toggle for cfg injection") + soft_injection: bool = Field(default=False, description="Toggle for soft injection") # fmt: on class Config(InvocationConfig): @@ -177,7 +181,9 @@ class ControlNetInvocation(BaseInvocation): control_weight=self.control_weight, begin_step_percent=self.begin_step_percent, end_step_percent=self.end_step_percent, - guess_mode=self.guess_mode, + # guess_mode=self.guess_mode, + cfg_injection=self.cfg_injection, + soft_injection=self.soft_injection, ), ) diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 7b7cced33f..104d1003d0 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -337,14 +337,19 @@ class TextToLatentsInvocation(BaseInvocation): # num_images_per_prompt=num_images_per_prompt, device=control_model.device, dtype=control_model.dtype, - guess_mode=control_info.guess_mode, + # guess_mode=control_info.guess_mode, + cfg_injection=control_info.cfg_injection, + soft_injection=control_info.soft_injection, ) control_item = ControlNetData(model=control_model, image_tensor=control_image, weight=control_info.control_weight, begin_step_percent=control_info.begin_step_percent, end_step_percent=control_info.end_step_percent, - guess_mode=control_info.guess_mode,) + # guess_mode=control_info.guess_mode, + cfg_injection=control_info.cfg_injection, + soft_injection=control_info.soft_injection, + ) control_data.append(control_item) # MultiControlNetModel has been refactored out, just need list[ControlNetData] return control_data diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 52880b5e3f..5b6848d8ad 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -223,6 +223,8 @@ class ControlNetData: end_step_percent: float = Field(default=1.0) # FIXME: replace with guess_mode with enum control_mode: BALANCED, MORE_PROMPT, MORE_CONTROL guess_mode: bool = Field(default=False) # guess_mode can work with or without prompt + cfg_injection: bool = Field(default=False) + soft_injection: bool = Field(default=False) @dataclass(frozen=True) class ConditioningData: @@ -695,7 +697,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): last_control_step = math.ceil(control_datum.end_step_percent * total_step_count) # only apply controlnet if current step is within the controlnet's begin/end step range if step_index >= first_control_step and step_index <= last_control_step: - guess_mode = control_datum.guess_mode + # guess_mode = control_datum.guess_mode + guess_mode = control_datum.cfg_injection if guess_mode: control_latent_input = unet_latent_input else: @@ -740,7 +743,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): controlnet_cond=control_datum.image_tensor, conditioning_scale=controlnet_weight, # controlnet specific, NOT the guidance scale # cross_attention_kwargs, - guess_mode=guess_mode, + # guess_mode=guess_mode, + guess_mode=control_datum.soft_injection, return_dict=False, ) print("finished ControlNetModel() call, step", step_index) @@ -1100,6 +1104,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): dtype=torch.float16, do_classifier_free_guidance=True, guess_mode=False, + soft_injection=False, + cfg_injection=False, ): if not isinstance(image, torch.Tensor): @@ -1130,6 +1136,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): repeat_by = num_images_per_prompt image = image.repeat_interleave(repeat_by, dim=0) image = image.to(device=device, dtype=dtype) - if do_classifier_free_guidance and not guess_mode: + # if do_classifier_free_guidance and not guess_mode: + if do_classifier_free_guidance and not cfg_injection: image = torch.cat([image] * 2) return image From 8b7fac75ed2113cc59a812beba88210af663ed65 Mon Sep 17 00:00:00 2001 From: user1 Date: Sun, 11 Jun 2023 02:00:39 -0700 Subject: [PATCH 03/13] First pass at ControlNet "guess mode" implementation. --- .../controlnet_image_processors.py | 6 +- invokeai/app/invocations/latent.py | 4 +- .../stable_diffusion/diffusers_pipeline.py | 108 ++++++++++++++---- 3 files changed, 93 insertions(+), 25 deletions(-) diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index b32afe4941..dc172d9270 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -1,7 +1,7 @@ # InvokeAI nodes for ControlNet image preprocessors # initial implementation by Gregg Helt, 2023 # heavily leverages controlnet_aux package: https://github.com/patrickvonplaten/controlnet_aux -from builtins import float +from builtins import float, bool import numpy as np from typing import Literal, Optional, Union, List @@ -94,6 +94,7 @@ CONTROLNET_DEFAULT_MODELS = [ ] CONTROLNET_NAME_VALUES = Literal[tuple(CONTROLNET_DEFAULT_MODELS)] +# CONTROLNET_MODE_VALUES = Literal[tuple(["BALANCED", "PROMPT", "CONTROL"])] class ControlField(BaseModel): image: ImageField = Field(default=None, description="The control image") @@ -104,6 +105,7 @@ class ControlField(BaseModel): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") + guess_mode: bool = Field(default=False, description="Toggle for guess mode") @validator("control_weight") def abs_le_one(cls, v): """validate that all abs(values) are <=1""" @@ -149,6 +151,7 @@ class ControlNetInvocation(BaseInvocation): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") + guess_mode: bool = Field(default=False, description="Toggle for guess mode") # fmt: on class Config(InvocationConfig): @@ -174,6 +177,7 @@ class ControlNetInvocation(BaseInvocation): control_weight=self.control_weight, begin_step_percent=self.begin_step_percent, end_step_percent=self.end_step_percent, + guess_mode=self.guess_mode, ), ) diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 679cc23dcd..4d31b0f110 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -337,12 +337,14 @@ class TextToLatentsInvocation(BaseInvocation): # num_images_per_prompt=num_images_per_prompt, device=control_model.device, dtype=control_model.dtype, + guess_mode=control_info.guess_mode, ) control_item = ControlNetData(model=control_model, image_tensor=control_image, weight=control_info.control_weight, begin_step_percent=control_info.begin_step_percent, - end_step_percent=control_info.end_step_percent) + end_step_percent=control_info.end_step_percent, + guess_mode=control_info.guess_mode,) control_data.append(control_item) # MultiControlNetModel has been refactored out, just need list[ControlNetData] return control_data diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index ffc0f30692..9da8e078d6 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -217,10 +217,12 @@ class GeneratorToCallbackinator(Generic[ParamType, ReturnType, CallbackType]): @dataclass class ControlNetData: model: ControlNetModel = Field(default=None) - image_tensor: torch.Tensor= Field(default=None) - weight: Union[float, List[float]]= Field(default=1.0) + image_tensor: torch.Tensor = Field(default=None) + weight: Union[float, List[float]] = Field(default=1.0) begin_step_percent: float = Field(default=0.0) end_step_percent: float = Field(default=1.0) + # FIXME: replace with guess_mode with enum control_mode: BALANCED, MORE_PROMPT, MORE_CONTROL + guess_mode: bool = Field(default=False) # guess_mode can work with or without prompt @dataclass(frozen=True) class ConditioningData: @@ -656,21 +658,34 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): # TODO: should this scaling happen here or inside self._unet_forward? # i.e. before or after passing it to InvokeAIDiffuserComponent - latent_model_input = self.scheduler.scale_model_input(latents, timestep) + unet_latent_input = self.scheduler.scale_model_input(latents, timestep) + + # # guess mode handling from diffusers + # if guess_mode and do_classifier_free_guidance: + # # Infer ControlNet only for the conditional batch. + # control_model_input = latents + # control_model_input = self.scheduler.scale_model_input(control_model_input, t) + # controlnet_prompt_embeds = prompt_embeds.chunk(2)[1] + # else: + # control_model_input = unet_latent_input + # controlnet_prompt_embeds = prompt_embeds # default is no controlnet, so set controlnet processing output to None down_block_res_samples, mid_block_res_sample = None, None if control_data is not None: - # FIXME: make sure guidance_scale < 1.0 is handled correctly if doing per-step guidance setting + # FIXME: make sure guidance_scale <= 1.0 is handled correctly if doing per-step guidance setting + # UPDATE: I think this is fixed now with pydantic validator for cfg_scale? + # So we should _never_ have guidance_scale <= 1.0 # if conditioning_data.guidance_scale > 1.0: - if conditioning_data.guidance_scale is not None: - # expand the latents input to control model if doing classifier free guidance - # (which I think for now is always true, there is conditional elsewhere that stops execution if - # classifier_free_guidance is <= 1.0 ?) - latent_control_input = torch.cat([latent_model_input] * 2) - else: - latent_control_input = latent_model_input + # if conditioning_data.guidance_scale is not None: + # if guess_mode is False: + # # expand the latents input to control model if doing classifier free guidance + # # (which I think for now is always true, there is conditional elsewhere that stops execution if + # # classifier_free_guidance is <= 1.0 ?) + # control_latent_input = torch.cat([unet_latent_input] * 2) + # else: + # control_latent_input = unet_latent_input # control_data should be type List[ControlNetData] # this loop covers both ControlNet (one ControlNetData in list) # and MultiControlNet (multiple ControlNetData in list) @@ -680,24 +695,62 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): last_control_step = math.ceil(control_datum.end_step_percent * total_step_count) # only apply controlnet if current step is within the controlnet's begin/end step range if step_index >= first_control_step and step_index <= last_control_step: - # print("running controlnet", i, "for step", step_index) + guess_mode = control_datum.guess_mode + if guess_mode: + control_latent_input = unet_latent_input + else: + # expand the latents input to control model if doing classifier free guidance + # (which I think for now is always true, there is conditional elsewhere that stops execution if + # classifier_free_guidance is <= 1.0 ?) + control_latent_input = torch.cat([unet_latent_input] * 2) + + print("running controlnet", i, "for step", step_index) + print("guess mode: ", guess_mode) + print("guess mode type: ", type(guess_mode)) + if guess_mode: # only using prompt conditioning in unconditioned + encoder_hidden_states = torch.cat([conditioning_data.unconditioned_embeddings]) + else: + encoder_hidden_states = torch.cat([conditioning_data.unconditioned_embeddings, + conditioning_data.text_embeddings]) + print("encoder_hidden_states.shape", encoder_hidden_states.shape) if isinstance(control_datum.weight, list): # if controlnet has multiple weights, use the weight for the current step controlnet_weight = control_datum.weight[step_index] else: # if controlnet has a single weight, use it for all steps controlnet_weight = control_datum.weight + + # guess mode handling from diffusers controlnet pipeline: + # if guess_mode and do_classifier_free_guidance: + # # Infer ControlNet only for the conditional batch. + # latent_control_input = latents + # latent_control_input = self.scheduler.scale_model_input(control_model_input, t) + # controlnet_prompt_embeds = prompt_embeds.chunk(2)[1] + # else: + # control_model_input = unet_latent_input + # controlnet_prompt_embeds = prompt_embeds + + # controlnet(s) inference down_samples, mid_sample = control_datum.model( - sample=latent_control_input, + sample=control_latent_input, timestep=timestep, - encoder_hidden_states=torch.cat([conditioning_data.unconditioned_embeddings, - conditioning_data.text_embeddings]), + # encoder_hidden_states=torch.cat([conditioning_data.unconditioned_embeddings, + # conditioning_data.text_embeddings]), + encoder_hidden_states=encoder_hidden_states, controlnet_cond=control_datum.image_tensor, - conditioning_scale=controlnet_weight, + conditioning_scale=controlnet_weight, # controlnet specific, NOT the guidance scale # cross_attention_kwargs, - guess_mode=False, + guess_mode=guess_mode, return_dict=False, ) + print("finished ControlNetModel() call, step", step_index) + if guess_mode: + # Inferred ControlNet only for the conditional batch. + # To apply the output of ControlNet to both the unconditional and conditional batches, + # add 0 to the unconditional batch to keep it unchanged. + down_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_samples] + mid_sample = torch.cat([torch.zeros_like(mid_sample), mid_sample]) + if down_block_res_samples is None and mid_block_res_sample is None: down_block_res_samples, mid_block_res_sample = down_samples, mid_sample else: @@ -708,13 +761,21 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): ] mid_block_res_sample += mid_sample + # guess mode handling from diffusers controlnet pipeline: + # if guess_mode and do_classifier_free_guidance: + # # Inferred ControlNet only for the conditional batch. + # # To apply the output of ControlNet to both the unconditional and conditional batches, + # # add 0 to the unconditional batch to keep it unchanged. + # down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples] + # mid_block_res_sample = torch.cat([torch.zeros_like(mid_block_res_sample), mid_block_res_sample]) + # predict the noise residual noise_pred = self.invokeai_diffuser.do_diffusion_step( - latent_model_input, - t, - conditioning_data.unconditioned_embeddings, - conditioning_data.text_embeddings, - conditioning_data.guidance_scale, + x=unet_latent_input, + sigma=t, + unconditioning=conditioning_data.unconditioned_embeddings, + conditioning=conditioning_data.text_embeddings, + unconditional_guidance_scale=conditioning_data.guidance_scale, step_index=step_index, total_step_count=total_step_count, down_block_additional_residuals=down_block_res_samples, # from controlnet(s) @@ -1038,6 +1099,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): device="cuda", dtype=torch.float16, do_classifier_free_guidance=True, + guess_mode=False, ): if not isinstance(image, torch.Tensor): @@ -1068,6 +1130,6 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): repeat_by = num_images_per_prompt image = image.repeat_interleave(repeat_by, dim=0) image = image.to(device=device, dtype=dtype) - if do_classifier_free_guidance: + if do_classifier_free_guidance and not guess_mode: image = torch.cat([image] * 2) return image From 8495764d45c2719ecedf6e451ddd717058ee0aab Mon Sep 17 00:00:00 2001 From: user1 Date: Mon, 12 Jun 2023 23:57:57 -0700 Subject: [PATCH 04/13] Moving from ControlNet guess_mode to separate booleans for cfg_injection and soft_injection for testing control modes --- .../app/invocations/controlnet_image_processors.py | 12 +++++++++--- invokeai/app/invocations/latent.py | 9 +++++++-- .../backend/stable_diffusion/diffusers_pipeline.py | 13 ++++++++++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index dc172d9270..84e18e69bd 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -105,7 +105,9 @@ class ControlField(BaseModel): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") - guess_mode: bool = Field(default=False, description="Toggle for guess mode") + # guess_mode: bool = Field(default=False, description="Toggle for guess mode") + cfg_injection: bool = Field(default=False, description="Toggle for cfg injection") + soft_injection: bool = Field(default=False, description="Toggle for soft injection") @validator("control_weight") def abs_le_one(cls, v): """validate that all abs(values) are <=1""" @@ -151,7 +153,9 @@ class ControlNetInvocation(BaseInvocation): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") - guess_mode: bool = Field(default=False, description="Toggle for guess mode") + # guess_mode: bool = Field(default=False, description="Toggle for guess mode") + cfg_injection: bool = Field(default=False, description="Toggle for cfg injection") + soft_injection: bool = Field(default=False, description="Toggle for soft injection") # fmt: on class Config(InvocationConfig): @@ -177,7 +181,9 @@ class ControlNetInvocation(BaseInvocation): control_weight=self.control_weight, begin_step_percent=self.begin_step_percent, end_step_percent=self.end_step_percent, - guess_mode=self.guess_mode, + # guess_mode=self.guess_mode, + cfg_injection=self.cfg_injection, + soft_injection=self.soft_injection, ), ) diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 4d31b0f110..b067118010 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -337,14 +337,19 @@ class TextToLatentsInvocation(BaseInvocation): # num_images_per_prompt=num_images_per_prompt, device=control_model.device, dtype=control_model.dtype, - guess_mode=control_info.guess_mode, + # guess_mode=control_info.guess_mode, + cfg_injection=control_info.cfg_injection, + soft_injection=control_info.soft_injection, ) control_item = ControlNetData(model=control_model, image_tensor=control_image, weight=control_info.control_weight, begin_step_percent=control_info.begin_step_percent, end_step_percent=control_info.end_step_percent, - guess_mode=control_info.guess_mode,) + # guess_mode=control_info.guess_mode, + cfg_injection=control_info.cfg_injection, + soft_injection=control_info.soft_injection, + ) control_data.append(control_item) # MultiControlNetModel has been refactored out, just need list[ControlNetData] return control_data diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 9da8e078d6..9f03788657 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -223,6 +223,8 @@ class ControlNetData: end_step_percent: float = Field(default=1.0) # FIXME: replace with guess_mode with enum control_mode: BALANCED, MORE_PROMPT, MORE_CONTROL guess_mode: bool = Field(default=False) # guess_mode can work with or without prompt + cfg_injection: bool = Field(default=False) + soft_injection: bool = Field(default=False) @dataclass(frozen=True) class ConditioningData: @@ -695,7 +697,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): last_control_step = math.ceil(control_datum.end_step_percent * total_step_count) # only apply controlnet if current step is within the controlnet's begin/end step range if step_index >= first_control_step and step_index <= last_control_step: - guess_mode = control_datum.guess_mode + # guess_mode = control_datum.guess_mode + guess_mode = control_datum.cfg_injection if guess_mode: control_latent_input = unet_latent_input else: @@ -740,7 +743,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): controlnet_cond=control_datum.image_tensor, conditioning_scale=controlnet_weight, # controlnet specific, NOT the guidance scale # cross_attention_kwargs, - guess_mode=guess_mode, + # guess_mode=guess_mode, + guess_mode=control_datum.soft_injection, return_dict=False, ) print("finished ControlNetModel() call, step", step_index) @@ -1100,6 +1104,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): dtype=torch.float16, do_classifier_free_guidance=True, guess_mode=False, + soft_injection=False, + cfg_injection=False, ): if not isinstance(image, torch.Tensor): @@ -1130,6 +1136,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): repeat_by = num_images_per_prompt image = image.repeat_interleave(repeat_by, dim=0) image = image.to(device=device, dtype=dtype) - if do_classifier_free_guidance and not guess_mode: + # if do_classifier_free_guidance and not guess_mode: + if do_classifier_free_guidance and not cfg_injection: image = torch.cat([image] * 2) return image From de3e6cdb02a59a809746fbdde42b4378f5cbd676 Mon Sep 17 00:00:00 2001 From: user1 Date: Tue, 13 Jun 2023 21:08:34 -0700 Subject: [PATCH 05/13] Switched over to ControlNet control_mode with 4 options: balanced, more_prompt, more_control, even_more_control. Based on True/False combinations of internal booleans cfg_injection and soft_injection --- .../controlnet_image_processors.py | 17 ++-- invokeai/app/invocations/latent.py | 13 +-- .../stable_diffusion/diffusers_pipeline.py | 85 +++++-------------- 3 files changed, 27 insertions(+), 88 deletions(-) diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index 84e18e69bd..c433e90648 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -94,7 +94,7 @@ CONTROLNET_DEFAULT_MODELS = [ ] CONTROLNET_NAME_VALUES = Literal[tuple(CONTROLNET_DEFAULT_MODELS)] -# CONTROLNET_MODE_VALUES = Literal[tuple(["BALANCED", "PROMPT", "CONTROL"])] +CONTROLNET_MODE_VALUES = Literal[tuple(["balanced", "more_prompt", "more_control", "even_more_control"])] class ControlField(BaseModel): image: ImageField = Field(default=None, description="The control image") @@ -105,9 +105,8 @@ class ControlField(BaseModel): description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") - # guess_mode: bool = Field(default=False, description="Toggle for guess mode") - cfg_injection: bool = Field(default=False, description="Toggle for cfg injection") - soft_injection: bool = Field(default=False, description="Toggle for soft injection") + control_mode: CONTROLNET_MODE_VALUES = Field(default="balanced", description="The contorl mode to use") + @validator("control_weight") def abs_le_one(cls, v): """validate that all abs(values) are <=1""" @@ -148,14 +147,11 @@ class ControlNetInvocation(BaseInvocation): control_model: CONTROLNET_NAME_VALUES = Field(default="lllyasviel/sd-controlnet-canny", description="control model used") control_weight: Union[float, List[float]] = Field(default=1.0, description="The weight given to the ControlNet") - # TODO: add support in backend core for begin_step_percent, end_step_percent, guess_mode begin_step_percent: float = Field(default=0, ge=0, le=1, description="When the ControlNet is first applied (% of total steps)") end_step_percent: float = Field(default=1, ge=0, le=1, description="When the ControlNet is last applied (% of total steps)") - # guess_mode: bool = Field(default=False, description="Toggle for guess mode") - cfg_injection: bool = Field(default=False, description="Toggle for cfg injection") - soft_injection: bool = Field(default=False, description="Toggle for soft injection") + control_mode: CONTROLNET_MODE_VALUES = Field(default="balanced", description="The control mode used") # fmt: on class Config(InvocationConfig): @@ -173,7 +169,6 @@ class ControlNetInvocation(BaseInvocation): } def invoke(self, context: InvocationContext) -> ControlOutput: - return ControlOutput( control=ControlField( image=self.image, @@ -181,9 +176,7 @@ class ControlNetInvocation(BaseInvocation): control_weight=self.control_weight, begin_step_percent=self.begin_step_percent, end_step_percent=self.end_step_percent, - # guess_mode=self.guess_mode, - cfg_injection=self.cfg_injection, - soft_injection=self.soft_injection, + control_mode=self.control_mode, ), ) diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index b067118010..a712b027c0 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -282,19 +282,14 @@ class TextToLatentsInvocation(BaseInvocation): control_height_resize = latents_shape[2] * 8 control_width_resize = latents_shape[3] * 8 if control_input is None: - # print("control input is None") control_list = None elif isinstance(control_input, list) and len(control_input) == 0: - # print("control input is empty list") control_list = None elif isinstance(control_input, ControlField): - # print("control input is ControlField") control_list = [control_input] elif isinstance(control_input, list) and len(control_input) > 0 and isinstance(control_input[0], ControlField): - # print("control input is list[ControlField]") control_list = control_input else: - # print("input control is unrecognized:", type(self.control)) control_list = None if (control_list is None): control_data = None @@ -337,18 +332,14 @@ class TextToLatentsInvocation(BaseInvocation): # num_images_per_prompt=num_images_per_prompt, device=control_model.device, dtype=control_model.dtype, - # guess_mode=control_info.guess_mode, - cfg_injection=control_info.cfg_injection, - soft_injection=control_info.soft_injection, + control_mode=control_info.control_mode, ) control_item = ControlNetData(model=control_model, image_tensor=control_image, weight=control_info.control_weight, begin_step_percent=control_info.begin_step_percent, end_step_percent=control_info.end_step_percent, - # guess_mode=control_info.guess_mode, - cfg_injection=control_info.cfg_injection, - soft_injection=control_info.soft_injection, + control_mode=control_info.control_mode, ) control_data.append(control_item) # MultiControlNetModel has been refactored out, just need list[ControlNetData] diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 9f03788657..58ea30ef48 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -221,10 +221,8 @@ class ControlNetData: weight: Union[float, List[float]] = Field(default=1.0) begin_step_percent: float = Field(default=0.0) end_step_percent: float = Field(default=1.0) - # FIXME: replace with guess_mode with enum control_mode: BALANCED, MORE_PROMPT, MORE_CONTROL - guess_mode: bool = Field(default=False) # guess_mode can work with or without prompt - cfg_injection: bool = Field(default=False) - soft_injection: bool = Field(default=False) + control_mode: str = Field(default="balanced") + @dataclass(frozen=True) class ConditioningData: @@ -662,44 +660,30 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): # i.e. before or after passing it to InvokeAIDiffuserComponent unet_latent_input = self.scheduler.scale_model_input(latents, timestep) - # # guess mode handling from diffusers - # if guess_mode and do_classifier_free_guidance: - # # Infer ControlNet only for the conditional batch. - # control_model_input = latents - # control_model_input = self.scheduler.scale_model_input(control_model_input, t) - # controlnet_prompt_embeds = prompt_embeds.chunk(2)[1] - # else: - # control_model_input = unet_latent_input - # controlnet_prompt_embeds = prompt_embeds - # default is no controlnet, so set controlnet processing output to None down_block_res_samples, mid_block_res_sample = None, None if control_data is not None: - # FIXME: make sure guidance_scale <= 1.0 is handled correctly if doing per-step guidance setting - # UPDATE: I think this is fixed now with pydantic validator for cfg_scale? - # So we should _never_ have guidance_scale <= 1.0 - # if conditioning_data.guidance_scale > 1.0: - # if conditioning_data.guidance_scale is not None: - # if guess_mode is False: - # # expand the latents input to control model if doing classifier free guidance - # # (which I think for now is always true, there is conditional elsewhere that stops execution if - # # classifier_free_guidance is <= 1.0 ?) - # control_latent_input = torch.cat([unet_latent_input] * 2) - # else: - # control_latent_input = unet_latent_input # control_data should be type List[ControlNetData] # this loop covers both ControlNet (one ControlNetData in list) # and MultiControlNet (multiple ControlNetData in list) for i, control_datum in enumerate(control_data): - # print("controlnet", i, "==>", type(control_datum)) + control_mode = control_datum.control_mode + # soft_injection and cfg_injection are the two ControlNet control_mode booleans + # that are combined at higher level to make control_mode enum + # soft_injection determines whether to do per-layer re-weighting adjustment (if True) + # or default weighting (if False) + soft_injection = (control_mode == "more_prompt" or control_mode == "more_control") + # cfg_injection = determines whether to apply ControlNet to only the conditional (if True) + # or the default both conditional and unconditional (if False) + cfg_injection = (control_mode == "more_control" or control_mode == "even_more_control") + first_control_step = math.floor(control_datum.begin_step_percent * total_step_count) last_control_step = math.ceil(control_datum.end_step_percent * total_step_count) # only apply controlnet if current step is within the controlnet's begin/end step range if step_index >= first_control_step and step_index <= last_control_step: - # guess_mode = control_datum.guess_mode - guess_mode = control_datum.cfg_injection - if guess_mode: + + if cfg_injection: control_latent_input = unet_latent_input else: # expand the latents input to control model if doing classifier free guidance @@ -707,15 +691,11 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): # classifier_free_guidance is <= 1.0 ?) control_latent_input = torch.cat([unet_latent_input] * 2) - print("running controlnet", i, "for step", step_index) - print("guess mode: ", guess_mode) - print("guess mode type: ", type(guess_mode)) - if guess_mode: # only using prompt conditioning in unconditioned + if cfg_injection: # only applying ControlNet to conditional instead of in unconditioned encoder_hidden_states = torch.cat([conditioning_data.unconditioned_embeddings]) else: encoder_hidden_states = torch.cat([conditioning_data.unconditioned_embeddings, conditioning_data.text_embeddings]) - print("encoder_hidden_states.shape", encoder_hidden_states.shape) if isinstance(control_datum.weight, list): # if controlnet has multiple weights, use the weight for the current step controlnet_weight = control_datum.weight[step_index] @@ -723,35 +703,20 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): # if controlnet has a single weight, use it for all steps controlnet_weight = control_datum.weight - # guess mode handling from diffusers controlnet pipeline: - # if guess_mode and do_classifier_free_guidance: - # # Infer ControlNet only for the conditional batch. - # latent_control_input = latents - # latent_control_input = self.scheduler.scale_model_input(control_model_input, t) - # controlnet_prompt_embeds = prompt_embeds.chunk(2)[1] - # else: - # control_model_input = unet_latent_input - # controlnet_prompt_embeds = prompt_embeds - # controlnet(s) inference down_samples, mid_sample = control_datum.model( sample=control_latent_input, timestep=timestep, - # encoder_hidden_states=torch.cat([conditioning_data.unconditioned_embeddings, - # conditioning_data.text_embeddings]), encoder_hidden_states=encoder_hidden_states, controlnet_cond=control_datum.image_tensor, conditioning_scale=controlnet_weight, # controlnet specific, NOT the guidance scale - # cross_attention_kwargs, - # guess_mode=guess_mode, - guess_mode=control_datum.soft_injection, + guess_mode=soft_injection, # this is still called guess_mode in diffusers ControlNetModel return_dict=False, ) - print("finished ControlNetModel() call, step", step_index) - if guess_mode: + if cfg_injection: # Inferred ControlNet only for the conditional batch. # To apply the output of ControlNet to both the unconditional and conditional batches, - # add 0 to the unconditional batch to keep it unchanged. + # add 0 to the unconditional batch to keep it unchanged. down_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_samples] mid_sample = torch.cat([torch.zeros_like(mid_sample), mid_sample]) @@ -765,14 +730,6 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): ] mid_block_res_sample += mid_sample - # guess mode handling from diffusers controlnet pipeline: - # if guess_mode and do_classifier_free_guidance: - # # Inferred ControlNet only for the conditional batch. - # # To apply the output of ControlNet to both the unconditional and conditional batches, - # # add 0 to the unconditional batch to keep it unchanged. - # down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples] - # mid_block_res_sample = torch.cat([torch.zeros_like(mid_block_res_sample), mid_block_res_sample]) - # predict the noise residual noise_pred = self.invokeai_diffuser.do_diffusion_step( x=unet_latent_input, @@ -1103,9 +1060,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): device="cuda", dtype=torch.float16, do_classifier_free_guidance=True, - guess_mode=False, - soft_injection=False, - cfg_injection=False, + control_mode="balanced" ): if not isinstance(image, torch.Tensor): @@ -1136,7 +1091,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): repeat_by = num_images_per_prompt image = image.repeat_interleave(repeat_by, dim=0) image = image.to(device=device, dtype=dtype) - # if do_classifier_free_guidance and not guess_mode: + cfg_injection = (control_mode == "more_control" or control_mode == "even_more_control") if do_classifier_free_guidance and not cfg_injection: image = torch.cat([image] * 2) return image From cfd49e392183ba2d5d1160c2467a65445484a49c Mon Sep 17 00:00:00 2001 From: user1 Date: Tue, 13 Jun 2023 21:33:15 -0700 Subject: [PATCH 06/13] Removing vestigial comments. --- invokeai/backend/stable_diffusion/diffusers_pipeline.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index ac693222ca..58ea30ef48 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -730,14 +730,6 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): ] mid_block_res_sample += mid_sample - # guess mode handling from diffusers controlnet pipeline: - # if guess_mode and do_classifier_free_guidance: - # # Inferred ControlNet only for the conditional batch. - # # To apply the output of ControlNet to both the unconditional and conditional batches, - # # add 0 to the unconditional batch to keep it unchanged. - # down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples] - # mid_block_res_sample = torch.cat([torch.zeros_like(mid_block_res_sample), mid_block_res_sample]) - # predict the noise residual noise_pred = self.invokeai_diffuser.do_diffusion_step( x=unet_latent_input, From 5cd0e908166cba5f39a215af97c0457668c0fd70 Mon Sep 17 00:00:00 2001 From: user1 Date: Tue, 13 Jun 2023 22:30:17 -0700 Subject: [PATCH 07/13] Renamed ControlNet control_mode option "even_more_control" to "unbalanced" --- invokeai/app/invocations/controlnet_image_processors.py | 2 +- invokeai/backend/stable_diffusion/diffusers_pipeline.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index c433e90648..5252ba72ba 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -94,7 +94,7 @@ CONTROLNET_DEFAULT_MODELS = [ ] CONTROLNET_NAME_VALUES = Literal[tuple(CONTROLNET_DEFAULT_MODELS)] -CONTROLNET_MODE_VALUES = Literal[tuple(["balanced", "more_prompt", "more_control", "even_more_control"])] +CONTROLNET_MODE_VALUES = Literal[tuple(["balanced", "more_prompt", "more_control", "unbalanced"])] class ControlField(BaseModel): image: ImageField = Field(default=None, description="The control image") diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 58ea30ef48..6edf336fba 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -676,7 +676,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): soft_injection = (control_mode == "more_prompt" or control_mode == "more_control") # cfg_injection = determines whether to apply ControlNet to only the conditional (if True) # or the default both conditional and unconditional (if False) - cfg_injection = (control_mode == "more_control" or control_mode == "even_more_control") + cfg_injection = (control_mode == "more_control" or control_mode == "unbalanced") first_control_step = math.floor(control_datum.begin_step_percent * total_step_count) last_control_step = math.ceil(control_datum.end_step_percent * total_step_count) @@ -1091,7 +1091,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): repeat_by = num_images_per_prompt image = image.repeat_interleave(repeat_by, dim=0) image = image.to(device=device, dtype=dtype) - cfg_injection = (control_mode == "more_control" or control_mode == "even_more_control") + cfg_injection = (control_mode == "more_control" or control_mode == "unbalanced") if do_classifier_free_guidance and not cfg_injection: image = torch.cat([image] * 2) return image From eb7047b21dbb5e5663f441cecf3c8155bd338577 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:26:02 +1200 Subject: [PATCH 08/13] chore: Rebuild WebAPI --- .../frontend/web/src/services/api/index.ts | 2 + .../src/services/api/models/AddInvocation.ts | 1 - .../services/api/models/Body_upload_image.ts | 1 - .../models/CannyImageProcessorInvocation.ts | 1 - .../src/services/api/models/CkptModelInfo.ts | 1 - .../services/api/models/CollectInvocation.ts | 1 - .../api/models/CollectInvocationOutput.ts | 1 - .../web/src/services/api/models/ColorField.ts | 1 - .../services/api/models/CompelInvocation.ts | 1 - .../src/services/api/models/CompelOutput.ts | 1 - .../services/api/models/ConditioningField.ts | 1 - .../ContentShuffleImageProcessorInvocation.ts | 1 - .../src/services/api/models/ControlField.ts | 7 +- .../api/models/ControlNetInvocation.ts | 9 +- .../src/services/api/models/ControlOutput.ts | 3 +- .../services/api/models/CreateModelRequest.ts | 1 - .../api/models/CvInpaintInvocation.ts | 1 - .../services/api/models/DiffusersModelInfo.ts | 1 - .../services/api/models/DivideInvocation.ts | 1 - .../web/src/services/api/models/Edge.ts | 1 - .../src/services/api/models/EdgeConnection.ts | 1 - .../api/models/FloatCollectionOutput.ts | 1 - .../api/models/FloatLinearRangeInvocation.ts | 30 +++ .../src/services/api/models/FloatOutput.ts | 1 - .../web/src/services/api/models/Graph.ts | 5 +- .../api/models/GraphExecutionState.ts | 3 +- .../services/api/models/GraphInvocation.ts | 1 - .../api/models/GraphInvocationOutput.ts | 1 - .../api/models/HTTPValidationError.ts | 1 - .../api/models/HedImageProcessorInvocation.ts | 15 +- .../api/models/HedImageprocessorInvocation.ts | 15 +- .../api/models/ImageBlurInvocation.ts | 1 - .../api/models/ImageChannelInvocation.ts | 1 - .../api/models/ImageConvertInvocation.ts | 1 - .../api/models/ImageCropInvocation.ts | 1 - .../web/src/services/api/models/ImageDTO.ts | 1 - .../web/src/services/api/models/ImageField.ts | 1 - .../api/models/ImageInverseLerpInvocation.ts | 1 - .../api/models/ImageLerpInvocation.ts | 1 - .../src/services/api/models/ImageMetadata.ts | 3 +- .../api/models/ImageMultiplyInvocation.ts | 1 - .../src/services/api/models/ImageOutput.ts | 1 - .../api/models/ImagePasteInvocation.ts | 1 - .../api/models/ImageProcessorInvocation.ts | 1 - .../services/api/models/ImageRecordChanges.ts | 1 - .../api/models/ImageResizeInvocation.ts | 1 - .../api/models/ImageScaleInvocation.ts | 1 - .../api/models/ImageToImageInvocation.ts | 1 - .../api/models/ImageToLatentsInvocation.ts | 1 - .../src/services/api/models/ImageUrlsDTO.ts | 1 - .../api/models/InfillColorInvocation.ts | 1 - .../api/models/InfillPatchMatchInvocation.ts | 1 - .../api/models/InfillTileInvocation.ts | 1 - .../services/api/models/InpaintInvocation.ts | 1 - .../api/models/IntCollectionOutput.ts | 1 - .../web/src/services/api/models/IntOutput.ts | 1 - .../services/api/models/IterateInvocation.ts | 1 - .../api/models/IterateInvocationOutput.ts | 1 - .../src/services/api/models/LatentsField.ts | 1 - .../src/services/api/models/LatentsOutput.ts | 1 - .../api/models/LatentsToImageInvocation.ts | 1 - .../api/models/LatentsToLatentsInvocation.ts | 3 +- .../LineartAnimeImageProcessorInvocation.ts | 1 - .../models/LineartImageProcessorInvocation.ts | 1 - .../api/models/LoadImageInvocation.ts | 1 - .../api/models/MaskFromAlphaInvocation.ts | 1 - .../web/src/services/api/models/MaskOutput.ts | 1 - .../MediapipeFaceProcessorInvocation.ts | 1 - .../MidasDepthImageProcessorInvocation.ts | 1 - .../models/MlsdImageProcessorInvocation.ts | 1 - .../web/src/services/api/models/ModelsList.ts | 1 - .../services/api/models/MultiplyInvocation.ts | 1 - .../services/api/models/NoiseInvocation.ts | 1 - .../src/services/api/models/NoiseOutput.ts | 1 - .../NormalbaeImageProcessorInvocation.ts | 1 - .../OffsetPaginatedResults_ImageDTO_.ts | 1 - .../OpenposeImageProcessorInvocation.ts | 1 - .../PaginatedResults_GraphExecutionState_.ts | 1 - .../api/models/ParamFloatInvocation.ts | 1 - .../services/api/models/ParamIntInvocation.ts | 1 - .../models/PidiImageProcessorInvocation.ts | 1 - .../src/services/api/models/PromptOutput.ts | 1 - .../api/models/RandomIntInvocation.ts | 1 - .../api/models/RandomRangeInvocation.ts | 1 - .../services/api/models/RangeInvocation.ts | 1 - .../api/models/RangeOfSizeInvocation.ts | 1 - .../api/models/ResizeLatentsInvocation.ts | 1 - .../api/models/RestoreFaceInvocation.ts | 1 - .../api/models/ScaleLatentsInvocation.ts | 1 - .../api/models/ShowImageInvocation.ts | 1 - .../api/models/StepParamEasingInvocation.ts | 58 +++++ .../services/api/models/SubtractInvocation.ts | 1 - .../api/models/TextToImageInvocation.ts | 1 - .../api/models/TextToLatentsInvocation.ts | 3 +- .../services/api/models/UpscaleInvocation.ts | 1 - .../web/src/services/api/models/VaeRepo.ts | 1 - .../services/api/models/ValidationError.ts | 1 - .../ZoeDepthImageProcessorInvocation.ts | 1 - .../services/api/services/ImagesService.ts | 240 +++++++++--------- .../services/api/services/ModelsService.ts | 16 +- .../services/api/services/SessionsService.ts | 238 ++++++++--------- 101 files changed, 375 insertions(+), 360 deletions(-) create mode 100644 invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts diff --git a/invokeai/frontend/web/src/services/api/index.ts b/invokeai/frontend/web/src/services/api/index.ts index 187752627a..6d1dbed780 100644 --- a/invokeai/frontend/web/src/services/api/index.ts +++ b/invokeai/frontend/web/src/services/api/index.ts @@ -27,6 +27,7 @@ export type { DivideInvocation } from './models/DivideInvocation'; export type { Edge } from './models/Edge'; export type { EdgeConnection } from './models/EdgeConnection'; export type { FloatCollectionOutput } from './models/FloatCollectionOutput'; +export type { FloatLinearRangeInvocation } from './models/FloatLinearRangeInvocation'; export type { FloatOutput } from './models/FloatOutput'; export type { Graph } from './models/Graph'; export type { GraphExecutionState } from './models/GraphExecutionState'; @@ -95,6 +96,7 @@ export type { ResourceOrigin } from './models/ResourceOrigin'; export type { RestoreFaceInvocation } from './models/RestoreFaceInvocation'; export type { ScaleLatentsInvocation } from './models/ScaleLatentsInvocation'; export type { ShowImageInvocation } from './models/ShowImageInvocation'; +export type { StepParamEasingInvocation } from './models/StepParamEasingInvocation'; export type { SubtractInvocation } from './models/SubtractInvocation'; export type { TextToImageInvocation } from './models/TextToImageInvocation'; export type { TextToLatentsInvocation } from './models/TextToLatentsInvocation'; diff --git a/invokeai/frontend/web/src/services/api/models/AddInvocation.ts b/invokeai/frontend/web/src/services/api/models/AddInvocation.ts index e9671a918f..b7c1c88187 100644 --- a/invokeai/frontend/web/src/services/api/models/AddInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/AddInvocation.ts @@ -24,4 +24,3 @@ export type AddInvocation = { */ 'b'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/Body_upload_image.ts b/invokeai/frontend/web/src/services/api/models/Body_upload_image.ts index b81146d3ab..fd26ed49e0 100644 --- a/invokeai/frontend/web/src/services/api/models/Body_upload_image.ts +++ b/invokeai/frontend/web/src/services/api/models/Body_upload_image.ts @@ -5,4 +5,3 @@ export type Body_upload_image = { file: Blob; }; - diff --git a/invokeai/frontend/web/src/services/api/models/CannyImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/CannyImageProcessorInvocation.ts index d5203867ac..3f1a5b3d46 100644 --- a/invokeai/frontend/web/src/services/api/models/CannyImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/CannyImageProcessorInvocation.ts @@ -30,4 +30,3 @@ export type CannyImageProcessorInvocation = { */ high_threshold?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/CkptModelInfo.ts b/invokeai/frontend/web/src/services/api/models/CkptModelInfo.ts index 2ae7c09674..0a5d198c94 100644 --- a/invokeai/frontend/web/src/services/api/models/CkptModelInfo.ts +++ b/invokeai/frontend/web/src/services/api/models/CkptModelInfo.ts @@ -29,4 +29,3 @@ export type CkptModelInfo = { */ height?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/CollectInvocation.ts b/invokeai/frontend/web/src/services/api/models/CollectInvocation.ts index f190ab7073..a0fe38613c 100644 --- a/invokeai/frontend/web/src/services/api/models/CollectInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/CollectInvocation.ts @@ -24,4 +24,3 @@ export type CollectInvocation = { */ collection?: Array; }; - diff --git a/invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts b/invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts index a5976242ea..62c785f374 100644 --- a/invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts @@ -12,4 +12,3 @@ export type CollectInvocationOutput = { */ collection: Array; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ColorField.ts b/invokeai/frontend/web/src/services/api/models/ColorField.ts index e0a609ec12..25167433d4 100644 --- a/invokeai/frontend/web/src/services/api/models/ColorField.ts +++ b/invokeai/frontend/web/src/services/api/models/ColorField.ts @@ -20,4 +20,3 @@ export type ColorField = { */ 'a': number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/CompelInvocation.ts b/invokeai/frontend/web/src/services/api/models/CompelInvocation.ts index 1dc390c1be..4884712f04 100644 --- a/invokeai/frontend/web/src/services/api/models/CompelInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/CompelInvocation.ts @@ -24,4 +24,3 @@ export type CompelInvocation = { */ model?: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/CompelOutput.ts b/invokeai/frontend/web/src/services/api/models/CompelOutput.ts index 94f1fcb282..b42ab73c74 100644 --- a/invokeai/frontend/web/src/services/api/models/CompelOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/CompelOutput.ts @@ -14,4 +14,3 @@ export type CompelOutput = { */ conditioning?: ConditioningField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ConditioningField.ts b/invokeai/frontend/web/src/services/api/models/ConditioningField.ts index 7e53a63b42..da227dd4f9 100644 --- a/invokeai/frontend/web/src/services/api/models/ConditioningField.ts +++ b/invokeai/frontend/web/src/services/api/models/ConditioningField.ts @@ -8,4 +8,3 @@ export type ConditioningField = { */ conditioning_name: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ContentShuffleImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/ContentShuffleImageProcessorInvocation.ts index e3f67ec9be..43f6100db8 100644 --- a/invokeai/frontend/web/src/services/api/models/ContentShuffleImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ContentShuffleImageProcessorInvocation.ts @@ -42,4 +42,3 @@ export type ContentShuffleImageProcessorInvocation = { */ 'f'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ControlField.ts b/invokeai/frontend/web/src/services/api/models/ControlField.ts index a67655c018..3965da6b3b 100644 --- a/invokeai/frontend/web/src/services/api/models/ControlField.ts +++ b/invokeai/frontend/web/src/services/api/models/ControlField.ts @@ -16,7 +16,7 @@ export type ControlField = { /** * The weight given to the ControlNet */ - control_weight: number; + control_weight: (number | Array); /** * When the ControlNet is first applied (% of total steps) */ @@ -25,5 +25,8 @@ export type ControlField = { * When the ControlNet is last applied (% of total steps) */ end_step_percent: number; + /** + * The contorl mode to use + */ + control_mode?: 'balanced' | 'more_prompt' | 'more_control' | 'unbalanced'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ControlNetInvocation.ts b/invokeai/frontend/web/src/services/api/models/ControlNetInvocation.ts index 92688d6adc..4798cc2e8d 100644 --- a/invokeai/frontend/web/src/services/api/models/ControlNetInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ControlNetInvocation.ts @@ -22,13 +22,13 @@ export type ControlNetInvocation = { */ image?: ImageField; /** - * The ControlNet model to use + * control model used */ control_model?: 'lllyasviel/sd-controlnet-canny' | 'lllyasviel/sd-controlnet-depth' | 'lllyasviel/sd-controlnet-hed' | 'lllyasviel/sd-controlnet-seg' | 'lllyasviel/sd-controlnet-openpose' | 'lllyasviel/sd-controlnet-scribble' | 'lllyasviel/sd-controlnet-normal' | 'lllyasviel/sd-controlnet-mlsd' | 'lllyasviel/control_v11p_sd15_canny' | 'lllyasviel/control_v11p_sd15_openpose' | 'lllyasviel/control_v11p_sd15_seg' | 'lllyasviel/control_v11f1p_sd15_depth' | 'lllyasviel/control_v11p_sd15_normalbae' | 'lllyasviel/control_v11p_sd15_scribble' | 'lllyasviel/control_v11p_sd15_mlsd' | 'lllyasviel/control_v11p_sd15_softedge' | 'lllyasviel/control_v11p_sd15s2_lineart_anime' | 'lllyasviel/control_v11p_sd15_lineart' | 'lllyasviel/control_v11p_sd15_inpaint' | 'lllyasviel/control_v11e_sd15_shuffle' | 'lllyasviel/control_v11e_sd15_ip2p' | 'lllyasviel/control_v11f1e_sd15_tile' | 'thibaud/controlnet-sd21-openpose-diffusers' | 'thibaud/controlnet-sd21-canny-diffusers' | 'thibaud/controlnet-sd21-depth-diffusers' | 'thibaud/controlnet-sd21-scribble-diffusers' | 'thibaud/controlnet-sd21-hed-diffusers' | 'thibaud/controlnet-sd21-zoedepth-diffusers' | 'thibaud/controlnet-sd21-color-diffusers' | 'thibaud/controlnet-sd21-openposev2-diffusers' | 'thibaud/controlnet-sd21-lineart-diffusers' | 'thibaud/controlnet-sd21-normalbae-diffusers' | 'thibaud/controlnet-sd21-ade20k-diffusers' | 'CrucibleAI/ControlNetMediaPipeFace,diffusion_sd15' | 'CrucibleAI/ControlNetMediaPipeFace'; /** * The weight given to the ControlNet */ - control_weight?: number; + control_weight?: (number | Array); /** * When the ControlNet is first applied (% of total steps) */ @@ -37,5 +37,8 @@ export type ControlNetInvocation = { * When the ControlNet is last applied (% of total steps) */ end_step_percent?: number; + /** + * The control mode used + */ + control_mode?: 'balanced' | 'more_prompt' | 'more_control' | 'unbalanced'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ControlOutput.ts b/invokeai/frontend/web/src/services/api/models/ControlOutput.ts index 8c8b76a32f..625d8f670d 100644 --- a/invokeai/frontend/web/src/services/api/models/ControlOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/ControlOutput.ts @@ -10,8 +10,7 @@ import type { ControlField } from './ControlField'; export type ControlOutput = { type?: 'control_output'; /** - * The output control image + * The control info */ control?: ControlField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/CreateModelRequest.ts b/invokeai/frontend/web/src/services/api/models/CreateModelRequest.ts index 0b0f52b8fe..80976f126f 100644 --- a/invokeai/frontend/web/src/services/api/models/CreateModelRequest.ts +++ b/invokeai/frontend/web/src/services/api/models/CreateModelRequest.ts @@ -15,4 +15,3 @@ export type CreateModelRequest = { */ info: (CkptModelInfo | DiffusersModelInfo); }; - diff --git a/invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts b/invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts index 874df93c30..4f1c33483e 100644 --- a/invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts @@ -26,4 +26,3 @@ export type CvInpaintInvocation = { */ mask?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/DiffusersModelInfo.ts b/invokeai/frontend/web/src/services/api/models/DiffusersModelInfo.ts index 5be4801cdd..d6012b9739 100644 --- a/invokeai/frontend/web/src/services/api/models/DiffusersModelInfo.ts +++ b/invokeai/frontend/web/src/services/api/models/DiffusersModelInfo.ts @@ -23,4 +23,3 @@ export type DiffusersModelInfo = { */ path?: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/DivideInvocation.ts b/invokeai/frontend/web/src/services/api/models/DivideInvocation.ts index fd5b3475ae..5b37dea710 100644 --- a/invokeai/frontend/web/src/services/api/models/DivideInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/DivideInvocation.ts @@ -24,4 +24,3 @@ export type DivideInvocation = { */ 'b'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/Edge.ts b/invokeai/frontend/web/src/services/api/models/Edge.ts index bba275cb26..e72108f74a 100644 --- a/invokeai/frontend/web/src/services/api/models/Edge.ts +++ b/invokeai/frontend/web/src/services/api/models/Edge.ts @@ -14,4 +14,3 @@ export type Edge = { */ destination: EdgeConnection; }; - diff --git a/invokeai/frontend/web/src/services/api/models/EdgeConnection.ts b/invokeai/frontend/web/src/services/api/models/EdgeConnection.ts index ecbddccd76..ab4c6d354b 100644 --- a/invokeai/frontend/web/src/services/api/models/EdgeConnection.ts +++ b/invokeai/frontend/web/src/services/api/models/EdgeConnection.ts @@ -12,4 +12,3 @@ export type EdgeConnection = { */ field: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/FloatCollectionOutput.ts b/invokeai/frontend/web/src/services/api/models/FloatCollectionOutput.ts index a3f08247a4..fb9e4164e6 100644 --- a/invokeai/frontend/web/src/services/api/models/FloatCollectionOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/FloatCollectionOutput.ts @@ -12,4 +12,3 @@ export type FloatCollectionOutput = { */ collection?: Array; }; - diff --git a/invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts b/invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts new file mode 100644 index 0000000000..a9e67d8135 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts @@ -0,0 +1,30 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Creates a range + */ +export type FloatLinearRangeInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Whether or not this node is an intermediate node. + */ + is_intermediate?: boolean; + type?: 'float_range'; + /** + * The first value of the range + */ + start?: number; + /** + * The last value of the range + */ + stop?: number; + /** + * number of values to interpolate over (including start and stop) + */ + steps?: number; +}; diff --git a/invokeai/frontend/web/src/services/api/models/FloatOutput.ts b/invokeai/frontend/web/src/services/api/models/FloatOutput.ts index 2331936b30..db2784ed9f 100644 --- a/invokeai/frontend/web/src/services/api/models/FloatOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/FloatOutput.ts @@ -12,4 +12,3 @@ export type FloatOutput = { */ param?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/Graph.ts b/invokeai/frontend/web/src/services/api/models/Graph.ts index 2c7efbb423..dfb6fb1869 100644 --- a/invokeai/frontend/web/src/services/api/models/Graph.ts +++ b/invokeai/frontend/web/src/services/api/models/Graph.ts @@ -11,6 +11,7 @@ import type { ControlNetInvocation } from './ControlNetInvocation'; import type { CvInpaintInvocation } from './CvInpaintInvocation'; import type { DivideInvocation } from './DivideInvocation'; import type { Edge } from './Edge'; +import type { FloatLinearRangeInvocation } from './FloatLinearRangeInvocation'; import type { GraphInvocation } from './GraphInvocation'; import type { HedImageProcessorInvocation } from './HedImageProcessorInvocation'; import type { ImageBlurInvocation } from './ImageBlurInvocation'; @@ -55,6 +56,7 @@ import type { ResizeLatentsInvocation } from './ResizeLatentsInvocation'; import type { RestoreFaceInvocation } from './RestoreFaceInvocation'; import type { ScaleLatentsInvocation } from './ScaleLatentsInvocation'; import type { ShowImageInvocation } from './ShowImageInvocation'; +import type { StepParamEasingInvocation } from './StepParamEasingInvocation'; import type { SubtractInvocation } from './SubtractInvocation'; import type { TextToImageInvocation } from './TextToImageInvocation'; import type { TextToLatentsInvocation } from './TextToLatentsInvocation'; @@ -69,10 +71,9 @@ export type Graph = { /** * The nodes in this graph */ - nodes?: Record; + nodes?: Record; /** * The connections between nodes and their fields in this graph */ edges?: Array; }; - diff --git a/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts b/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts index ea41ce055b..e522f41c4e 100644 --- a/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts +++ b/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts @@ -45,7 +45,7 @@ export type GraphExecutionState = { /** * The results of node executions */ - results: Record; + results: Record; /** * Errors raised when executing nodes */ @@ -59,4 +59,3 @@ export type GraphExecutionState = { */ source_prepared_mapping: Record>; }; - diff --git a/invokeai/frontend/web/src/services/api/models/GraphInvocation.ts b/invokeai/frontend/web/src/services/api/models/GraphInvocation.ts index 8512faae74..a7e3d6c948 100644 --- a/invokeai/frontend/web/src/services/api/models/GraphInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/GraphInvocation.ts @@ -22,4 +22,3 @@ export type GraphInvocation = { */ graph?: Graph; }; - diff --git a/invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts b/invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts index af0aae3edb..219a4a675d 100644 --- a/invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts @@ -8,4 +8,3 @@ export type GraphInvocationOutput = { type: 'graph_output'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts b/invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts index 5e13adc4e5..69908c3bba 100644 --- a/invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts +++ b/invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts @@ -7,4 +7,3 @@ import type { ValidationError } from './ValidationError'; export type HTTPValidationError = { detail?: Array; }; - diff --git a/invokeai/frontend/web/src/services/api/models/HedImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/HedImageProcessorInvocation.ts index 6dea43dc32..387e8c8634 100644 --- a/invokeai/frontend/web/src/services/api/models/HedImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/HedImageProcessorInvocation.ts @@ -7,27 +7,30 @@ import type { ImageField } from './ImageField'; /** * Applies HED edge detection to image */ -export type HedImageprocessorInvocation = { +export type HedImageProcessorInvocation = { /** * The id of this node. Must be unique among all nodes. */ id: string; + /** + * Whether or not this node is an intermediate node. + */ + is_intermediate?: boolean; type?: 'hed_image_processor'; /** - * image to process + * The image to process */ image?: ImageField; /** - * pixel resolution for edge detection + * The pixel resolution for detection */ detect_resolution?: number; /** - * pixel resolution for output image + * The pixel resolution for the output image */ image_resolution?: number; /** - * whether to use scribble mode + * Whether to use scribble mode */ scribble?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/HedImageprocessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/HedImageprocessorInvocation.ts index 6dea43dc32..387e8c8634 100644 --- a/invokeai/frontend/web/src/services/api/models/HedImageprocessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/HedImageprocessorInvocation.ts @@ -7,27 +7,30 @@ import type { ImageField } from './ImageField'; /** * Applies HED edge detection to image */ -export type HedImageprocessorInvocation = { +export type HedImageProcessorInvocation = { /** * The id of this node. Must be unique among all nodes. */ id: string; + /** + * Whether or not this node is an intermediate node. + */ + is_intermediate?: boolean; type?: 'hed_image_processor'; /** - * image to process + * The image to process */ image?: ImageField; /** - * pixel resolution for edge detection + * The pixel resolution for detection */ detect_resolution?: number; /** - * pixel resolution for output image + * The pixel resolution for the output image */ image_resolution?: number; /** - * whether to use scribble mode + * Whether to use scribble mode */ scribble?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageBlurInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageBlurInvocation.ts index 3ba86d8fab..6466efcd82 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageBlurInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageBlurInvocation.ts @@ -30,4 +30,3 @@ export type ImageBlurInvocation = { */ blur_type?: 'gaussian' | 'box'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageChannelInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageChannelInvocation.ts index 47bfd4110f..d6abae5eae 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageChannelInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageChannelInvocation.ts @@ -26,4 +26,3 @@ export type ImageChannelInvocation = { */ channel?: 'A' | 'R' | 'G' | 'B'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageConvertInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageConvertInvocation.ts index 4bd59d03b0..d303c7ce79 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageConvertInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageConvertInvocation.ts @@ -26,4 +26,3 @@ export type ImageConvertInvocation = { */ mode?: 'L' | 'RGB' | 'RGBA' | 'CMYK' | 'YCbCr' | 'LAB' | 'HSV' | 'I' | 'F'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageCropInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageCropInvocation.ts index 5207ebbf6d..e29e177aa7 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageCropInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageCropInvocation.ts @@ -38,4 +38,3 @@ export type ImageCropInvocation = { */ height?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageDTO.ts b/invokeai/frontend/web/src/services/api/models/ImageDTO.ts index f5f2603b03..a831bc1525 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageDTO.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageDTO.ts @@ -67,4 +67,3 @@ export type ImageDTO = { */ metadata?: ImageMetadata; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageField.ts b/invokeai/frontend/web/src/services/api/models/ImageField.ts index 63a12f4730..be105c277b 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageField.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageField.ts @@ -17,4 +17,3 @@ export type ImageField = { */ image_name: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageInverseLerpInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageInverseLerpInvocation.ts index 0347d4dc38..63220c8047 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageInverseLerpInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageInverseLerpInvocation.ts @@ -30,4 +30,3 @@ export type ImageInverseLerpInvocation = { */ max?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageLerpInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageLerpInvocation.ts index 388c86061c..444c7e6467 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageLerpInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageLerpInvocation.ts @@ -30,4 +30,3 @@ export type ImageLerpInvocation = { */ max?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageMetadata.ts b/invokeai/frontend/web/src/services/api/models/ImageMetadata.ts index 76c0155e97..8aecdddc4f 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageMetadata.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageMetadata.ts @@ -40,7 +40,7 @@ export type ImageMetadata = { /** * The classifier-free guidance scale. */ - cfg_scale?: number; + cfg_scale?: (number | Array); /** * The number of steps used for inference. */ @@ -78,4 +78,3 @@ export type ImageMetadata = { */ extra?: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageMultiplyInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageMultiplyInvocation.ts index 751ee49158..724061fce8 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageMultiplyInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageMultiplyInvocation.ts @@ -26,4 +26,3 @@ export type ImageMultiplyInvocation = { */ image2?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageOutput.ts b/invokeai/frontend/web/src/services/api/models/ImageOutput.ts index d7db0c11de..c030632926 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageOutput.ts @@ -22,4 +22,3 @@ export type ImageOutput = { */ height: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImagePasteInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImagePasteInvocation.ts index c883b9a5d8..5af28452b6 100644 --- a/invokeai/frontend/web/src/services/api/models/ImagePasteInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImagePasteInvocation.ts @@ -38,4 +38,3 @@ export type ImagePasteInvocation = { */ 'y'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageProcessorInvocation.ts index 0d995c4e68..e0058a78ca 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageProcessorInvocation.ts @@ -22,4 +22,3 @@ export type ImageProcessorInvocation = { */ image?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageRecordChanges.ts b/invokeai/frontend/web/src/services/api/models/ImageRecordChanges.ts index e597cd907d..209b6d8e88 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageRecordChanges.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageRecordChanges.ts @@ -26,4 +26,3 @@ export type ImageRecordChanges = { */ is_intermediate?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageResizeInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageResizeInvocation.ts index 3b096c83b7..f277516ccd 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageResizeInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageResizeInvocation.ts @@ -34,4 +34,3 @@ export type ImageResizeInvocation = { */ resample_mode?: 'nearest' | 'box' | 'bilinear' | 'hamming' | 'bicubic' | 'lanczos'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageScaleInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageScaleInvocation.ts index bf4da28a4a..709e1cc66a 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageScaleInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageScaleInvocation.ts @@ -30,4 +30,3 @@ export type ImageScaleInvocation = { */ resample_mode?: 'nearest' | 'box' | 'bilinear' | 'hamming' | 'bicubic' | 'lanczos'; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts index e63ec93ada..faa9d164a8 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts @@ -74,4 +74,3 @@ export type ImageToImageInvocation = { */ fit?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageToLatentsInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageToLatentsInvocation.ts index 5569c2fa86..03efd821ee 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageToLatentsInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageToLatentsInvocation.ts @@ -26,4 +26,3 @@ export type ImageToLatentsInvocation = { */ model?: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ImageUrlsDTO.ts b/invokeai/frontend/web/src/services/api/models/ImageUrlsDTO.ts index 81639be9b3..aa97cd476e 100644 --- a/invokeai/frontend/web/src/services/api/models/ImageUrlsDTO.ts +++ b/invokeai/frontend/web/src/services/api/models/ImageUrlsDTO.ts @@ -25,4 +25,3 @@ export type ImageUrlsDTO = { */ thumbnail_url: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/InfillColorInvocation.ts b/invokeai/frontend/web/src/services/api/models/InfillColorInvocation.ts index 3e637b299c..6d60bbe226 100644 --- a/invokeai/frontend/web/src/services/api/models/InfillColorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/InfillColorInvocation.ts @@ -27,4 +27,3 @@ export type InfillColorInvocation = { */ color?: ColorField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/InfillPatchMatchInvocation.ts b/invokeai/frontend/web/src/services/api/models/InfillPatchMatchInvocation.ts index 325bfe2080..bf6e8012b7 100644 --- a/invokeai/frontend/web/src/services/api/models/InfillPatchMatchInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/InfillPatchMatchInvocation.ts @@ -22,4 +22,3 @@ export type InfillPatchMatchInvocation = { */ image?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/InfillTileInvocation.ts b/invokeai/frontend/web/src/services/api/models/InfillTileInvocation.ts index dfb1cbc61d..551e00da16 100644 --- a/invokeai/frontend/web/src/services/api/models/InfillTileInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/InfillTileInvocation.ts @@ -30,4 +30,3 @@ export type InfillTileInvocation = { */ seed?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts b/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts index b8ed268ef9..e4ca53a5c2 100644 --- a/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts @@ -119,4 +119,3 @@ export type InpaintInvocation = { */ inpaint_replace?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/IntCollectionOutput.ts b/invokeai/frontend/web/src/services/api/models/IntCollectionOutput.ts index 93a115f980..1e60ee8009 100644 --- a/invokeai/frontend/web/src/services/api/models/IntCollectionOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/IntCollectionOutput.ts @@ -12,4 +12,3 @@ export type IntCollectionOutput = { */ collection?: Array; }; - diff --git a/invokeai/frontend/web/src/services/api/models/IntOutput.ts b/invokeai/frontend/web/src/services/api/models/IntOutput.ts index eeea6c68b4..58655d0858 100644 --- a/invokeai/frontend/web/src/services/api/models/IntOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/IntOutput.ts @@ -12,4 +12,3 @@ export type IntOutput = { */ 'a'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/IterateInvocation.ts b/invokeai/frontend/web/src/services/api/models/IterateInvocation.ts index 15bf92dfea..b6a70156c3 100644 --- a/invokeai/frontend/web/src/services/api/models/IterateInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/IterateInvocation.ts @@ -24,4 +24,3 @@ export type IterateInvocation = { */ index?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts b/invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts index ce8d9f8c4b..2eeffd05fd 100644 --- a/invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts @@ -12,4 +12,3 @@ export type IterateInvocationOutput = { */ item: any; }; - diff --git a/invokeai/frontend/web/src/services/api/models/LatentsField.ts b/invokeai/frontend/web/src/services/api/models/LatentsField.ts index bc6a525f7c..e7446e9cb3 100644 --- a/invokeai/frontend/web/src/services/api/models/LatentsField.ts +++ b/invokeai/frontend/web/src/services/api/models/LatentsField.ts @@ -11,4 +11,3 @@ export type LatentsField = { */ latents_name: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/LatentsOutput.ts b/invokeai/frontend/web/src/services/api/models/LatentsOutput.ts index 3e9c2f60e4..edf388dbf6 100644 --- a/invokeai/frontend/web/src/services/api/models/LatentsOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/LatentsOutput.ts @@ -22,4 +22,3 @@ export type LatentsOutput = { */ height: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/LatentsToImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/LatentsToImageInvocation.ts index fcaa37d7e8..1cc7d8ee3e 100644 --- a/invokeai/frontend/web/src/services/api/models/LatentsToImageInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/LatentsToImageInvocation.ts @@ -26,4 +26,3 @@ export type LatentsToImageInvocation = { */ model?: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts b/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts index f5b4912141..a58ea410f9 100644 --- a/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts @@ -38,7 +38,7 @@ export type LatentsToLatentsInvocation = { /** * The Classifier-Free Guidance, higher values may result in a result closer to the prompt */ - cfg_scale?: number; + cfg_scale?: (number | Array); /** * The scheduler to use */ @@ -60,4 +60,3 @@ export type LatentsToLatentsInvocation = { */ strength?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/LineartAnimeImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/LineartAnimeImageProcessorInvocation.ts index 5d239536d5..7c655480c7 100644 --- a/invokeai/frontend/web/src/services/api/models/LineartAnimeImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/LineartAnimeImageProcessorInvocation.ts @@ -30,4 +30,3 @@ export type LineartAnimeImageProcessorInvocation = { */ image_resolution?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/LineartImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/LineartImageProcessorInvocation.ts index 17720e689b..af3a527f3a 100644 --- a/invokeai/frontend/web/src/services/api/models/LineartImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/LineartImageProcessorInvocation.ts @@ -34,4 +34,3 @@ export type LineartImageProcessorInvocation = { */ coarse?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts index f20d983f9b..469e7200ad 100644 --- a/invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts @@ -22,4 +22,3 @@ export type LoadImageInvocation = { */ image?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts b/invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts index e3693f6d98..a031c0e05f 100644 --- a/invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts @@ -26,4 +26,3 @@ export type MaskFromAlphaInvocation = { */ invert?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/MaskOutput.ts b/invokeai/frontend/web/src/services/api/models/MaskOutput.ts index d4594fe6e9..05d2b36d58 100644 --- a/invokeai/frontend/web/src/services/api/models/MaskOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/MaskOutput.ts @@ -22,4 +22,3 @@ export type MaskOutput = { */ height?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/MediapipeFaceProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/MediapipeFaceProcessorInvocation.ts index aa7b966b4b..76e89422e9 100644 --- a/invokeai/frontend/web/src/services/api/models/MediapipeFaceProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/MediapipeFaceProcessorInvocation.ts @@ -30,4 +30,3 @@ export type MediapipeFaceProcessorInvocation = { */ min_confidence?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/MidasDepthImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/MidasDepthImageProcessorInvocation.ts index bd274228db..14cf26f075 100644 --- a/invokeai/frontend/web/src/services/api/models/MidasDepthImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/MidasDepthImageProcessorInvocation.ts @@ -30,4 +30,3 @@ export type MidasDepthImageProcessorInvocation = { */ bg_th?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/MlsdImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/MlsdImageProcessorInvocation.ts index 0e81c9a4b8..b2a15b5861 100644 --- a/invokeai/frontend/web/src/services/api/models/MlsdImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/MlsdImageProcessorInvocation.ts @@ -38,4 +38,3 @@ export type MlsdImageProcessorInvocation = { */ thr_d?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ModelsList.ts b/invokeai/frontend/web/src/services/api/models/ModelsList.ts index 7a7449542d..312f0c2a6c 100644 --- a/invokeai/frontend/web/src/services/api/models/ModelsList.ts +++ b/invokeai/frontend/web/src/services/api/models/ModelsList.ts @@ -8,4 +8,3 @@ import type { DiffusersModelInfo } from './DiffusersModelInfo'; export type ModelsList = { models: Record; }; - diff --git a/invokeai/frontend/web/src/services/api/models/MultiplyInvocation.ts b/invokeai/frontend/web/src/services/api/models/MultiplyInvocation.ts index 9fd716f33d..6a3b17feea 100644 --- a/invokeai/frontend/web/src/services/api/models/MultiplyInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/MultiplyInvocation.ts @@ -24,4 +24,3 @@ export type MultiplyInvocation = { */ 'b'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/NoiseInvocation.ts b/invokeai/frontend/web/src/services/api/models/NoiseInvocation.ts index 239a24bfe5..22846f5345 100644 --- a/invokeai/frontend/web/src/services/api/models/NoiseInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/NoiseInvocation.ts @@ -28,4 +28,3 @@ export type NoiseInvocation = { */ height?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/NoiseOutput.ts b/invokeai/frontend/web/src/services/api/models/NoiseOutput.ts index f1832d7aa2..cb1b13ef25 100644 --- a/invokeai/frontend/web/src/services/api/models/NoiseOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/NoiseOutput.ts @@ -22,4 +22,3 @@ export type NoiseOutput = { */ height: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/NormalbaeImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/NormalbaeImageProcessorInvocation.ts index 400068171e..29fcebf567 100644 --- a/invokeai/frontend/web/src/services/api/models/NormalbaeImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/NormalbaeImageProcessorInvocation.ts @@ -30,4 +30,3 @@ export type NormalbaeImageProcessorInvocation = { */ image_resolution?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/OffsetPaginatedResults_ImageDTO_.ts b/invokeai/frontend/web/src/services/api/models/OffsetPaginatedResults_ImageDTO_.ts index 3408bea6db..2b22b247b4 100644 --- a/invokeai/frontend/web/src/services/api/models/OffsetPaginatedResults_ImageDTO_.ts +++ b/invokeai/frontend/web/src/services/api/models/OffsetPaginatedResults_ImageDTO_.ts @@ -25,4 +25,3 @@ export type OffsetPaginatedResults_ImageDTO_ = { */ total: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/OpenposeImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/OpenposeImageProcessorInvocation.ts index 982ce8ade7..80c136546d 100644 --- a/invokeai/frontend/web/src/services/api/models/OpenposeImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/OpenposeImageProcessorInvocation.ts @@ -34,4 +34,3 @@ export type OpenposeImageProcessorInvocation = { */ image_resolution?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts b/invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts index dd9f50cd4a..cb5914f677 100644 --- a/invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts +++ b/invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts @@ -29,4 +29,3 @@ export type PaginatedResults_GraphExecutionState_ = { */ total: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ParamFloatInvocation.ts b/invokeai/frontend/web/src/services/api/models/ParamFloatInvocation.ts index 87c01f847f..4e9087237b 100644 --- a/invokeai/frontend/web/src/services/api/models/ParamFloatInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ParamFloatInvocation.ts @@ -20,4 +20,3 @@ export type ParamFloatInvocation = { */ param?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ParamIntInvocation.ts b/invokeai/frontend/web/src/services/api/models/ParamIntInvocation.ts index 7a45d0a0ac..f47c3b8f01 100644 --- a/invokeai/frontend/web/src/services/api/models/ParamIntInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ParamIntInvocation.ts @@ -20,4 +20,3 @@ export type ParamIntInvocation = { */ 'a'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/PidiImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/PidiImageProcessorInvocation.ts index 91c9dc0ce5..96433218f7 100644 --- a/invokeai/frontend/web/src/services/api/models/PidiImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/PidiImageProcessorInvocation.ts @@ -38,4 +38,3 @@ export type PidiImageProcessorInvocation = { */ scribble?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/PromptOutput.ts b/invokeai/frontend/web/src/services/api/models/PromptOutput.ts index 5bca3f3037..f9dcfd1b08 100644 --- a/invokeai/frontend/web/src/services/api/models/PromptOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/PromptOutput.ts @@ -12,4 +12,3 @@ export type PromptOutput = { */ prompt: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/RandomIntInvocation.ts b/invokeai/frontend/web/src/services/api/models/RandomIntInvocation.ts index a2f7c2f02a..c4fa84cc8e 100644 --- a/invokeai/frontend/web/src/services/api/models/RandomIntInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/RandomIntInvocation.ts @@ -24,4 +24,3 @@ export type RandomIntInvocation = { */ high?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/RandomRangeInvocation.ts b/invokeai/frontend/web/src/services/api/models/RandomRangeInvocation.ts index 925511578d..5625324a1e 100644 --- a/invokeai/frontend/web/src/services/api/models/RandomRangeInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/RandomRangeInvocation.ts @@ -32,4 +32,3 @@ export type RandomRangeInvocation = { */ seed?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/RangeInvocation.ts b/invokeai/frontend/web/src/services/api/models/RangeInvocation.ts index 3681602a95..5292d32156 100644 --- a/invokeai/frontend/web/src/services/api/models/RangeInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/RangeInvocation.ts @@ -28,4 +28,3 @@ export type RangeInvocation = { */ step?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/RangeOfSizeInvocation.ts b/invokeai/frontend/web/src/services/api/models/RangeOfSizeInvocation.ts index 7dfac68d39..d97826099a 100644 --- a/invokeai/frontend/web/src/services/api/models/RangeOfSizeInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/RangeOfSizeInvocation.ts @@ -28,4 +28,3 @@ export type RangeOfSizeInvocation = { */ step?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ResizeLatentsInvocation.ts b/invokeai/frontend/web/src/services/api/models/ResizeLatentsInvocation.ts index 9a7b6c61e4..500514f3c9 100644 --- a/invokeai/frontend/web/src/services/api/models/ResizeLatentsInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ResizeLatentsInvocation.ts @@ -38,4 +38,3 @@ export type ResizeLatentsInvocation = { */ antialias?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts b/invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts index 0bacb5d805..5cfc165e23 100644 --- a/invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts @@ -26,4 +26,3 @@ export type RestoreFaceInvocation = { */ strength?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ScaleLatentsInvocation.ts b/invokeai/frontend/web/src/services/api/models/ScaleLatentsInvocation.ts index 506b21e540..a65308dcba 100644 --- a/invokeai/frontend/web/src/services/api/models/ScaleLatentsInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ScaleLatentsInvocation.ts @@ -34,4 +34,3 @@ export type ScaleLatentsInvocation = { */ antialias?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts index 1b73055584..c6bceda651 100644 --- a/invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts @@ -22,4 +22,3 @@ export type ShowImageInvocation = { */ image?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts b/invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts new file mode 100644 index 0000000000..dca4fa8e82 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts @@ -0,0 +1,58 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Experimental per-step parameter easing for denoising steps + */ +export type StepParamEasingInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + /** + * Whether or not this node is an intermediate node. + */ + is_intermediate?: boolean; + type?: 'step_param_easing'; + /** + * The easing function to use + */ + easing?: 'Linear' | 'QuadIn' | 'QuadOut' | 'QuadInOut' | 'CubicIn' | 'CubicOut' | 'CubicInOut' | 'QuarticIn' | 'QuarticOut' | 'QuarticInOut' | 'QuinticIn' | 'QuinticOut' | 'QuinticInOut' | 'SineIn' | 'SineOut' | 'SineInOut' | 'CircularIn' | 'CircularOut' | 'CircularInOut' | 'ExponentialIn' | 'ExponentialOut' | 'ExponentialInOut' | 'ElasticIn' | 'ElasticOut' | 'ElasticInOut' | 'BackIn' | 'BackOut' | 'BackInOut' | 'BounceIn' | 'BounceOut' | 'BounceInOut'; + /** + * number of denoising steps + */ + num_steps?: number; + /** + * easing starting value + */ + start_value?: number; + /** + * easing ending value + */ + end_value?: number; + /** + * fraction of steps at which to start easing + */ + start_step_percent?: number; + /** + * fraction of steps after which to end easing + */ + end_step_percent?: number; + /** + * value before easing start + */ + pre_start_value?: number; + /** + * value after easing end + */ + post_end_value?: number; + /** + * include mirror of easing function + */ + mirror?: boolean; + /** + * show easing plot + */ + show_easing_plot?: boolean; +}; diff --git a/invokeai/frontend/web/src/services/api/models/SubtractInvocation.ts b/invokeai/frontend/web/src/services/api/models/SubtractInvocation.ts index 23334bd891..a1b8ca5628 100644 --- a/invokeai/frontend/web/src/services/api/models/SubtractInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/SubtractInvocation.ts @@ -24,4 +24,3 @@ export type SubtractInvocation = { */ 'b'?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts index 7128ea8440..26d6117573 100644 --- a/invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts @@ -62,4 +62,3 @@ export type TextToImageInvocation = { */ control_image?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts b/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts index f1831b2b59..27ef54f3ea 100644 --- a/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts @@ -38,7 +38,7 @@ export type TextToLatentsInvocation = { /** * The Classifier-Free Guidance, higher values may result in a result closer to the prompt */ - cfg_scale?: number; + cfg_scale?: (number | Array); /** * The scheduler to use */ @@ -52,4 +52,3 @@ export type TextToLatentsInvocation = { */ control?: (ControlField | Array); }; - diff --git a/invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts b/invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts index d0aca63964..3b42906e39 100644 --- a/invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts @@ -30,4 +30,3 @@ export type UpscaleInvocation = { */ level?: 2 | 4; }; - diff --git a/invokeai/frontend/web/src/services/api/models/VaeRepo.ts b/invokeai/frontend/web/src/services/api/models/VaeRepo.ts index 0e233626c6..cb6e33c199 100644 --- a/invokeai/frontend/web/src/services/api/models/VaeRepo.ts +++ b/invokeai/frontend/web/src/services/api/models/VaeRepo.ts @@ -16,4 +16,3 @@ export type VaeRepo = { */ subfolder?: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ValidationError.ts b/invokeai/frontend/web/src/services/api/models/ValidationError.ts index 14e1fdecd0..92697e1d74 100644 --- a/invokeai/frontend/web/src/services/api/models/ValidationError.ts +++ b/invokeai/frontend/web/src/services/api/models/ValidationError.ts @@ -7,4 +7,3 @@ export type ValidationError = { msg: string; type: string; }; - diff --git a/invokeai/frontend/web/src/services/api/models/ZoeDepthImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/models/ZoeDepthImageProcessorInvocation.ts index 6caded8f04..0dbc99c9e3 100644 --- a/invokeai/frontend/web/src/services/api/models/ZoeDepthImageProcessorInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/ZoeDepthImageProcessorInvocation.ts @@ -22,4 +22,3 @@ export type ZoeDepthImageProcessorInvocation = { */ image?: ImageField; }; - diff --git a/invokeai/frontend/web/src/services/api/services/ImagesService.ts b/invokeai/frontend/web/src/services/api/services/ImagesService.ts index 51fe6c820f..4c08fa5e06 100644 --- a/invokeai/frontend/web/src/services/api/services/ImagesService.ts +++ b/invokeai/frontend/web/src/services/api/services/ImagesService.ts @@ -22,33 +22,33 @@ export class ImagesService { * @throws ApiError */ public static listImagesWithMetadata({ - imageOrigin, - categories, - isIntermediate, - offset, - limit = 10, - }: { - /** - * The origin of images to list - */ - imageOrigin?: ResourceOrigin, - /** - * The categories of image to include - */ - categories?: Array, - /** - * Whether to list intermediate images - */ - isIntermediate?: boolean, - /** - * The page offset - */ - offset?: number, - /** - * The number of images per page - */ - limit?: number, - }): CancelablePromise { +imageOrigin, +categories, +isIntermediate, +offset, +limit = 10, +}: { +/** + * The origin of images to list + */ +imageOrigin?: ResourceOrigin, +/** + * The categories of image to include + */ +categories?: Array, +/** + * Whether to list intermediate images + */ +isIntermediate?: boolean, +/** + * The page offset + */ +offset?: number, +/** + * The number of images per page + */ +limit?: number, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/', @@ -72,25 +72,25 @@ export class ImagesService { * @throws ApiError */ public static uploadImage({ - imageCategory, - isIntermediate, - formData, - sessionId, - }: { - /** - * The category of the image - */ - imageCategory: ImageCategory, - /** - * Whether this is an intermediate image - */ - isIntermediate: boolean, - formData: Body_upload_image, - /** - * The session ID associated with this upload, if any - */ - sessionId?: string, - }): CancelablePromise { +imageCategory, +isIntermediate, +formData, +sessionId, +}: { +/** + * The category of the image + */ +imageCategory: ImageCategory, +/** + * Whether this is an intermediate image + */ +isIntermediate: boolean, +formData: Body_upload_image, +/** + * The session ID associated with this upload, if any + */ +sessionId?: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/images/', @@ -115,18 +115,18 @@ export class ImagesService { * @throws ApiError */ public static getImageFull({ - imageOrigin, - imageName, - }: { - /** - * The type of full-resolution image file to get - */ - imageOrigin: ResourceOrigin, - /** - * The name of full-resolution image file to get - */ - imageName: string, - }): CancelablePromise { +imageOrigin, +imageName, +}: { +/** + * The type of full-resolution image file to get + */ +imageOrigin: ResourceOrigin, +/** + * The name of full-resolution image file to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_origin}/{image_name}', @@ -148,18 +148,18 @@ export class ImagesService { * @throws ApiError */ public static deleteImage({ - imageOrigin, - imageName, - }: { - /** - * The origin of image to delete - */ - imageOrigin: ResourceOrigin, - /** - * The name of the image to delete - */ - imageName: string, - }): CancelablePromise { +imageOrigin, +imageName, +}: { +/** + * The origin of image to delete + */ +imageOrigin: ResourceOrigin, +/** + * The name of the image to delete + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/images/{image_origin}/{image_name}', @@ -180,20 +180,20 @@ export class ImagesService { * @throws ApiError */ public static updateImage({ - imageOrigin, - imageName, - requestBody, - }: { - /** - * The origin of image to update - */ - imageOrigin: ResourceOrigin, - /** - * The name of the image to update - */ - imageName: string, - requestBody: ImageRecordChanges, - }): CancelablePromise { +imageOrigin, +imageName, +requestBody, +}: { +/** + * The origin of image to update + */ +imageOrigin: ResourceOrigin, +/** + * The name of the image to update + */ +imageName: string, +requestBody: ImageRecordChanges, +}): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/v1/images/{image_origin}/{image_name}', @@ -216,18 +216,18 @@ export class ImagesService { * @throws ApiError */ public static getImageMetadata({ - imageOrigin, - imageName, - }: { - /** - * The origin of image to get - */ - imageOrigin: ResourceOrigin, - /** - * The name of image to get - */ - imageName: string, - }): CancelablePromise { +imageOrigin, +imageName, +}: { +/** + * The origin of image to get + */ +imageOrigin: ResourceOrigin, +/** + * The name of image to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_origin}/{image_name}/metadata', @@ -248,18 +248,18 @@ export class ImagesService { * @throws ApiError */ public static getImageThumbnail({ - imageOrigin, - imageName, - }: { - /** - * The origin of thumbnail image file to get - */ - imageOrigin: ResourceOrigin, - /** - * The name of thumbnail image file to get - */ - imageName: string, - }): CancelablePromise { +imageOrigin, +imageName, +}: { +/** + * The origin of thumbnail image file to get + */ +imageOrigin: ResourceOrigin, +/** + * The name of thumbnail image file to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_origin}/{image_name}/thumbnail', @@ -281,18 +281,18 @@ export class ImagesService { * @throws ApiError */ public static getImageUrls({ - imageOrigin, - imageName, - }: { - /** - * The origin of the image whose URL to get - */ - imageOrigin: ResourceOrigin, - /** - * The name of the image whose URL to get - */ - imageName: string, - }): CancelablePromise { +imageOrigin, +imageName, +}: { +/** + * The origin of the image whose URL to get + */ +imageOrigin: ResourceOrigin, +/** + * The name of the image whose URL to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_origin}/{image_name}/urls', diff --git a/invokeai/frontend/web/src/services/api/services/ModelsService.ts b/invokeai/frontend/web/src/services/api/services/ModelsService.ts index 3f8ae6bf7b..626387dce6 100644 --- a/invokeai/frontend/web/src/services/api/services/ModelsService.ts +++ b/invokeai/frontend/web/src/services/api/services/ModelsService.ts @@ -30,10 +30,10 @@ export class ModelsService { * @throws ApiError */ public static updateModel({ - requestBody, - }: { - requestBody: CreateModelRequest, - }): CancelablePromise { +requestBody, +}: { +requestBody: CreateModelRequest, +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/models/', @@ -52,10 +52,10 @@ export class ModelsService { * @throws ApiError */ public static delModel({ - modelName, - }: { - modelName: string, - }): CancelablePromise { +modelName, +}: { +modelName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/models/{model_name}', diff --git a/invokeai/frontend/web/src/services/api/services/SessionsService.ts b/invokeai/frontend/web/src/services/api/services/SessionsService.ts index 977c03e6fb..12ceeace92 100644 --- a/invokeai/frontend/web/src/services/api/services/SessionsService.ts +++ b/invokeai/frontend/web/src/services/api/services/SessionsService.ts @@ -10,6 +10,7 @@ import type { ControlNetInvocation } from '../models/ControlNetInvocation'; import type { CvInpaintInvocation } from '../models/CvInpaintInvocation'; import type { DivideInvocation } from '../models/DivideInvocation'; import type { Edge } from '../models/Edge'; +import type { FloatLinearRangeInvocation } from '../models/FloatLinearRangeInvocation'; import type { Graph } from '../models/Graph'; import type { GraphExecutionState } from '../models/GraphExecutionState'; import type { GraphInvocation } from '../models/GraphInvocation'; @@ -57,6 +58,7 @@ import type { ResizeLatentsInvocation } from '../models/ResizeLatentsInvocation' import type { RestoreFaceInvocation } from '../models/RestoreFaceInvocation'; import type { ScaleLatentsInvocation } from '../models/ScaleLatentsInvocation'; import type { ShowImageInvocation } from '../models/ShowImageInvocation'; +import type { StepParamEasingInvocation } from '../models/StepParamEasingInvocation'; import type { SubtractInvocation } from '../models/SubtractInvocation'; import type { TextToImageInvocation } from '../models/TextToImageInvocation'; import type { TextToLatentsInvocation } from '../models/TextToLatentsInvocation'; @@ -76,23 +78,23 @@ export class SessionsService { * @throws ApiError */ public static listSessions({ - page, - perPage = 10, - query = '', - }: { - /** - * The page of results to get - */ - page?: number, - /** - * The number of results per page - */ - perPage?: number, - /** - * The query string to search for - */ - query?: string, - }): CancelablePromise { +page, +perPage = 10, +query = '', +}: { +/** + * The page of results to get + */ +page?: number, +/** + * The number of results per page + */ +perPage?: number, +/** + * The query string to search for + */ +query?: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/sessions/', @@ -114,10 +116,10 @@ export class SessionsService { * @throws ApiError */ public static createSession({ - requestBody, - }: { - requestBody?: Graph, - }): CancelablePromise { +requestBody, +}: { +requestBody?: Graph, +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/sessions/', @@ -137,13 +139,13 @@ export class SessionsService { * @throws ApiError */ public static getSession({ - sessionId, - }: { - /** - * The id of the session to get - */ - sessionId: string, - }): CancelablePromise { +sessionId, +}: { +/** + * The id of the session to get + */ +sessionId: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/sessions/{session_id}', @@ -164,15 +166,15 @@ export class SessionsService { * @throws ApiError */ public static addNode({ - sessionId, - requestBody, - }: { - /** - * The id of the session - */ - sessionId: string, - requestBody: (LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | CompelInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | CvInpaintInvocation | RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation), - }): CancelablePromise { +sessionId, +requestBody, +}: { +/** + * The id of the session + */ +sessionId: string, +requestBody: (RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | CompelInvocation | LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | CvInpaintInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | FloatLinearRangeInvocation | StepParamEasingInvocation | RestoreFaceInvocation | UpscaleInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | ImageToImageInvocation | LatentsToLatentsInvocation | InpaintInvocation), +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/sessions/{session_id}/nodes', @@ -196,20 +198,20 @@ export class SessionsService { * @throws ApiError */ public static updateNode({ - sessionId, - nodePath, - requestBody, - }: { - /** - * The id of the session - */ - sessionId: string, - /** - * The path to the node in the graph - */ - nodePath: string, - requestBody: (LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | CompelInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | CvInpaintInvocation | RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation), - }): CancelablePromise { +sessionId, +nodePath, +requestBody, +}: { +/** + * The id of the session + */ +sessionId: string, +/** + * The path to the node in the graph + */ +nodePath: string, +requestBody: (RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | CompelInvocation | LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | CvInpaintInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | FloatLinearRangeInvocation | StepParamEasingInvocation | RestoreFaceInvocation | UpscaleInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | ImageToImageInvocation | LatentsToLatentsInvocation | InpaintInvocation), +}): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v1/sessions/{session_id}/nodes/{node_path}', @@ -234,18 +236,18 @@ export class SessionsService { * @throws ApiError */ public static deleteNode({ - sessionId, - nodePath, - }: { - /** - * The id of the session - */ - sessionId: string, - /** - * The path to the node to delete - */ - nodePath: string, - }): CancelablePromise { +sessionId, +nodePath, +}: { +/** + * The id of the session + */ +sessionId: string, +/** + * The path to the node to delete + */ +nodePath: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/sessions/{session_id}/nodes/{node_path}', @@ -268,15 +270,15 @@ export class SessionsService { * @throws ApiError */ public static addEdge({ - sessionId, - requestBody, - }: { - /** - * The id of the session - */ - sessionId: string, - requestBody: Edge, - }): CancelablePromise { +sessionId, +requestBody, +}: { +/** + * The id of the session + */ +sessionId: string, +requestBody: Edge, +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/sessions/{session_id}/edges', @@ -300,33 +302,33 @@ export class SessionsService { * @throws ApiError */ public static deleteEdge({ - sessionId, - fromNodeId, - fromField, - toNodeId, - toField, - }: { - /** - * The id of the session - */ - sessionId: string, - /** - * The id of the node the edge is coming from - */ - fromNodeId: string, - /** - * The field of the node the edge is coming from - */ - fromField: string, - /** - * The id of the node the edge is going to - */ - toNodeId: string, - /** - * The field of the node the edge is going to - */ - toField: string, - }): CancelablePromise { +sessionId, +fromNodeId, +fromField, +toNodeId, +toField, +}: { +/** + * The id of the session + */ +sessionId: string, +/** + * The id of the node the edge is coming from + */ +fromNodeId: string, +/** + * The field of the node the edge is coming from + */ +fromField: string, +/** + * The id of the node the edge is going to + */ +toNodeId: string, +/** + * The field of the node the edge is going to + */ +toField: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/sessions/{session_id}/edges/{from_node_id}/{from_field}/{to_node_id}/{to_field}', @@ -352,18 +354,18 @@ export class SessionsService { * @throws ApiError */ public static invokeSession({ - sessionId, - all = false, - }: { - /** - * The id of the session to invoke - */ - sessionId: string, - /** - * Whether or not to invoke all remaining invocations - */ - all?: boolean, - }): CancelablePromise { +sessionId, +all = false, +}: { +/** + * The id of the session to invoke + */ +sessionId: string, +/** + * Whether or not to invoke all remaining invocations + */ +all?: boolean, +}): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v1/sessions/{session_id}/invoke', @@ -388,13 +390,13 @@ export class SessionsService { * @throws ApiError */ public static cancelSessionInvoke({ - sessionId, - }: { - /** - * The id of the session to cancel - */ - sessionId: string, - }): CancelablePromise { +sessionId, +}: { +/** + * The id of the session to cancel + */ +sessionId: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/sessions/{session_id}/invoke', From 6c53abc034131055f22f2551546378345f8e77ca Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed, 14 Jun 2023 20:01:17 +1200 Subject: [PATCH 09/13] feat: Add ControlMode to Linear UI --- invokeai/frontend/web/public/locales/en.json | 3 +- .../controlNet/components/ControlNet.tsx | 96 ++++++++++--------- .../parameters/ParamControlNetControlMode.tsx | 45 +++++++++ .../features/controlNet/store/constants.ts | 12 ++- .../controlNet/store/controlNetSlice.ts | 88 ++++++++++------- .../nodes/util/addControlNetToLinearGraph.ts | 2 + 6 files changed, 163 insertions(+), 83 deletions(-) create mode 100644 invokeai/frontend/web/src/features/controlNet/components/parameters/ParamControlNetControlMode.tsx diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index 7a73bae411..fbd41e877d 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -524,7 +524,8 @@ "initialImage": "Initial Image", "showOptionsPanel": "Show Options Panel", "hidePreview": "Hide Preview", - "showPreview": "Show Preview" + "showPreview": "Show Preview", + "controlNetControlMode": "Control Mode" }, "settings": { "models": "Models", diff --git a/invokeai/frontend/web/src/features/controlNet/components/ControlNet.tsx b/invokeai/frontend/web/src/features/controlNet/components/ControlNet.tsx index 927daa9dc0..17cd5693e8 100644 --- a/invokeai/frontend/web/src/features/controlNet/components/ControlNet.tsx +++ b/invokeai/frontend/web/src/features/controlNet/components/ControlNet.tsx @@ -1,26 +1,27 @@ +import { Box, ChakraProps, Flex } from '@chakra-ui/react'; +import { useAppDispatch } from 'app/store/storeHooks'; import { memo, useCallback } from 'react'; +import { FaCopy, FaTrash } from 'react-icons/fa'; import { ControlNetConfig, controlNetAdded, controlNetRemoved, controlNetToggled, } from '../store/controlNetSlice'; -import { useAppDispatch } from 'app/store/storeHooks'; import ParamControlNetModel from './parameters/ParamControlNetModel'; import ParamControlNetWeight from './parameters/ParamControlNetWeight'; -import { Flex, Box, ChakraProps } from '@chakra-ui/react'; -import { FaCopy, FaTrash } from 'react-icons/fa'; -import ParamControlNetBeginEnd from './parameters/ParamControlNetBeginEnd'; -import ControlNetImagePreview from './ControlNetImagePreview'; -import IAIIconButton from 'common/components/IAIIconButton'; -import { v4 as uuidv4 } from 'uuid'; -import { useToggle } from 'react-use'; -import ParamControlNetProcessorSelect from './parameters/ParamControlNetProcessorSelect'; -import ControlNetProcessorComponent from './ControlNetProcessorComponent'; -import IAISwitch from 'common/components/IAISwitch'; import { ChevronUpIcon } from '@chakra-ui/icons'; +import IAIIconButton from 'common/components/IAIIconButton'; +import IAISwitch from 'common/components/IAISwitch'; +import { useToggle } from 'react-use'; +import { v4 as uuidv4 } from 'uuid'; +import ControlNetImagePreview from './ControlNetImagePreview'; +import ControlNetProcessorComponent from './ControlNetProcessorComponent'; import ParamControlNetShouldAutoConfig from './ParamControlNetShouldAutoConfig'; +import ParamControlNetBeginEnd from './parameters/ParamControlNetBeginEnd'; +import ParamControlNetControlMode from './parameters/ParamControlNetControlMode'; +import ParamControlNetProcessorSelect from './parameters/ParamControlNetProcessorSelect'; const expandedControlImageSx: ChakraProps['sx'] = { maxH: 96 }; @@ -36,6 +37,7 @@ const ControlNet = (props: ControlNetProps) => { weight, beginStepPct, endStepPct, + controlMode, controlImage, processedControlImage, processorNode, @@ -137,45 +139,51 @@ const ControlNet = (props: ControlNetProps) => { {isEnabled && ( <> - - - - - - {!isExpanded && ( + + - + + - )} + {!isExpanded && ( + + + + )} + + + {isExpanded && ( <> diff --git a/invokeai/frontend/web/src/features/controlNet/components/parameters/ParamControlNetControlMode.tsx b/invokeai/frontend/web/src/features/controlNet/components/parameters/ParamControlNetControlMode.tsx new file mode 100644 index 0000000000..b8737004fd --- /dev/null +++ b/invokeai/frontend/web/src/features/controlNet/components/parameters/ParamControlNetControlMode.tsx @@ -0,0 +1,45 @@ +import { useAppDispatch } from 'app/store/storeHooks'; +import IAIMantineSelect from 'common/components/IAIMantineSelect'; +import { + ControlModes, + controlNetControlModeChanged, +} from 'features/controlNet/store/controlNetSlice'; +import { useCallback } from 'react'; +import { useTranslation } from 'react-i18next'; + +type ParamControlNetControlModeProps = { + controlNetId: string; + controlMode: string; +}; + +const CONTROL_MODE_DATA = [ + { label: 'Balanced', value: 'balanced' }, + { label: 'Prompt', value: 'more_prompt' }, + { label: 'Control', value: 'more_control' }, + { label: 'Mega Control', value: 'unbalanced' }, +]; + +export default function ParamControlNetControlMode( + props: ParamControlNetControlModeProps +) { + const { controlNetId, controlMode = false } = props; + const dispatch = useAppDispatch(); + + const { t } = useTranslation(); + + const handleControlModeChange = useCallback( + (controlMode: ControlModes) => { + dispatch(controlNetControlModeChanged({ controlNetId, controlMode })); + }, + [controlNetId, dispatch] + ); + + return ( + + ); +} diff --git a/invokeai/frontend/web/src/features/controlNet/store/constants.ts b/invokeai/frontend/web/src/features/controlNet/store/constants.ts index 7df0fda8e6..df6ee653dc 100644 --- a/invokeai/frontend/web/src/features/controlNet/store/constants.ts +++ b/invokeai/frontend/web/src/features/controlNet/store/constants.ts @@ -1,6 +1,5 @@ import { ControlNetProcessorType, - RequiredCannyImageProcessorInvocation, RequiredControlNetProcessorNode, } from './types'; @@ -23,7 +22,7 @@ type ControlNetProcessorsDict = Record< * * TODO: Generate from the OpenAPI schema */ -export const CONTROLNET_PROCESSORS = { +export const CONTROLNET_PROCESSORS: ControlNetProcessorsDict = { none: { type: 'none', label: 'none', @@ -174,6 +173,8 @@ export const CONTROLNET_PROCESSORS = { }, }; +type ControlNetModelsDict = Record; + type ControlNetModel = { type: string; label: string; @@ -181,7 +182,7 @@ type ControlNetModel = { defaultProcessor?: ControlNetProcessorType; }; -export const CONTROLNET_MODELS = { +export const CONTROLNET_MODELS: ControlNetModelsDict = { 'lllyasviel/control_v11p_sd15_canny': { type: 'lllyasviel/control_v11p_sd15_canny', label: 'Canny', @@ -190,6 +191,7 @@ export const CONTROLNET_MODELS = { 'lllyasviel/control_v11p_sd15_inpaint': { type: 'lllyasviel/control_v11p_sd15_inpaint', label: 'Inpaint', + defaultProcessor: 'none', }, 'lllyasviel/control_v11p_sd15_mlsd': { type: 'lllyasviel/control_v11p_sd15_mlsd', @@ -209,6 +211,7 @@ export const CONTROLNET_MODELS = { 'lllyasviel/control_v11p_sd15_seg': { type: 'lllyasviel/control_v11p_sd15_seg', label: 'Segmentation', + defaultProcessor: 'none', }, 'lllyasviel/control_v11p_sd15_lineart': { type: 'lllyasviel/control_v11p_sd15_lineart', @@ -223,6 +226,7 @@ export const CONTROLNET_MODELS = { 'lllyasviel/control_v11p_sd15_scribble': { type: 'lllyasviel/control_v11p_sd15_scribble', label: 'Scribble', + defaultProcessor: 'none', }, 'lllyasviel/control_v11p_sd15_softedge': { type: 'lllyasviel/control_v11p_sd15_softedge', @@ -242,10 +246,12 @@ export const CONTROLNET_MODELS = { 'lllyasviel/control_v11f1e_sd15_tile': { type: 'lllyasviel/control_v11f1e_sd15_tile', label: 'Tile (experimental)', + defaultProcessor: 'none', }, 'lllyasviel/control_v11e_sd15_ip2p': { type: 'lllyasviel/control_v11e_sd15_ip2p', label: 'Pix2Pix (experimental)', + defaultProcessor: 'none', }, 'CrucibleAI/ControlNetMediaPipeFace': { type: 'CrucibleAI/ControlNetMediaPipeFace', diff --git a/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts b/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts index d71ff4da68..a90c69028b 100644 --- a/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts +++ b/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts @@ -1,36 +1,27 @@ -import { PayloadAction } from '@reduxjs/toolkit'; -import { createSlice } from '@reduxjs/toolkit'; +import { PayloadAction, createSlice } from '@reduxjs/toolkit'; import { RootState } from 'app/store/store'; +import { forEach } from 'lodash-es'; import { ImageDTO } from 'services/api'; -import { - ControlNetProcessorType, - RequiredCannyImageProcessorInvocation, - RequiredControlNetProcessorNode, -} from './types'; +import { appSocketInvocationError } from 'services/events/actions'; +import { imageDeleted, imageUrlsReceived } from 'services/thunks/image'; +import { isAnySessionRejected } from 'services/thunks/session'; +import { controlNetImageProcessed } from './actions'; import { CONTROLNET_MODELS, CONTROLNET_PROCESSORS, ControlNetModelName, } from './constants'; -import { controlNetImageProcessed } from './actions'; -import { imageDeleted, imageUrlsReceived } from 'services/thunks/image'; -import { forEach } from 'lodash-es'; -import { isAnySessionRejected } from 'services/thunks/session'; -import { appSocketInvocationError } from 'services/events/actions'; +import { + ControlNetProcessorType, + RequiredCannyImageProcessorInvocation, + RequiredControlNetProcessorNode, +} from './types'; -export const initialControlNet: Omit = { - isEnabled: true, - model: CONTROLNET_MODELS['lllyasviel/control_v11p_sd15_canny'].type, - weight: 1, - beginStepPct: 0, - endStepPct: 1, - controlImage: null, - processedControlImage: null, - processorType: 'canny_image_processor', - processorNode: CONTROLNET_PROCESSORS.canny_image_processor - .default as RequiredCannyImageProcessorInvocation, - shouldAutoConfig: true, -}; +export type ControlModes = + | 'balanced' + | 'more_prompt' + | 'more_control' + | 'unbalanced'; export type ControlNetConfig = { controlNetId: string; @@ -39,6 +30,7 @@ export type ControlNetConfig = { weight: number; beginStepPct: number; endStepPct: number; + controlMode: ControlModes; controlImage: ImageDTO | null; processedControlImage: ImageDTO | null; processorType: ControlNetProcessorType; @@ -46,6 +38,21 @@ export type ControlNetConfig = { shouldAutoConfig: boolean; }; +export const initialControlNet: Omit = { + isEnabled: true, + model: CONTROLNET_MODELS['lllyasviel/control_v11p_sd15_canny'].type, + weight: 1, + beginStepPct: 0, + endStepPct: 1, + controlMode: 'balanced', + controlImage: null, + processedControlImage: null, + processorType: 'canny_image_processor', + processorNode: CONTROLNET_PROCESSORS.canny_image_processor + .default as RequiredCannyImageProcessorInvocation, + shouldAutoConfig: true, +}; + export type ControlNetState = { controlNets: Record; isEnabled: boolean; @@ -147,11 +154,13 @@ export const controlNetSlice = createSlice({ state.controlNets[controlNetId].processedControlImage = null; if (state.controlNets[controlNetId].shouldAutoConfig) { - const processorType = CONTROLNET_MODELS[model].defaultProcessor; + const processorType = + CONTROLNET_MODELS[model as keyof typeof CONTROLNET_MODELS] + .defaultProcessor; if (processorType) { state.controlNets[controlNetId].processorType = processorType; state.controlNets[controlNetId].processorNode = CONTROLNET_PROCESSORS[ - processorType + processorType as keyof typeof CONTROLNET_PROCESSORS ].default as RequiredControlNetProcessorNode; } else { state.controlNets[controlNetId].processorType = 'none'; @@ -181,6 +190,13 @@ export const controlNetSlice = createSlice({ const { controlNetId, endStepPct } = action.payload; state.controlNets[controlNetId].endStepPct = endStepPct; }, + controlNetControlModeChanged: ( + state, + action: PayloadAction<{ controlNetId: string; controlMode: ControlModes }> + ) => { + const { controlNetId, controlMode } = action.payload; + state.controlNets[controlNetId].controlMode = controlMode; + }, controlNetProcessorParamsChanged: ( state, action: PayloadAction<{ @@ -210,7 +226,7 @@ export const controlNetSlice = createSlice({ state.controlNets[controlNetId].processedControlImage = null; state.controlNets[controlNetId].processorType = processorType; state.controlNets[controlNetId].processorNode = CONTROLNET_PROCESSORS[ - processorType + processorType as keyof typeof CONTROLNET_PROCESSORS ].default as RequiredControlNetProcessorNode; state.controlNets[controlNetId].shouldAutoConfig = false; }, @@ -227,12 +243,14 @@ export const controlNetSlice = createSlice({ if (newShouldAutoConfig) { // manage the processor for the user const processorType = - CONTROLNET_MODELS[state.controlNets[controlNetId].model] - .defaultProcessor; + CONTROLNET_MODELS[ + state.controlNets[controlNetId] + .model as keyof typeof CONTROLNET_MODELS + ].defaultProcessor; if (processorType) { state.controlNets[controlNetId].processorType = processorType; state.controlNets[controlNetId].processorNode = CONTROLNET_PROCESSORS[ - processorType + processorType as keyof typeof CONTROLNET_PROCESSORS ].default as RequiredControlNetProcessorNode; } else { state.controlNets[controlNetId].processorType = 'none'; @@ -271,8 +289,7 @@ export const controlNetSlice = createSlice({ }); builder.addCase(imageUrlsReceived.fulfilled, (state, action) => { - const { image_name, image_origin, image_url, thumbnail_url } = - action.payload; + const { image_name, image_url, thumbnail_url } = action.payload; forEach(state.controlNets, (c) => { if (c.controlImage?.image_name === image_name) { @@ -286,11 +303,11 @@ export const controlNetSlice = createSlice({ }); }); - builder.addCase(appSocketInvocationError, (state, action) => { + builder.addCase(appSocketInvocationError, (state) => { state.pendingControlImages = []; }); - builder.addMatcher(isAnySessionRejected, (state, action) => { + builder.addMatcher(isAnySessionRejected, (state) => { state.pendingControlImages = []; }); }, @@ -308,6 +325,7 @@ export const { controlNetWeightChanged, controlNetBeginStepPctChanged, controlNetEndStepPctChanged, + controlNetControlModeChanged, controlNetProcessorParamsChanged, controlNetProcessorTypeChanged, controlNetReset, diff --git a/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts index 9aab13784f..a488961b71 100644 --- a/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts @@ -45,6 +45,7 @@ export const addControlNetToLinearGraph = ( processedControlImage, beginStepPct, endStepPct, + controlMode, model, processorType, weight, @@ -60,6 +61,7 @@ export const addControlNetToLinearGraph = ( type: 'controlnet', begin_step_percent: beginStepPct, end_step_percent: endStepPct, + control_mode: controlMode, control_model: model as ControlNetInvocation['control_model'], control_weight: weight, }; From 4ca325e8e6daae1b7203e27a8f3a903581789ce8 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu, 15 Jun 2023 03:20:49 +1200 Subject: [PATCH 10/13] chore: Rebuild API --- .../api/models/DynamicPromptInvocation.ts | 1 - .../api/models/FloatLinearRangeInvocation.ts | 1 - .../web/src/services/api/models/Graph.ts | 3 +- .../api/models/GraphExecutionState.ts | 3 +- .../api/models/PromptCollectionOutput.ts | 1 - .../api/models/StepParamEasingInvocation.ts | 1 - .../schemas/$CannyImageProcessorInvocation.ts | 31 --- ...$ContentShuffleImageProcessorInvocation.ts | 43 ---- .../src/services/api/schemas/$ControlField.ts | 37 --- .../api/schemas/$ControlNetInvocation.ts | 41 --- .../services/api/schemas/$ControlOutput.ts | 28 --- .../schemas/$HedImageprocessorInvocation.ts | 35 --- .../api/schemas/$ImageProcessorInvocation.ts | 23 -- .../$LineartAnimeImageProcessorInvocation.ts | 31 --- .../$LineartImageProcessorInvocation.ts | 35 --- .../$MidasDepthImageProcessorInvocation.ts | 31 --- .../schemas/$MlsdImageProcessorInvocation.ts | 39 --- .../$NormalbaeImageProcessorInvocation.ts | 31 --- .../$OpenposeImageProcessorInvocation.ts | 35 --- .../schemas/$PidiImageProcessorInvocation.ts | 39 --- .../api/schemas/$RandomIntInvocation.ts | 16 -- .../services/api/services/ImagesService.ts | 180 ++++++------- .../services/api/services/SessionsService.ts | 236 +++++++++--------- 23 files changed, 210 insertions(+), 711 deletions(-) delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$CannyImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$ContentShuffleImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$ControlField.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$ControlNetInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$ControlOutput.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$HedImageprocessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$ImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$LineartAnimeImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$LineartImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$MidasDepthImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$MlsdImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$NormalbaeImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$OpenposeImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$PidiImageProcessorInvocation.ts delete mode 100644 invokeai/frontend/web/src/services/api/schemas/$RandomIntInvocation.ts diff --git a/invokeai/frontend/web/src/services/api/models/DynamicPromptInvocation.ts b/invokeai/frontend/web/src/services/api/models/DynamicPromptInvocation.ts index f7323a489b..79dc958d0f 100644 --- a/invokeai/frontend/web/src/services/api/models/DynamicPromptInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/DynamicPromptInvocation.ts @@ -28,4 +28,3 @@ export type DynamicPromptInvocation = { */ combinatorial?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts b/invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts index e0fd4a1caa..a9e67d8135 100644 --- a/invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/FloatLinearRangeInvocation.ts @@ -28,4 +28,3 @@ export type FloatLinearRangeInvocation = { */ steps?: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/Graph.ts b/invokeai/frontend/web/src/services/api/models/Graph.ts index efac5dabcc..9de1cd280c 100644 --- a/invokeai/frontend/web/src/services/api/models/Graph.ts +++ b/invokeai/frontend/web/src/services/api/models/Graph.ts @@ -72,10 +72,9 @@ export type Graph = { /** * The nodes in this graph */ - nodes?: Record; + nodes?: Record; /** * The connections between nodes and their fields in this graph */ edges?: Array; }; - diff --git a/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts b/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts index ccd5d6f499..75e43d10b7 100644 --- a/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts +++ b/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts @@ -46,7 +46,7 @@ export type GraphExecutionState = { /** * The results of node executions */ - results: Record; + results: Record; /** * Errors raised when executing nodes */ @@ -60,4 +60,3 @@ export type GraphExecutionState = { */ source_prepared_mapping: Record>; }; - diff --git a/invokeai/frontend/web/src/services/api/models/PromptCollectionOutput.ts b/invokeai/frontend/web/src/services/api/models/PromptCollectionOutput.ts index 4444ab4d33..ffab4ca09a 100644 --- a/invokeai/frontend/web/src/services/api/models/PromptCollectionOutput.ts +++ b/invokeai/frontend/web/src/services/api/models/PromptCollectionOutput.ts @@ -16,4 +16,3 @@ export type PromptCollectionOutput = { */ count: number; }; - diff --git a/invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts b/invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts index 2cff38b3e5..dca4fa8e82 100644 --- a/invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/StepParamEasingInvocation.ts @@ -56,4 +56,3 @@ export type StepParamEasingInvocation = { */ show_easing_plot?: boolean; }; - diff --git a/invokeai/frontend/web/src/services/api/schemas/$CannyImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$CannyImageProcessorInvocation.ts deleted file mode 100644 index e2f1bc2111..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$CannyImageProcessorInvocation.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $CannyImageProcessorInvocation = { - description: `Canny edge detection for ControlNet`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - low_threshold: { - type: 'number', - description: `low threshold of Canny pixel gradient`, - }, - high_threshold: { - type: 'number', - description: `high threshold of Canny pixel gradient`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ContentShuffleImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$ContentShuffleImageProcessorInvocation.ts deleted file mode 100644 index 9c51fdecc0..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$ContentShuffleImageProcessorInvocation.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ContentShuffleImageProcessorInvocation = { - description: `Applies content shuffle processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - 'h': { - type: 'number', - description: `content shuffle h parameter`, - }, - 'w': { - type: 'number', - description: `content shuffle w parameter`, - }, - 'f': { - type: 'number', - description: `cont`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ControlField.ts b/invokeai/frontend/web/src/services/api/schemas/$ControlField.ts deleted file mode 100644 index 81292b8638..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$ControlField.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ControlField = { - properties: { - image: { - type: 'all-of', - description: `processed image`, - contains: [{ - type: 'ImageField', - }], - isRequired: true, - }, - control_model: { - type: 'string', - description: `control model used`, - isRequired: true, - }, - control_weight: { - type: 'number', - description: `weight given to controlnet`, - isRequired: true, - }, - begin_step_percent: { - type: 'number', - description: `% of total steps at which controlnet is first applied`, - isRequired: true, - maximum: 1, - }, - end_step_percent: { - type: 'number', - description: `% of total steps at which controlnet is last applied`, - isRequired: true, - maximum: 1, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ControlNetInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$ControlNetInvocation.ts deleted file mode 100644 index 29ff507e66..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$ControlNetInvocation.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ControlNetInvocation = { - description: `Collects ControlNet info to pass to other nodes`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - control_model: { - type: 'Enum', - }, - control_weight: { - type: 'number', - description: `weight given to controlnet`, - maximum: 1, - }, - begin_step_percent: { - type: 'number', - description: `% of total steps at which controlnet is first applied`, - maximum: 1, - }, - end_step_percent: { - type: 'number', - description: `% of total steps at which controlnet is last applied`, - maximum: 1, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ControlOutput.ts b/invokeai/frontend/web/src/services/api/schemas/$ControlOutput.ts deleted file mode 100644 index d94d633fca..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$ControlOutput.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ControlOutput = { - description: `node output for ControlNet info`, - properties: { - type: { - type: 'Enum', - }, - control: { - type: 'all-of', - description: `The control info dict`, - contains: [{ - type: 'ControlField', - }], - }, - width: { - type: 'number', - description: `The width of the noise in pixels`, - isRequired: true, - }, - height: { - type: 'number', - description: `The height of the noise in pixels`, - isRequired: true, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$HedImageprocessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$HedImageprocessorInvocation.ts deleted file mode 100644 index 3cffa008f5..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$HedImageprocessorInvocation.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $HedImageprocessorInvocation = { - description: `Applies HED edge detection to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - scribble: { - type: 'boolean', - description: `whether to use scribble mode`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$ImageProcessorInvocation.ts deleted file mode 100644 index 36748982c5..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$ImageProcessorInvocation.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ImageProcessorInvocation = { - description: `Base class for invocations that preprocess images for ControlNet`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$LineartAnimeImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$LineartAnimeImageProcessorInvocation.ts deleted file mode 100644 index 63a9c8158c..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$LineartAnimeImageProcessorInvocation.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $LineartAnimeImageProcessorInvocation = { - description: `Applies line art anime processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$LineartImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$LineartImageProcessorInvocation.ts deleted file mode 100644 index 6ba4064823..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$LineartImageProcessorInvocation.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $LineartImageProcessorInvocation = { - description: `Applies line art processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - coarse: { - type: 'boolean', - description: `whether to use coarse mode`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$MidasDepthImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$MidasDepthImageProcessorInvocation.ts deleted file mode 100644 index ea0b2b0099..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$MidasDepthImageProcessorInvocation.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $MidasDepthImageProcessorInvocation = { - description: `Applies Midas depth processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - a_mult: { - type: 'number', - description: `Midas parameter a = amult * PI`, - }, - bg_th: { - type: 'number', - description: `Midas parameter bg_th`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$MlsdImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$MlsdImageProcessorInvocation.ts deleted file mode 100644 index 1bff7579cc..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$MlsdImageProcessorInvocation.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $MlsdImageProcessorInvocation = { - description: `Applies MLSD processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - thr_v: { - type: 'number', - description: `MLSD parameter thr_v`, - }, - thr_d: { - type: 'number', - description: `MLSD parameter thr_d`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$NormalbaeImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$NormalbaeImageProcessorInvocation.ts deleted file mode 100644 index 7cdfe6f3ae..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$NormalbaeImageProcessorInvocation.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $NormalbaeImageProcessorInvocation = { - description: `Applies NormalBae processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$OpenposeImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$OpenposeImageProcessorInvocation.ts deleted file mode 100644 index 2a187e9cf2..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$OpenposeImageProcessorInvocation.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $OpenposeImageProcessorInvocation = { - description: `Applies Openpose processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - hand_and_face: { - type: 'boolean', - description: `whether to use hands and face mode`, - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$PidiImageProcessorInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$PidiImageProcessorInvocation.ts deleted file mode 100644 index 0fd53967c2..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$PidiImageProcessorInvocation.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $PidiImageProcessorInvocation = { - description: `Applies PIDI processing to image`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - image: { - type: 'all-of', - description: `image to process`, - contains: [{ - type: 'ImageField', - }], - }, - detect_resolution: { - type: 'number', - description: `pixel resolution for edge detection`, - }, - image_resolution: { - type: 'number', - description: `pixel resolution for output image`, - }, - safe: { - type: 'boolean', - description: `whether to use safe mode`, - }, - scribble: { - type: 'boolean', - description: `whether to use scribble mode`, - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$RandomIntInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$RandomIntInvocation.ts deleted file mode 100644 index e5b0387d5a..0000000000 --- a/invokeai/frontend/web/src/services/api/schemas/$RandomIntInvocation.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $RandomIntInvocation = { - description: `Outputs a single random integer.`, - properties: { - id: { - type: 'string', - description: `The id of this node. Must be unique among all nodes.`, - isRequired: true, - }, - type: { - type: 'Enum', - }, - }, -} as const; diff --git a/invokeai/frontend/web/src/services/api/services/ImagesService.ts b/invokeai/frontend/web/src/services/api/services/ImagesService.ts index d0eae92d4b..06065eb1a3 100644 --- a/invokeai/frontend/web/src/services/api/services/ImagesService.ts +++ b/invokeai/frontend/web/src/services/api/services/ImagesService.ts @@ -22,33 +22,33 @@ export class ImagesService { * @throws ApiError */ public static listImagesWithMetadata({ - imageOrigin, - categories, - isIntermediate, - offset, - limit = 10, - }: { - /** - * The origin of images to list - */ - imageOrigin?: ResourceOrigin, - /** - * The categories of image to include - */ - categories?: Array, - /** - * Whether to list intermediate images - */ - isIntermediate?: boolean, - /** - * The page offset - */ - offset?: number, - /** - * The number of images per page - */ - limit?: number, - }): CancelablePromise { +imageOrigin, +categories, +isIntermediate, +offset, +limit = 10, +}: { +/** + * The origin of images to list + */ +imageOrigin?: ResourceOrigin, +/** + * The categories of image to include + */ +categories?: Array, +/** + * Whether to list intermediate images + */ +isIntermediate?: boolean, +/** + * The page offset + */ +offset?: number, +/** + * The number of images per page + */ +limit?: number, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/', @@ -72,25 +72,25 @@ export class ImagesService { * @throws ApiError */ public static uploadImage({ - imageCategory, - isIntermediate, - formData, - sessionId, - }: { - /** - * The category of the image - */ - imageCategory: ImageCategory, - /** - * Whether this is an intermediate image - */ - isIntermediate: boolean, - formData: Body_upload_image, - /** - * The session ID associated with this upload, if any - */ - sessionId?: string, - }): CancelablePromise { +imageCategory, +isIntermediate, +formData, +sessionId, +}: { +/** + * The category of the image + */ +imageCategory: ImageCategory, +/** + * Whether this is an intermediate image + */ +isIntermediate: boolean, +formData: Body_upload_image, +/** + * The session ID associated with this upload, if any + */ +sessionId?: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/images/', @@ -115,13 +115,13 @@ export class ImagesService { * @throws ApiError */ public static getImageFull({ - imageName, - }: { - /** - * The name of full-resolution image file to get - */ - imageName: string, - }): CancelablePromise { +imageName, +}: { +/** + * The name of full-resolution image file to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_name}', @@ -142,13 +142,13 @@ export class ImagesService { * @throws ApiError */ public static deleteImage({ - imageName, - }: { - /** - * The name of the image to delete - */ - imageName: string, - }): CancelablePromise { +imageName, +}: { +/** + * The name of the image to delete + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/images/{image_name}', @@ -168,15 +168,15 @@ export class ImagesService { * @throws ApiError */ public static updateImage({ - imageName, - requestBody, - }: { - /** - * The name of the image to update - */ - imageName: string, - requestBody: ImageRecordChanges, - }): CancelablePromise { +imageName, +requestBody, +}: { +/** + * The name of the image to update + */ +imageName: string, +requestBody: ImageRecordChanges, +}): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', url: '/api/v1/images/{image_name}', @@ -198,13 +198,13 @@ export class ImagesService { * @throws ApiError */ public static getImageMetadata({ - imageName, - }: { - /** - * The name of image to get - */ - imageName: string, - }): CancelablePromise { +imageName, +}: { +/** + * The name of image to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_name}/metadata', @@ -224,13 +224,13 @@ export class ImagesService { * @throws ApiError */ public static getImageThumbnail({ - imageName, - }: { - /** - * The name of thumbnail image file to get - */ - imageName: string, - }): CancelablePromise { +imageName, +}: { +/** + * The name of thumbnail image file to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_name}/thumbnail', @@ -251,13 +251,13 @@ export class ImagesService { * @throws ApiError */ public static getImageUrls({ - imageName, - }: { - /** - * The name of the image whose URL to get - */ - imageName: string, - }): CancelablePromise { +imageName, +}: { +/** + * The name of the image whose URL to get + */ +imageName: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/images/{image_name}/urls', diff --git a/invokeai/frontend/web/src/services/api/services/SessionsService.ts b/invokeai/frontend/web/src/services/api/services/SessionsService.ts index d850a1ed38..c4faa09362 100644 --- a/invokeai/frontend/web/src/services/api/services/SessionsService.ts +++ b/invokeai/frontend/web/src/services/api/services/SessionsService.ts @@ -79,23 +79,23 @@ export class SessionsService { * @throws ApiError */ public static listSessions({ - page, - perPage = 10, - query = '', - }: { - /** - * The page of results to get - */ - page?: number, - /** - * The number of results per page - */ - perPage?: number, - /** - * The query string to search for - */ - query?: string, - }): CancelablePromise { +page, +perPage = 10, +query = '', +}: { +/** + * The page of results to get + */ +page?: number, +/** + * The number of results per page + */ +perPage?: number, +/** + * The query string to search for + */ +query?: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/sessions/', @@ -117,10 +117,10 @@ export class SessionsService { * @throws ApiError */ public static createSession({ - requestBody, - }: { - requestBody?: Graph, - }): CancelablePromise { +requestBody, +}: { +requestBody?: Graph, +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/sessions/', @@ -140,13 +140,13 @@ export class SessionsService { * @throws ApiError */ public static getSession({ - sessionId, - }: { - /** - * The id of the session to get - */ - sessionId: string, - }): CancelablePromise { +sessionId, +}: { +/** + * The id of the session to get + */ +sessionId: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/v1/sessions/{session_id}', @@ -167,15 +167,15 @@ export class SessionsService { * @throws ApiError */ public static addNode({ - sessionId, - requestBody, - }: { - /** - * The id of the session - */ - sessionId: string, - requestBody: (LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | DynamicPromptInvocation | CompelInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | CvInpaintInvocation | RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | FloatLinearRangeInvocation | StepParamEasingInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation), - }): CancelablePromise { +sessionId, +requestBody, +}: { +/** + * The id of the session + */ +sessionId: string, +requestBody: (RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | CompelInvocation | LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | CvInpaintInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | FloatLinearRangeInvocation | StepParamEasingInvocation | DynamicPromptInvocation | RestoreFaceInvocation | UpscaleInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | ImageToImageInvocation | LatentsToLatentsInvocation | InpaintInvocation), +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/sessions/{session_id}/nodes', @@ -199,20 +199,20 @@ export class SessionsService { * @throws ApiError */ public static updateNode({ - sessionId, - nodePath, - requestBody, - }: { - /** - * The id of the session - */ - sessionId: string, - /** - * The path to the node in the graph - */ - nodePath: string, - requestBody: (LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | DynamicPromptInvocation | CompelInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | CvInpaintInvocation | RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | FloatLinearRangeInvocation | StepParamEasingInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation), - }): CancelablePromise { +sessionId, +nodePath, +requestBody, +}: { +/** + * The id of the session + */ +sessionId: string, +/** + * The path to the node in the graph + */ +nodePath: string, +requestBody: (RangeInvocation | RangeOfSizeInvocation | RandomRangeInvocation | CompelInvocation | LoadImageInvocation | ShowImageInvocation | ImageCropInvocation | ImagePasteInvocation | MaskFromAlphaInvocation | ImageMultiplyInvocation | ImageChannelInvocation | ImageConvertInvocation | ImageBlurInvocation | ImageResizeInvocation | ImageScaleInvocation | ImageLerpInvocation | ImageInverseLerpInvocation | ControlNetInvocation | ImageProcessorInvocation | CvInpaintInvocation | TextToImageInvocation | InfillColorInvocation | InfillTileInvocation | InfillPatchMatchInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | ImageToLatentsInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | RandomIntInvocation | ParamIntInvocation | ParamFloatInvocation | FloatLinearRangeInvocation | StepParamEasingInvocation | DynamicPromptInvocation | RestoreFaceInvocation | UpscaleInvocation | GraphInvocation | IterateInvocation | CollectInvocation | CannyImageProcessorInvocation | HedImageProcessorInvocation | LineartImageProcessorInvocation | LineartAnimeImageProcessorInvocation | OpenposeImageProcessorInvocation | MidasDepthImageProcessorInvocation | NormalbaeImageProcessorInvocation | MlsdImageProcessorInvocation | PidiImageProcessorInvocation | ContentShuffleImageProcessorInvocation | ZoeDepthImageProcessorInvocation | MediapipeFaceProcessorInvocation | ImageToImageInvocation | LatentsToLatentsInvocation | InpaintInvocation), +}): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v1/sessions/{session_id}/nodes/{node_path}', @@ -237,18 +237,18 @@ export class SessionsService { * @throws ApiError */ public static deleteNode({ - sessionId, - nodePath, - }: { - /** - * The id of the session - */ - sessionId: string, - /** - * The path to the node to delete - */ - nodePath: string, - }): CancelablePromise { +sessionId, +nodePath, +}: { +/** + * The id of the session + */ +sessionId: string, +/** + * The path to the node to delete + */ +nodePath: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/sessions/{session_id}/nodes/{node_path}', @@ -271,15 +271,15 @@ export class SessionsService { * @throws ApiError */ public static addEdge({ - sessionId, - requestBody, - }: { - /** - * The id of the session - */ - sessionId: string, - requestBody: Edge, - }): CancelablePromise { +sessionId, +requestBody, +}: { +/** + * The id of the session + */ +sessionId: string, +requestBody: Edge, +}): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/v1/sessions/{session_id}/edges', @@ -303,33 +303,33 @@ export class SessionsService { * @throws ApiError */ public static deleteEdge({ - sessionId, - fromNodeId, - fromField, - toNodeId, - toField, - }: { - /** - * The id of the session - */ - sessionId: string, - /** - * The id of the node the edge is coming from - */ - fromNodeId: string, - /** - * The field of the node the edge is coming from - */ - fromField: string, - /** - * The id of the node the edge is going to - */ - toNodeId: string, - /** - * The field of the node the edge is going to - */ - toField: string, - }): CancelablePromise { +sessionId, +fromNodeId, +fromField, +toNodeId, +toField, +}: { +/** + * The id of the session + */ +sessionId: string, +/** + * The id of the node the edge is coming from + */ +fromNodeId: string, +/** + * The field of the node the edge is coming from + */ +fromField: string, +/** + * The id of the node the edge is going to + */ +toNodeId: string, +/** + * The field of the node the edge is going to + */ +toField: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/sessions/{session_id}/edges/{from_node_id}/{from_field}/{to_node_id}/{to_field}', @@ -355,18 +355,18 @@ export class SessionsService { * @throws ApiError */ public static invokeSession({ - sessionId, - all = false, - }: { - /** - * The id of the session to invoke - */ - sessionId: string, - /** - * Whether or not to invoke all remaining invocations - */ - all?: boolean, - }): CancelablePromise { +sessionId, +all = false, +}: { +/** + * The id of the session to invoke + */ +sessionId: string, +/** + * Whether or not to invoke all remaining invocations + */ +all?: boolean, +}): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/v1/sessions/{session_id}/invoke', @@ -391,13 +391,13 @@ export class SessionsService { * @throws ApiError */ public static cancelSessionInvoke({ - sessionId, - }: { - /** - * The id of the session to cancel - */ - sessionId: string, - }): CancelablePromise { +sessionId, +}: { +/** + * The id of the session to cancel + */ +sessionId: string, +}): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/v1/sessions/{session_id}/invoke', From 132829c88f3ca076f30bf999ca948043f8323b5a Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sun, 25 Jun 2023 14:04:00 +1000 Subject: [PATCH 11/13] fix(ui): fix path of generated schema types --- invokeai/frontend/web/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/frontend/web/package.json b/invokeai/frontend/web/package.json index be1a972620..786a721d5c 100644 --- a/invokeai/frontend/web/package.json +++ b/invokeai/frontend/web/package.json @@ -23,7 +23,7 @@ "dev": "concurrently \"vite dev\" \"yarn run theme:watch\"", "dev:host": "concurrently \"vite dev --host\" \"yarn run theme:watch\"", "build": "yarn run lint && vite build", - "typegen": "npx openapi-typescript http://localhost:9090/openapi.json --output src/services/schema.d.ts -t", + "typegen": "npx openapi-typescript http://localhost:9090/openapi.json --output src/services/api/schema.d.ts -t", "preview": "vite preview", "lint:madge": "madge --circular src/main.tsx", "lint:eslint": "eslint --max-warnings=0 .", From 11378a92365989ed4ede9efe0bc0ed131894eae5 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sun, 25 Jun 2023 14:04:16 +1000 Subject: [PATCH 12/13] chore(ui): regen api schema --- .../frontend/web/src/services/api/schema.d.ts | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/invokeai/frontend/web/src/services/api/schema.d.ts b/invokeai/frontend/web/src/services/api/schema.d.ts index 1045b5e4bc..ce27f4ebcb 100644 --- a/invokeai/frontend/web/src/services/api/schema.d.ts +++ b/invokeai/frontend/web/src/services/api/schema.d.ts @@ -648,6 +648,13 @@ export type components = { * @default 1 */ end_step_percent: number; + /** + * Control Mode + * @description The contorl mode to use + * @default balanced + * @enum {string} + */ + control_mode?: "balanced" | "more_prompt" | "more_control" | "unbalanced"; }; /** * ControlNetInvocation @@ -701,6 +708,13 @@ export type components = { * @default 1 */ end_step_percent?: number; + /** + * Control Mode + * @description The control mode used + * @default balanced + * @enum {string} + */ + control_mode?: "balanced" | "more_prompt" | "more_control" | "unbalanced"; }; /** ControlNetModelConfig */ ControlNetModelConfig: { @@ -2903,7 +2917,7 @@ export type components = { /** ModelsList */ ModelsList: { /** Models */ - models: (components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"])[]; + models: (components["schemas"]["StableDiffusion1ModelDiffusersConfig"] | components["schemas"]["StableDiffusion1ModelCheckpointConfig"] | components["schemas"]["VaeModelConfig"] | components["schemas"]["LoRAModelConfig"] | components["schemas"]["ControlNetModelConfig"] | components["schemas"]["TextualInversionModelConfig"] | components["schemas"]["StableDiffusion2ModelCheckpointConfig"] | components["schemas"]["StableDiffusion2ModelDiffusersConfig"])[]; }; /** * MultiplyInvocation @@ -4163,18 +4177,18 @@ export type components = { */ image?: components["schemas"]["ImageField"]; }; - /** - * StableDiffusion1ModelFormat - * @description An enumeration. - * @enum {string} - */ - StableDiffusion1ModelFormat: "checkpoint" | "diffusers"; /** * StableDiffusion2ModelFormat * @description An enumeration. * @enum {string} */ StableDiffusion2ModelFormat: "checkpoint" | "diffusers"; + /** + * StableDiffusion1ModelFormat + * @description An enumeration. + * @enum {string} + */ + StableDiffusion1ModelFormat: "checkpoint" | "diffusers"; }; responses: never; parameters: never; From 57e719702daf741b98da54583eef51356a59fa08 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sun, 25 Jun 2023 14:04:53 +1000 Subject: [PATCH 13/13] fix(ui): add missing ControlNetInvocation type; tidy schema-derived types --- .../frontend/web/src/services/api/types.d.ts | 97 +++++++++---------- 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/invokeai/frontend/web/src/services/api/types.d.ts b/invokeai/frontend/web/src/services/api/types.d.ts index a80343ea61..910e73d885 100644 --- a/invokeai/frontend/web/src/services/api/types.d.ts +++ b/invokeai/frontend/web/src/services/api/types.d.ts @@ -1,81 +1,78 @@ import { components } from './schema'; +type schemas = components['schemas']; + /** * Types from the API, re-exported from the types generated by `openapi-typescript`. */ // Images -export type ImageDTO = components['schemas']['ImageDTO']; -export type BoardDTO = components['schemas']['BoardDTO']; -export type BoardChanges = components['schemas']['BoardChanges']; -export type ImageChanges = components['schemas']['ImageRecordChanges']; -export type ImageCategory = components['schemas']['ImageCategory']; -export type ResourceOrigin = components['schemas']['ResourceOrigin']; -export type ImageField = components['schemas']['ImageField']; +export type ImageDTO = schemas['ImageDTO']; +export type BoardDTO = schemas['BoardDTO']; +export type BoardChanges = schemas['BoardChanges']; +export type ImageChanges = schemas['ImageRecordChanges']; +export type ImageCategory = schemas['ImageCategory']; +export type ResourceOrigin = schemas['ResourceOrigin']; +export type ImageField = schemas['ImageField']; export type OffsetPaginatedResults_BoardDTO_ = - components['schemas']['OffsetPaginatedResults_BoardDTO_']; + schemas['OffsetPaginatedResults_BoardDTO_']; export type OffsetPaginatedResults_ImageDTO_ = - components['schemas']['OffsetPaginatedResults_ImageDTO_']; + schemas['OffsetPaginatedResults_ImageDTO_']; // Models -export type ModelType = components['schemas']['ModelType']; -export type BaseModelType = components['schemas']['BaseModelType']; -export type PipelineModelField = components['schemas']['PipelineModelField']; -export type ModelsList = components['schemas']['ModelsList']; +export type ModelType = schemas['ModelType']; +export type BaseModelType = schemas['BaseModelType']; +export type PipelineModelField = schemas['PipelineModelField']; +export type ModelsList = schemas['ModelsList']; // Graphs -export type Graph = components['schemas']['Graph']; -export type Edge = components['schemas']['Edge']; -export type GraphExecutionState = components['schemas']['GraphExecutionState']; +export type Graph = schemas['Graph']; +export type Edge = schemas['Edge']; +export type GraphExecutionState = schemas['GraphExecutionState']; // General nodes -export type CollectInvocation = components['schemas']['CollectInvocation']; -export type IterateInvocation = components['schemas']['IterateInvocation']; -export type RangeInvocation = components['schemas']['RangeInvocation']; -export type RandomRangeInvocation = - components['schemas']['RandomRangeInvocation']; -export type RangeOfSizeInvocation = - components['schemas']['RangeOfSizeInvocation']; -export type InpaintInvocation = components['schemas']['InpaintInvocation']; -export type ImageResizeInvocation = - components['schemas']['ImageResizeInvocation']; -export type RandomIntInvocation = components['schemas']['RandomIntInvocation']; -export type CompelInvocation = components['schemas']['CompelInvocation']; +export type CollectInvocation = schemas['CollectInvocation']; +export type IterateInvocation = schemas['IterateInvocation']; +export type RangeInvocation = schemas['RangeInvocation']; +export type RandomRangeInvocation = schemas['RandomRangeInvocation']; +export type RangeOfSizeInvocation = schemas['RangeOfSizeInvocation']; +export type InpaintInvocation = schemas['InpaintInvocation']; +export type ImageResizeInvocation = schemas['ImageResizeInvocation']; +export type RandomIntInvocation = schemas['RandomIntInvocation']; +export type CompelInvocation = schemas['CompelInvocation']; // ControlNet Nodes +export type ControlNetInvocation = schemas['ControlNetInvocation']; export type CannyImageProcessorInvocation = - components['schemas']['CannyImageProcessorInvocation']; + schemas['CannyImageProcessorInvocation']; export type ContentShuffleImageProcessorInvocation = - components['schemas']['ContentShuffleImageProcessorInvocation']; + schemas['ContentShuffleImageProcessorInvocation']; export type HedImageProcessorInvocation = - components['schemas']['HedImageProcessorInvocation']; + schemas['HedImageProcessorInvocation']; export type LineartAnimeImageProcessorInvocation = - components['schemas']['LineartAnimeImageProcessorInvocation']; + schemas['LineartAnimeImageProcessorInvocation']; export type LineartImageProcessorInvocation = - components['schemas']['LineartImageProcessorInvocation']; + schemas['LineartImageProcessorInvocation']; export type MediapipeFaceProcessorInvocation = - components['schemas']['MediapipeFaceProcessorInvocation']; + schemas['MediapipeFaceProcessorInvocation']; export type MidasDepthImageProcessorInvocation = - components['schemas']['MidasDepthImageProcessorInvocation']; + schemas['MidasDepthImageProcessorInvocation']; export type MlsdImageProcessorInvocation = - components['schemas']['MlsdImageProcessorInvocation']; + schemas['MlsdImageProcessorInvocation']; export type NormalbaeImageProcessorInvocation = - components['schemas']['NormalbaeImageProcessorInvocation']; + schemas['NormalbaeImageProcessorInvocation']; export type OpenposeImageProcessorInvocation = - components['schemas']['OpenposeImageProcessorInvocation']; + schemas['OpenposeImageProcessorInvocation']; export type PidiImageProcessorInvocation = - components['schemas']['PidiImageProcessorInvocation']; + schemas['PidiImageProcessorInvocation']; export type ZoeDepthImageProcessorInvocation = - components['schemas']['ZoeDepthImageProcessorInvocation']; + schemas['ZoeDepthImageProcessorInvocation']; // Node Outputs -export type ImageOutput = components['schemas']['ImageOutput']; -export type MaskOutput = components['schemas']['MaskOutput']; -export type PromptOutput = components['schemas']['PromptOutput']; -export type IterateInvocationOutput = - components['schemas']['IterateInvocationOutput']; -export type CollectInvocationOutput = - components['schemas']['CollectInvocationOutput']; -export type LatentsOutput = components['schemas']['LatentsOutput']; -export type GraphInvocationOutput = - components['schemas']['GraphInvocationOutput']; +export type ImageOutput = schemas['ImageOutput']; +export type MaskOutput = schemas['MaskOutput']; +export type PromptOutput = schemas['PromptOutput']; +export type IterateInvocationOutput = schemas['IterateInvocationOutput']; +export type CollectInvocationOutput = schemas['CollectInvocationOutput']; +export type LatentsOutput = schemas['LatentsOutput']; +export type GraphInvocationOutput = schemas['GraphInvocationOutput'];