From 3fd5c68e1aecf64a162e1261211df5874735bb2b Mon Sep 17 00:00:00 2001 From: tazlin Date: Sun, 22 Sep 2024 14:11:25 -0400 Subject: [PATCH] fix: dont force load flux; do force load CLIP models --- hordelib/comfy_horde.py | 8 ++++++-- hordelib/initialisation.py | 1 + tests/conftest.py | 9 +++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hordelib/comfy_horde.py b/hordelib/comfy_horde.py index b70535fd..1609738b 100644 --- a/hordelib/comfy_horde.py +++ b/hordelib/comfy_horde.py @@ -238,7 +238,7 @@ def do_comfy_import( # isort: on -models_not_to_force_load: list = ["cascade", "sdxl"] # other possible values could be `basemodel` or `sd1` +models_not_to_force_load: list = ["cascade", "sdxl", "flux"] # other possible values could be `basemodel` or `sd1` """Models which should not be forced to load in the comfy model loading hijack. Possible values include `cascade`, `sdxl`, `basemodel`, `sd1` or any other comfyui classname @@ -249,8 +249,12 @@ def do_comfy_import( def _do_not_force_load_model_in_patcher(model_patcher): + model_name_lower = str(type(model_patcher.model)).lower() + if "clip" in model_name_lower: + return False + for model in models_not_to_force_load: - if model in str(type(model_patcher.model)).lower(): + if model in model_name_lower: return True return False diff --git a/hordelib/initialisation.py b/hordelib/initialisation.py index 1332e315..617a5a59 100644 --- a/hordelib/initialisation.py +++ b/hordelib/initialisation.py @@ -84,6 +84,7 @@ def initialise( disable_smart_memory=disable_smart_memory, ) if models_not_to_force_load is not None: + logger.debug(f"Overriding models_not_to_force_load with {models_not_to_force_load}") hordelib.comfy_horde.models_not_to_force_load = models_not_to_force_load.copy() vram_on_start_free = hordelib.comfy_horde.get_torch_free_vram_mb() diff --git a/tests/conftest.py b/tests/conftest.py index f832c00b..0652c3e1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -95,10 +95,11 @@ def init_horde( disable_smart_memory=True, force_normal_vram_mode=True, do_not_load_model_mangers=True, - models_not_to_force_load=[ - "sdxl", - "cascade", - ], + # models_not_to_force_load=[ + # "sdxl", + # "cascade", + # "flux", + # ], ) from hordelib.settings import UserSettings