mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Remove remains of priority logic
This commit is contained in:
parent
7e00526999
commit
e961dd1dec
@ -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)
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user