Skip to content

Commit

Permalink
fix: dont force load flux; do force load CLIP models
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Sep 22, 2024
1 parent ba9456e commit 3fd5c68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions hordelib/comfy_horde.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions hordelib/initialisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 5 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3fd5c68

Please sign in to comment.