From 65af498879c4e7101209d1d6b65cbc34b3454745 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Fri, 2 Feb 2024 09:02:49 -0600 Subject: [PATCH] Fix for ControlLLLite control object on patches becoming None --- adv_control/control.py | 1 + adv_control/control_lllite.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/adv_control/control.py b/adv_control/control.py index ee19d9c..a5c1dd2 100644 --- a/adv_control/control.py +++ b/adv_control/control.py @@ -302,6 +302,7 @@ class ControlLLLiteAdvanced(ControlBase, AdvancedControlBase): def pre_run_advanced(self, *args, **kwargs): AdvancedControlBase.pre_run_advanced(self, *args, **kwargs) self.patch.set_control(self) + #logger.warn(f"in pre_run_advanced: {id(self)}") def get_control_advanced(self, x_noisy: Tensor, t, cond, batched_number: int): # normal ControlNet stuff diff --git a/adv_control/control_lllite.py b/adv_control/control_lllite.py index c5b7928..5298e9c 100644 --- a/adv_control/control_lllite.py +++ b/adv_control/control_lllite.py @@ -41,6 +41,7 @@ class LLLitePatch: def __init__(self, modules: dict[str, 'LLLiteModule'], control: Union[AdvancedControlBase, ControlBase]=None): self.modules = modules self.control = control + #logger.error(f"create LLLitePatch: {id(self)},{control}") def __call__(self, q, k, v, extra_options): # determine if have anything to run @@ -72,21 +73,25 @@ class LLLitePatch: return q, k, v def to(self, device): + #logger.info(f"to... has control? {self.control}") for d in self.modules.keys(): self.modules[d] = self.modules[d].to(device) return self def set_control(self, control: Union[AdvancedControlBase, ControlBase]): self.control = control + #logger.error(f"set control for LLLitePatch: {id(self)},{id(control)}") def clone_with_control(self, control: AdvancedControlBase): + #logger.error(f"clone-set control for LLLitePatch: {id(self)},{id(control)}") return LLLitePatch(self.modules, control) def cleanup(self): - del self.control - self.control = None + #del self.control + #self.control = None for module in self.modules.values(): module.cleanup() + #logger.error(f"cleanup LLLitePatch: {id(self)}") # TODO: use comfy.ops to support fp8 properly