aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/devices.py b/modules/devices.py
index 0158b11f..6db4e57c 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -1,6 +1,7 @@
import contextlib
import torch
+import gc
from modules import errors
@@ -19,8 +20,8 @@ def get_optimal_device():
return cpu
-
def torch_gc():
+ gc.collect()
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.cuda.ipc_collect()