mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Added ip_adapter_strength parameter to adjust weighting of IP-Adapter's added cross-attention layers
This commit is contained in:
parent
f2cd9e9ae2
commit
5a9993772d
@ -216,7 +216,9 @@ class DenoiseLatentsInvocation(BaseInvocation):
|
||||
default=None,
|
||||
description=FieldDescriptions.mask,
|
||||
)
|
||||
ip_adapter_image: Optional[ImageField] = InputField(input=Input.Connection)
|
||||
ip_adapter_image: Optional[ImageField] = InputField(input=Input.Connection, title="IP Adapter Image", ui_order=6)
|
||||
ip_adapter_strength: float = InputField(default=1.0, ge=0, le=2, ui_type=UIType.Float,
|
||||
title="IP Adapter Strength", ui_order=7)
|
||||
|
||||
@validator("cfg_scale")
|
||||
def ge_one(cls, v):
|
||||
@ -534,6 +536,7 @@ class DenoiseLatentsInvocation(BaseInvocation):
|
||||
conditioning_data=conditioning_data,
|
||||
control_data=control_data, # list[ControlNetData],
|
||||
ip_adapter_image=unwrapped_ip_adapter_image,
|
||||
ip_adapter_strength=self.ip_adapter_strength,
|
||||
callback=step_callback,
|
||||
)
|
||||
|
||||
|
@ -359,6 +359,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline):
|
||||
callback: Callable[[PipelineIntermediateState], None] = None,
|
||||
control_data: List[ControlNetData] = None,
|
||||
ip_adapter_image: Optional[PIL.Image] = None,
|
||||
ip_adapter_strength: float = 1.0,
|
||||
mask: Optional[torch.Tensor] = None,
|
||||
masked_latents: Optional[torch.Tensor] = None,
|
||||
seed: Optional[int] = None,
|
||||
@ -411,6 +412,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline):
|
||||
additional_guidance=additional_guidance,
|
||||
control_data=control_data,
|
||||
ip_adapter_image=ip_adapter_image,
|
||||
ip_adapter_strength=ip_adapter_strength,
|
||||
callback=callback,
|
||||
)
|
||||
finally:
|
||||
@ -431,6 +433,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline):
|
||||
additional_guidance: List[Callable] = None,
|
||||
control_data: List[ControlNetData] = None,
|
||||
ip_adapter_image: Optional[PIL.Image] = None,
|
||||
ip_adapter_strength: float = 1.0,
|
||||
callback: Callable[[PipelineIntermediateState], None] = None,
|
||||
):
|
||||
|
||||
@ -463,6 +466,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline):
|
||||
ip_adapter_model_path, # hardwiring to manually downloaded loc for first pass
|
||||
"cuda") # hardwiring CUDA GPU for first pass
|
||||
# IP-Adapter ==> add additional cross-attention layers to UNet model here?
|
||||
ip_adapter.set_scale(ip_adapter_strength)
|
||||
print("ip_adapter:", ip_adapter)
|
||||
|
||||
# get image embedding from CLIP and ImageProjModel
|
||||
|
Loading…
Reference in New Issue
Block a user