aboutsummaryrefslogtreecommitdiff
path: root/modules/devices.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-11 23:24:24 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-11 23:24:24 +0300
commit8fb9c57ed62dcef721d50c1eeb9c20f65c509215 (patch)
treee30c32744eba482bf82e488f41d874ddf768eac0 /modules/devices.py
parentd97c6f221ff9f97823c7ffce181a243dec895fa1 (diff)
add half() supporrt for CLIP interrogation
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()