From 2479a59e5e5ee151294351fc43c49aa43f3f8ab8 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Tue, 3 Oct 2023 15:18:47 -0400 Subject: [PATCH] Re-enable garbage collection in model cache MemorySnapshots. --- invokeai/backend/model_management/model_cache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/invokeai/backend/model_management/model_cache.py b/invokeai/backend/model_management/model_cache.py index b14f9b1f37..8cb6b55caf 100644 --- a/invokeai/backend/model_management/model_cache.py +++ b/invokeai/backend/model_management/model_cache.py @@ -222,9 +222,9 @@ class ModelCache(object): # Load the model from disk and capture a memory snapshot before/after. start_load_time = time.time() - snapshot_before = MemorySnapshot.capture(run_garbage_collector=False) + snapshot_before = MemorySnapshot.capture() model = model_info.get_model(child_type=submodel, torch_dtype=self.precision) - snapshot_after = MemorySnapshot.capture(run_garbage_collector=False) + snapshot_after = MemorySnapshot.capture() end_load_time = time.time() self_reported_model_size_after_load = model_info.get_size(submodel) @@ -276,9 +276,9 @@ class ModelCache(object): return start_model_to_time = time.time() - snapshot_before = MemorySnapshot.capture(run_garbage_collector=False) + snapshot_before = MemorySnapshot.capture() cache_entry.model.to(target_device) - snapshot_after = MemorySnapshot.capture(run_garbage_collector=False) + snapshot_after = MemorySnapshot.capture() end_model_to_time = time.time() self.logger.debug( f"Moved model '{key}' from {source_device} to"