Remove redundant IPAdapterXL class.

This commit is contained in:
Ryan Dick 2023-09-08 15:46:10 -04:00
parent 91596d9527
commit 3f7d5b4e0f
2 changed files with 4 additions and 12 deletions

View File

@ -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"""

View File

@ -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,