diff options
author | Leon Feng <523684+leon0707@users.noreply.github.com> | 2023-07-18 04:24:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 04:24:14 -0400 |
commit | a3730bd9becd2f1f5d209885b694b0dec178d110 (patch) | |
tree | 8ac9948d89606f7519df786f07f6ddb93c3d2720 /modules/devices.py | |
parent | d6668347c8b85b11b696ac56777cc396e34ee1f9 (diff) | |
parent | 871b8687a82bb2ca907d8a49c87aed7635b8fc33 (diff) |
Merge branch 'dev' into fix-11805
Diffstat (limited to 'modules/devices.py')
-rw-r--r-- | modules/devices.py | 11 |
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(): |