Skip to content

Commit

Permalink
fix: add aggressive_unloading arg to HordeLib.__new__(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Aug 27, 2024
1 parent 2d58136 commit 85973b2
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 85973b2

Please sign in to comment.