mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-19 10:53:29 +00:00
Call unpatch_hooks at the start of ModelPatcher.partially_unload (#7253)
* Call unpatch_hooks at the start of ModelPatcher.partially_unload * Only call unpatch_hooks in partially_unload if lowvram is possible
This commit is contained in:
parent
fd5297131f
commit
2e24a15905
@ -747,6 +747,7 @@ class ModelPatcher:
|
|||||||
|
|
||||||
def partially_unload(self, device_to, memory_to_free=0):
|
def partially_unload(self, device_to, memory_to_free=0):
|
||||||
with self.use_ejected():
|
with self.use_ejected():
|
||||||
|
hooks_unpatched = False
|
||||||
memory_freed = 0
|
memory_freed = 0
|
||||||
patch_counter = 0
|
patch_counter = 0
|
||||||
unload_list = self._load_list()
|
unload_list = self._load_list()
|
||||||
@ -770,6 +771,10 @@ class ModelPatcher:
|
|||||||
move_weight = False
|
move_weight = False
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if not hooks_unpatched:
|
||||||
|
self.unpatch_hooks()
|
||||||
|
hooks_unpatched = True
|
||||||
|
|
||||||
if bk.inplace_update:
|
if bk.inplace_update:
|
||||||
comfy.utils.copy_to_param(self.model, key, bk.weight)
|
comfy.utils.copy_to_param(self.model, key, bk.weight)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user