Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dont force load flux; do force load CLIP models #336

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading