From 85973b2eda30a86cb7cc0f00494d8a38bdf590d2 Mon Sep 17 00:00:00 2001 From: tazlin Date: Mon, 26 Aug 2024 21:58:01 -0400 Subject: [PATCH] fix: add `aggressive_unloading` arg to `HordeLib.__new__(...)` --- hordelib/horde.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hordelib/horde.py b/hordelib/horde.py index cbca0403..bc814631 100644 --- a/hordelib/horde.py +++ b/hordelib/horde.py @@ -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 @@ -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