Add --disable-smart-memory for those that want the old behaviour.
This commit is contained in:
@@ -202,6 +202,10 @@ if cpu_state == CPUState.MPS:
|
||||
|
||||
print(f"Set vram state to: {vram_state.name}")
|
||||
|
||||
DISABLE_SMART_MEMORY = args.disable_smart_memory
|
||||
|
||||
if DISABLE_SMART_MEMORY:
|
||||
print("Disabling smart memory management")
|
||||
|
||||
def get_torch_device_name(device):
|
||||
if hasattr(device, 'type'):
|
||||
@@ -289,7 +293,10 @@ def unload_model_clones(model):
|
||||
def free_memory(memory_required, device, keep_loaded=[]):
|
||||
unloaded_model = False
|
||||
for i in range(len(current_loaded_models) -1, -1, -1):
|
||||
current_free_mem = get_free_memory(device)
|
||||
if DISABLE_SMART_MEMORY:
|
||||
current_free_mem = 0
|
||||
else:
|
||||
current_free_mem = get_free_memory(device)
|
||||
if current_free_mem > memory_required:
|
||||
break
|
||||
shift_model = current_loaded_models[i]
|
||||
|
||||
Reference in New Issue
Block a user