Skip to content

Commit 297408d

Browse files
psychedelicioushipsterusername
authored andcommitted
feat(nodes): add control adapter processed images to metadata
In the client, a controlnet or t2i adapter has two images: - The source control image: the image the user selected (required) - The processed control image: the user's image after we've processed it (optional) The processed image is optional because a user may provide a pre-processed image. We only actually use one of these images when building the graph, and until this change, we only stored one of the in image metadata. This created a situation where only a processed image was stored in metadata - say, a canny edge map - and the user-selected image wasn't provided. By adding the processed image to metadata, we can recall both the control image and optional processed image. This commit is followed by a UI-facing changes to support the change.
1 parent 0131e7d commit 297408d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

invokeai/app/invocations/metadata.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,15 @@ class IPAdapterMetadataField(BaseModel):
4242
"""IP Adapter Field, minus the CLIP Vision Encoder model"""
4343

4444
image: ImageField = Field(description="The IP-Adapter image prompt.")
45-
ip_adapter_model: ModelIdentifierField = Field(
46-
description="The IP-Adapter model.",
47-
)
48-
weight: Union[float, list[float]] = Field(
49-
description="The weight given to the IP-Adapter",
50-
)
45+
ip_adapter_model: ModelIdentifierField = Field(description="The IP-Adapter model.")
46+
weight: Union[float, list[float]] = Field(description="The weight given to the IP-Adapter")
5147
begin_step_percent: float = Field(description="When the IP-Adapter is first applied (% of total steps)")
5248
end_step_percent: float = Field(description="When the IP-Adapter is last applied (% of total steps)")
5349

5450

5551
class T2IAdapterMetadataField(BaseModel):
56-
image: ImageField = Field(description="The T2I-Adapter image prompt.")
52+
image: ImageField = Field(description="The control image.")
53+
processed_image: Optional[ImageField] = Field(default=None, description="The control image, after processing.")
5754
t2i_adapter_model: ModelIdentifierField = Field(description="The T2I-Adapter model to use.")
5855
weight: Union[float, list[float]] = Field(default=1, description="The weight given to the T2I-Adapter")
5956
begin_step_percent: float = Field(
@@ -67,6 +64,7 @@ class T2IAdapterMetadataField(BaseModel):
6764

6865
class ControlNetMetadataField(BaseModel):
6966
image: ImageField = Field(description="The control image")
67+
processed_image: Optional[ImageField] = Field(default=None, description="The control image, after processing.")
7068
control_model: ModelIdentifierField = Field(description="The ControlNet model to use")
7169
control_weight: Union[float, list[float]] = Field(default=1, description="The weight given to the ControlNet")
7270
begin_step_percent: float = Field(

0 commit comments

Comments
 (0)