mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-10 06:10:50 +08:00
Merge f1f4f545f4 into 5943fbf457
This commit is contained in:
commit
266d63e705
@ -651,8 +651,12 @@ class ModelPatcher:
|
||||
self.pinned.remove(key)
|
||||
|
||||
def unpin_all_weights(self):
|
||||
for key in list(self.pinned):
|
||||
self.unpin_weight(key)
|
||||
if hasattr(self, 'pinned'): # Safety check
|
||||
for key in list(self.pinned):
|
||||
self.unpin_weight(key)
|
||||
else:
|
||||
# Log or skip: self.pinned was not set
|
||||
pass
|
||||
|
||||
def _load_list(self):
|
||||
loading = []
|
||||
@ -1356,6 +1360,12 @@ class ModelPatcher:
|
||||
self.clear_cached_hook_weights()
|
||||
|
||||
def __del__(self):
|
||||
self.unpin_all_weights()
|
||||
self.detach(unpatch_all=False)
|
||||
try:
|
||||
if hasattr(self, 'pinned'):
|
||||
self.unpin_all_weights()
|
||||
self.detach(unpatch_all=False)
|
||||
except Exception as e:
|
||||
# Suppress errors in destructor to avoid noise
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user