Remove remains of priority logic

This commit is contained in:
Sergey Borisov 2024-07-13 00:44:21 +03:00
parent 7e00526999
commit e961dd1dec
2 changed files with 3 additions and 6 deletions

View File

@ -27,8 +27,7 @@ def callback(name: str, order: int = 0):
class ExtensionBase: class ExtensionBase:
def __init__(self, priority: int): def __init__(self):
self.priority = priority
self.injections: List[InjectionInfo] = [] self.injections: List[InjectionInfo] = []
for func_name in dir(self): for func_name in dir(self):
func = getattr(self, func_name) func = getattr(self, func_name)

View File

@ -81,11 +81,10 @@ class ExtensionsManager:
def add_extension(self, ext: ExtensionBase): def add_extension(self, ext: ExtensionBase):
self.extensions.append(ext) self.extensions.append(ext)
ordered_extensions = sorted(self.extensions, reverse=True, key=lambda ext: ext.priority)
self._callbacks.clear() self._callbacks.clear()
for ext in ordered_extensions: for ext in self.extensions:
for inj_info in ext.injections: for inj_info in ext.injections:
if inj_info.type == "callback": if inj_info.type == "callback":
if inj_info.name not in self._callbacks: if inj_info.name not in self._callbacks:
@ -139,8 +138,7 @@ class ExtensionsManager:
changed_keys = set() changed_keys = set()
changed_unknown_keys = {} changed_unknown_keys = {}
ordered_extensions = sorted(self.extensions, reverse=True, key=lambda ext: ext.priority) for ext in self.extensions:
for ext in ordered_extensions:
patch_result = exit_stack.enter_context(ext.patch_unet(state_dict, unet)) patch_result = exit_stack.enter_context(ext.patch_unet(state_dict, unet))
if patch_result is None: if patch_result is None:
continue continue