aboutsummaryrefslogtreecommitdiffstats
path: root/modules/devices.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-07-25 05:18:02 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2023-07-25 05:18:02 +0000
commita3ddf464a2ed24c999f67ddfef7969f8291567be (patch)
treecf70006b4d1d6df1f42ea944416b1034ae32a92b /modules/devices.py
parentf865d3e11647dfd6c7b2cdf90dde24680e58acd8 (diff)
parent2c11e9009ea18bab4ce2963d44db0c6fd3227370 (diff)
downloadstable-diffusion-webui-gfx803-a3ddf464a2ed24c999f67ddfef7969f8291567be.tar.gz
stable-diffusion-webui-gfx803-a3ddf464a2ed24c999f67ddfef7969f8291567be.tar.bz2
stable-diffusion-webui-gfx803-a3ddf464a2ed24c999f67ddfef7969f8291567be.zip
Merge branch 'release_candidate'
Diffstat (limited to 'modules/devices.py')
-rw-r--r--modules/devices.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/modules/devices.py b/modules/devices.py
index 1ed6ffdc..57e51da3 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -15,13 +15,6 @@ def has_mps() -> bool:
else:
return mac_specific.has_mps
-def extract_device_id(args, name):
- for x in range(len(args)):
- if name in args[x]:
- return args[x + 1]
-
- return None
-
def get_cuda_device_string():
from modules import shared
@@ -56,11 +49,15 @@ def get_device_for(task):
def torch_gc():
+
if torch.cuda.is_available():
with torch.cuda.device(get_cuda_device_string()):
torch.cuda.empty_cache()
torch.cuda.ipc_collect()
+ if has_mps():
+ mac_specific.torch_mps_gc()
+
def enable_tf32():
if torch.cuda.is_available():