diff options
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 6 |
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() |