diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-29 08:32:12 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-29 08:32:12 +0000 |
commit | 2f2d356e4ce331a5c475f7d04adfd1c15d966dcf (patch) | |
tree | 196625181d81a20de5fd0161e775f614faa780b0 | |
parent | c1c27dad3ba371a5ae344b267c760aa51e77f193 (diff) | |
download | stable-diffusion-webui-gfx803-2f2d356e4ce331a5c475f7d04adfd1c15d966dcf.tar.gz stable-diffusion-webui-gfx803-2f2d356e4ce331a5c475f7d04adfd1c15d966dcf.tar.bz2 stable-diffusion-webui-gfx803-2f2d356e4ce331a5c475f7d04adfd1c15d966dcf.zip |
call torch_gc before/after each gpu gradio operation
-rw-r--r-- | webui.py | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1,6 +1,7 @@ import os
import threading
+from modules import devices
from modules.paths import script_path
import signal
@@ -47,6 +48,8 @@ def wrap_queued_call(func): def wrap_gradio_gpu_call(func):
def f(*args, **kwargs):
+ devices.torch_gc()
+
shared.state.sampling_step = 0
shared.state.job_count = -1
shared.state.job_no = 0
@@ -62,6 +65,8 @@ def wrap_gradio_gpu_call(func): shared.state.job = ""
shared.state.job_count = 0
+ devices.torch_gc()
+
return res
return modules.ui.wrap_gradio_call(f)
|