From 0ce6ec634d26a63e0df022391616e61c53a55d03 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Fri, 5 Jul 2024 14:05:12 -0400 Subject: [PATCH] Do not assign the result of SpandrelImageToImageModel.load_from_file(...) during probe to ensure that the model is immediately gc'd. --- invokeai/backend/model_manager/probe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/backend/model_manager/probe.py b/invokeai/backend/model_manager/probe.py index c7267e9f1e..3b36e2f5af 100644 --- a/invokeai/backend/model_manager/probe.py +++ b/invokeai/backend/model_manager/probe.py @@ -253,7 +253,7 @@ class ModelProbe(object): # 2. Spandrel has internal logic to determine a model's type from its state_dict before loading the model. # This logic is not exposed in spandrel's public API. We could copy the logic here, but then we have to # maintain it, and the risk of false positive detections is higher. - _ = SpandrelImageToImageModel.load_from_file(model_path) + SpandrelImageToImageModel.load_from_file(model_path) return ModelType.SpandrelImageToImage except spandrel.UnsupportedModelError: pass