From e961dd1decfa1b96f4bbad08a233111d17458b67 Mon Sep 17 00:00:00 2001 From: Sergey Borisov Date: Sat, 13 Jul 2024 00:44:21 +0300 Subject: [PATCH] Remove remains of priority logic --- invokeai/backend/stable_diffusion/extensions/base.py | 3 +-- invokeai/backend/stable_diffusion/extensions_manager.py | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/invokeai/backend/stable_diffusion/extensions/base.py b/invokeai/backend/stable_diffusion/extensions/base.py index 1617fcf1c1..3effa77da4 100644 --- a/invokeai/backend/stable_diffusion/extensions/base.py +++ b/invokeai/backend/stable_diffusion/extensions/base.py @@ -27,8 +27,7 @@ def callback(name: str, order: int = 0): class ExtensionBase: - def __init__(self, priority: int): - self.priority = priority + def __init__(self): self.injections: List[InjectionInfo] = [] for func_name in dir(self): func = getattr(self, func_name) diff --git a/invokeai/backend/stable_diffusion/extensions_manager.py b/invokeai/backend/stable_diffusion/extensions_manager.py index 26e7198fa4..876fd96d39 100644 --- a/invokeai/backend/stable_diffusion/extensions_manager.py +++ b/invokeai/backend/stable_diffusion/extensions_manager.py @@ -81,11 +81,10 @@ class ExtensionsManager: def add_extension(self, ext: ExtensionBase): self.extensions.append(ext) - ordered_extensions = sorted(self.extensions, reverse=True, key=lambda ext: ext.priority) self._callbacks.clear() - for ext in ordered_extensions: + for ext in self.extensions: for inj_info in ext.injections: if inj_info.type == "callback": if inj_info.name not in self._callbacks: @@ -139,8 +138,7 @@ class ExtensionsManager: changed_keys = set() changed_unknown_keys = {} - ordered_extensions = sorted(self.extensions, reverse=True, key=lambda ext: ext.priority) - for ext in ordered_extensions: + for ext in self.extensions: patch_result = exit_stack.enter_context(ext.patch_unet(state_dict, unet)) if patch_result is None: continue