From cd85f876f2143e3f1b144e11a631fb0abab695bb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 28 Feb 2023 11:56:33 -0500 Subject: [PATCH] Try to clear more memory at the end of each prompt execution. --- execution.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/execution.py b/execution.py index e67ca867..69761eb0 100644 --- a/execution.py +++ b/execution.py @@ -5,6 +5,7 @@ import json import threading import heapq import traceback +import gc import torch import nodes @@ -187,7 +188,10 @@ class PromptExecutor: if self.server.client_id is not None: self.server.send_sync("executing", { "node": None }, self.server.client_id) + gc.collect() torch.cuda.empty_cache() + torch.cuda.ipc_collect() + def validate_inputs(prompt, item): unique_id = item