From 2c1100509f712898d637901358eacc34c8416b96 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Thu, 14 Sep 2023 08:19:55 -0400 Subject: [PATCH] Add BaseModelType.Any to be used by CLIPVisionModel. --- invokeai/app/invocations/latent.py | 2 +- invokeai/backend/model_management/model_probe.py | 2 +- invokeai/backend/model_management/models/__init__.py | 11 +++++++++++ invokeai/backend/model_management/models/base.py | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/invokeai/app/invocations/latent.py b/invokeai/app/invocations/latent.py index 7c13eacdbb..32e1ecc499 100644 --- a/invokeai/app/invocations/latent.py +++ b/invokeai/app/invocations/latent.py @@ -420,7 +420,7 @@ class DenoiseLatentsInvocation(BaseInvocation): # TODO(ryand): Get this model_name from the IPAdapterField. model_name="ip_adapter_clip_vision", model_type=ModelType.CLIPVision, - base_model=ip_adapter.ip_adapter_model.base_model, + base_model=BaseModelType.Any, context=context, ) diff --git a/invokeai/backend/model_management/model_probe.py b/invokeai/backend/model_management/model_probe.py index 71e5b89e0f..b63467bf40 100644 --- a/invokeai/backend/model_management/model_probe.py +++ b/invokeai/backend/model_management/model_probe.py @@ -534,7 +534,7 @@ class IPAdapterFolderProbe(FolderProbeBase): class CLIPVisionFolderProbe(FolderProbeBase): def get_base_type(self) -> BaseModelType: - raise NotImplementedError() + return BaseModelType.Any ############## register probe classes ###### diff --git a/invokeai/backend/model_management/models/__init__.py b/invokeai/backend/model_management/models/__init__.py index deeaf33bca..d361301554 100644 --- a/invokeai/backend/model_management/models/__init__.py +++ b/invokeai/backend/model_management/models/__init__.py @@ -71,6 +71,17 @@ MODEL_CLASSES = { ModelType.IPAdapter: IPAdapterModel, ModelType.CLIPVision: CLIPVisionModel, }, + BaseModelType.Any: { + ModelType.CLIPVision: CLIPVisionModel, + # The following model types are not expected to be used with BaseModelType.Any. + ModelType.ONNX: ONNXStableDiffusion2Model, + ModelType.Main: StableDiffusion2Model, + ModelType.Vae: VaeModel, + ModelType.Lora: LoRAModel, + ModelType.ControlNet: ControlNetModel, + ModelType.TextualInversion: TextualInversionModel, + ModelType.IPAdapter: IPAdapterModel, + }, # BaseModelType.Kandinsky2_1: { # ModelType.Main: Kandinsky2_1Model, # ModelType.MoVQ: MoVQModel, diff --git a/invokeai/backend/model_management/models/base.py b/invokeai/backend/model_management/models/base.py index f69baf50fd..d8b2ed8e52 100644 --- a/invokeai/backend/model_management/models/base.py +++ b/invokeai/backend/model_management/models/base.py @@ -47,6 +47,7 @@ class ModelNotFoundException(Exception): class BaseModelType(str, Enum): + Any = "any" # For models that are not associated with any particular base model. StableDiffusion1 = "sd-1" StableDiffusion2 = "sd-2" StableDiffusionXL = "sdxl"