From b5805732f105b5bb2308c3e803e018f127024242 Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Sat, 27 Jan 2024 20:42:38 -0800 Subject: [PATCH] i --- modules_forge/controlnet.py | 7 +++++++ modules_forge/initialization.py | 3 +++ modules_forge/patch_basic.py | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 modules_forge/patch_basic.py diff --git a/modules_forge/controlnet.py b/modules_forge/controlnet.py index 35395699..a65e2c03 100644 --- a/modules_forge/controlnet.py +++ b/modules_forge/controlnet.py @@ -7,6 +7,13 @@ def apply_controlnet_advanced( end_percent, positive_advanced_weighting=None, negative_advanced_weighting=None): + + a = 0 + + unet.control_options = [1, 2, 3] + m = unet.clone() + m.control_options = [4, 5, 6] + return m diff --git a/modules_forge/initialization.py b/modules_forge/initialization.py index eb9feba6..2c9a4210 100644 --- a/modules_forge/initialization.py +++ b/modules_forge/initialization.py @@ -17,6 +17,9 @@ def initialize_forge(): import modules_forge.patch_precision modules_forge.patch_precision.patch_all_precision() + import modules_forge.patch_basic + modules_forge.patch_basic.patch_all_basics() + if model_management.directml_enabled: model_management.lowvram_available = True model_management.OOM_EXCEPTION = Exception diff --git a/modules_forge/patch_basic.py b/modules_forge/patch_basic.py new file mode 100644 index 00000000..3941af10 --- /dev/null +++ b/modules_forge/patch_basic.py @@ -0,0 +1,23 @@ +from ldm_patched.modules.model_patcher import ModelPatcher + + +og_model_patcher_init = ModelPatcher.__init__ +og_model_patcher_clone = ModelPatcher.clone + + +def patched_model_patcher_init(self, *args, **kwargs): + h = og_model_patcher_init(self, *args, **kwargs) + self.control_options = [] + return h + + +def patched_model_patcher_clone(self): + cloned = og_model_patcher_clone(self) + cloned.control_options = [x for x in self.control_options] + return cloned + + +def patch_all_basics(): + ModelPatcher.__init__ = patched_model_patcher_init + ModelPatcher.clone = patched_model_patcher_clone + return