From 8e5139291071608e3c3b33eee42b0f969212f7c3 Mon Sep 17 00:00:00 2001 From: Brandon Rising Date: Wed, 14 Feb 2024 13:07:11 -0500 Subject: [PATCH] Update _get_hf_load_class to support clipvision models --- invokeai/backend/model_manager/load/load_default.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/invokeai/backend/model_manager/load/load_default.py b/invokeai/backend/model_manager/load/load_default.py index df83c8320d..9ed0ccb2d3 100644 --- a/invokeai/backend/model_manager/load/load_default.py +++ b/invokeai/backend/model_manager/load/load_default.py @@ -163,8 +163,12 @@ class ModelLoader(ModelLoaderBase): else: try: config = self._load_diffusers_config(model_path, config_name="config.json") - class_name = config["_class_name"] - return self._hf_definition_to_type(module="diffusers", class_name=class_name) + class_name = config.get("_class_name", None) + if class_name: + return self._hf_definition_to_type(module="diffusers", class_name=class_name) + if config.get("model_type", None) == "clip_vision_model": + class_name = config.get("architectures")[0] + return self._hf_definition_to_type(module="transformers", class_name=class_name) except KeyError as e: raise InvalidModelConfigException("An expected config.json file is missing from this model.") from e