Fix bug when model cannot be partially unloaded.
Python Linting / Run Pylint (push) Failing after 35s
Build package / Build Test (3.10) (push) Failing after 39s
Build package / Build Test (3.11) (push) Failing after 27s
Build package / Build Test (3.8) (push) Failing after 32s
Build package / Build Test (3.9) (push) Failing after 35s
Tests CI / test (push) Failing after 31s
Python Linting / Run Pylint (push) Failing after 35s
Build package / Build Test (3.10) (push) Failing after 39s
Build package / Build Test (3.11) (push) Failing after 27s
Build package / Build Test (3.8) (push) Failing after 32s
Build package / Build Test (3.9) (push) Failing after 35s
Tests CI / test (push) Failing after 31s
This commit is contained in:
@@ -338,8 +338,9 @@ class LoadedModel:
|
||||
def model_unload(self, memory_to_free=None, unpatch_weights=True):
|
||||
if memory_to_free is not None:
|
||||
if memory_to_free < self.model.loaded_size():
|
||||
self.model.partially_unload(self.model.offload_device, memory_to_free)
|
||||
return False
|
||||
freed = self.model.partially_unload(self.model.offload_device, memory_to_free)
|
||||
if freed >= memory_to_free:
|
||||
return False
|
||||
self.model.unpatch_model(self.model.offload_device, unpatch_weights=unpatch_weights)
|
||||
self.model.model_patches_to(self.model.offload_device)
|
||||
self.weights_loaded = self.weights_loaded and not unpatch_weights
|
||||
|
||||
Reference in New Issue
Block a user