aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
authorEyeDeck <eyedeck@gmail.com>2022-09-11 22:15:30 +0000
committerGitHub <noreply@github.com>2022-09-11 22:15:30 +0000
commite05e46aa3f3b2230affe399372ad96d8736e4010 (patch)
treee51f423443ad2fd77da2c4b9f3c6d25f563fca66 /modules/devices.py
parent29a2933e23e68900bbae741a98439d0c9d6f26f6 (diff)
parent303b75c1490e8f9e146ba207f3425a7f0317cb12 (diff)
downloadstable-diffusion-webui-gfx803-e05e46aa3f3b2230affe399372ad96d8736e4010.tar.gz
stable-diffusion-webui-gfx803-e05e46aa3f3b2230affe399372ad96d8736e4010.tar.bz2
stable-diffusion-webui-gfx803-e05e46aa3f3b2230affe399372ad96d8736e4010.zip
Merge branch 'master' into master
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/devices.py b/modules/devices.py
index 30d30b99..f88e807e 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -14,3 +14,9 @@ def get_optimal_device():
return torch.device("mps")
return cpu
+
+
+def torch_gc():
+ if torch.cuda.is_available():
+ torch.cuda.empty_cache()
+ torch.cuda.ipc_collect()