From 3f7d5b4e0f94e7f48cff8c9c0eb2617d52a012cd Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Fri, 8 Sep 2023 15:46:10 -0400 Subject: [PATCH] Remove redundant IPAdapterXL class. --- invokeai/backend/ip_adapter/ip_adapter.py | 8 ++------ invokeai/backend/stable_diffusion/diffusers_pipeline.py | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/invokeai/backend/ip_adapter/ip_adapter.py b/invokeai/backend/ip_adapter/ip_adapter.py index e173547202..e4dca8c9a4 100644 --- a/invokeai/backend/ip_adapter/ip_adapter.py +++ b/invokeai/backend/ip_adapter/ip_adapter.py @@ -41,6 +41,8 @@ class ImageProjModel(torch.nn.Module): class IPAdapter: + """IP-Adapter: https://arxiv.org/pdf/2308.06721.pdf""" + def __init__(self, unet: UNet2DConditionModel, image_encoder_path, ip_ckpt, device, num_tokens=4): self._unet = unet self.device = device @@ -129,12 +131,6 @@ class IPAdapter: attn_processor.scale = scale -class IPAdapterXL(IPAdapter): - """SDXL""" - - pass - - class IPAdapterPlus(IPAdapter): """IP-Adapter with fine-grained features""" diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 66417e56df..f42d99e9bf 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -28,7 +28,7 @@ from pydantic import Field from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer from invokeai.app.services.config import InvokeAIAppConfig -from invokeai.backend.ip_adapter.ip_adapter import IPAdapter, IPAdapterPlus, IPAdapterXL +from invokeai.backend.ip_adapter.ip_adapter import IPAdapter, IPAdapterPlus from invokeai.backend.stable_diffusion.diffusion.conditioning_data import ( ConditioningData, IPAdapterConditioningInfo, @@ -421,11 +421,7 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): if ip_adapter_data is not None: # Initialize IPAdapter # TODO(ryand): Refactor to use model management for the IP-Adapter. - if "sdxl" in ip_adapter_data.ip_adapter_model: - ip_adapter = IPAdapterXL( - self.unet, ip_adapter_data.image_encoder_model, ip_adapter_data.ip_adapter_model, self.unet.device - ) - elif "plus" in ip_adapter_data.ip_adapter_model: + if "plus" in ip_adapter_data.ip_adapter_model: ip_adapter = IPAdapterPlus( self.unet, ip_adapter_data.image_encoder_model,