diff --git a/invokeai/backend/model_management/model_cache.py b/invokeai/backend/model_management/model_cache.py index 2385fd9bec..0b2a8b8df7 100644 --- a/invokeai/backend/model_management/model_cache.py +++ b/invokeai/backend/model_management/model_cache.py @@ -474,11 +474,11 @@ class ModelCache(object): f" refs: {refs}" ) - # 2 refs: + # Expected refs: # 1 from cache_entry # 1 from getrefcount function # 1 from onnx runtime object - if not cache_entry.locked and refs <= 3 if "onnx" in model_key else 2: + if not cache_entry.locked and refs <= (3 if "onnx" in model_key else 2): self.logger.debug( f"Unloading model {model_key} to free {(model_size/GIG):.2f} GB (-{(cache_entry.size/GIG):.2f} GB)" )