From e5acbc6be953a03deece0c9b4f6a4766366db733 Mon Sep 17 00:00:00 2001 From: David Bejar Caceres Date: Fri, 16 Dec 2022 16:27:18 +0100 Subject: [PATCH] Call garbage collector after unload model --- lama_cleaner/model_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lama_cleaner/model_manager.py b/lama_cleaner/model_manager.py index 549b307..ab31b1b 100644 --- a/lama_cleaner/model_manager.py +++ b/lama_cleaner/model_manager.py @@ -46,8 +46,8 @@ class ModelManager: if (torch.cuda.memory_allocated() > 0): # Clear current loaded model from memory torch.cuda.empty_cache() - gc.collect() del self.model + gc.collect() self.model = self.init_model(new_name, self.device, **self.kwargs) self.name = new_name