diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index 51784134b5..f94b3fbede 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -51,8 +51,6 @@ class ControlOutput(BaseInvocationOutput): # fmt: off type: Literal["control_output"] = "control_output" control: Optional[ControlField] = Field(default=None, description="The control info dict") - # raw_processed_image: ImageField = Field(default=None, - # description="outputs just the image info (also included in control output)") # fmt: on @@ -100,6 +98,7 @@ class ImageProcessorInvocation(BaseInvocation, PILInvocationConfig): def invoke(self, context: InvocationContext) -> ImageOutput: raw_image = context.services.images.get( + self.image.image_type, self.image.image_name ) # image type should be PIL.PngImagePlugin.PngImageFile ? @@ -117,6 +116,7 @@ class ImageProcessorInvocation(BaseInvocation, PILInvocationConfig): context.services.images.save(image_type, image_name, processed_image, metadata) """Builds an ImageOutput and its ImageField""" + processed_image_field = ImageField( image_name=image_name, image_type=image_type, diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 15f580b23a..20e4ab2ee3 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -342,21 +342,32 @@ class TextToLatentsInvocation(BaseInvocation): multi_control = MultiControlNetModel(control_models) model.control_model = multi_control - # loading controlnet model - if (self.control_model is None or self.control_model==''): - control_model = None + print("type of control input: ", type(self.control)) + + if (self.control is None): + control_model_name = None + control_image_field = None + control_weight = None else: + control_model_name = self.control.control_model + control_image_field = self.control.image + control_weight = self.control.control_weight + + # # loading controlnet model + # if (self.control_model is None or self.control_model==''): + # control_model = None + # else: # FIXME: change this to dropdown menu? # FIXME: generalize so don't have to hardcode torch_dtype and device - control_model = ControlNetModel.from_pretrained(self.control_model, + control_model = ControlNetModel.from_pretrained(control_model_name, torch_dtype=torch.float16).to("cuda") model.control_model = control_model # loading controlnet image (currently requires pre-processed image) control_image = ( - None if self.control_image is None + None if control_image_field is None else context.services.images.get( - self.control_image.image_type, self.control_image.image_name + control_image_field.image_type, control_image_field.image_name ) )