mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 02:15:17 +00:00
Fix bug when model cannot be partially unloaded.
This commit is contained in:
parent
74e124f4d7
commit
39fb74c5bd
@ -338,8 +338,9 @@ class LoadedModel:
|
|||||||
def model_unload(self, memory_to_free=None, unpatch_weights=True):
|
def model_unload(self, memory_to_free=None, unpatch_weights=True):
|
||||||
if memory_to_free is not None:
|
if memory_to_free is not None:
|
||||||
if memory_to_free < self.model.loaded_size():
|
if memory_to_free < self.model.loaded_size():
|
||||||
self.model.partially_unload(self.model.offload_device, memory_to_free)
|
freed = self.model.partially_unload(self.model.offload_device, memory_to_free)
|
||||||
return False
|
if freed >= memory_to_free:
|
||||||
|
return False
|
||||||
self.model.unpatch_model(self.model.offload_device, unpatch_weights=unpatch_weights)
|
self.model.unpatch_model(self.model.offload_device, unpatch_weights=unpatch_weights)
|
||||||
self.model.model_patches_to(self.model.offload_device)
|
self.model.model_patches_to(self.model.offload_device)
|
||||||
self.weights_loaded = self.weights_loaded and not unpatch_weights
|
self.weights_loaded = self.weights_loaded and not unpatch_weights
|
||||||
|
Loading…
Reference in New Issue
Block a user