Skip to content

Commit

Permalink
Merge pull request #319 from Haidra-Org/main
Browse files Browse the repository at this point in the history
fix: add `aggressive_unloading` arg to `HordeLib.__new__(...)`
  • Loading branch information
tazlin authored Aug 27, 2024
2 parents 7372958 + 85973b2 commit c94d6d9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hordelib/horde.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,12 @@ def __new__(
cls,
*,
comfyui_callback: Callable[[str, dict, str], None] | None = None,
aggressive_unloading: bool = True,
):
if cls._instance is None:
cls._instance = super().__new__(cls)
cls._comfyui_callback = comfyui_callback
cls.aggressive_unloading = aggressive_unloading

return cls._instance

Expand All @@ -352,12 +354,16 @@ def __init__(
self,
*,
comfyui_callback: Callable[[str, dict, str], None] | None = None,
aggressive_unloading: bool = True,
aggressive_unloading: bool | None = True,
# If you add any more parameters here, you should also add them to __new__ above
# and follow the same pattern
):
if not self._initialised:
self.generator = Comfy_Horde(
comfyui_callback=comfyui_callback if comfyui_callback else self._comfyui_callback,
aggressive_unloading=aggressive_unloading,
aggressive_unloading=(
aggressive_unloading if aggressive_unloading is not None else self.aggressive_unloading
),
)
self.__class__._initialised = True

Expand Down

0 comments on commit c94d6d9

Please sign in to comment.