diff options
author | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-07-12 08:57:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 08:57:57 +0000 |
commit | e0218c4f22396a1be8aa4fde3db17c6fc85904eb (patch) | |
tree | 9cc918c09da3afaa4dfd93a823e5485006b9e5c6 /modules/devices.py | |
parent | 3fee3c34f1b01d21770ab0a226b432cdd8444792 (diff) | |
parent | 15adff3d6d5e8ba186b3df6eee8a8d774c8f3879 (diff) | |
download | stable-diffusion-webui-gfx803-e0218c4f22396a1be8aa4fde3db17c6fc85904eb.tar.gz stable-diffusion-webui-gfx803-e0218c4f22396a1be8aa4fde3db17c6fc85904eb.tar.bz2 stable-diffusion-webui-gfx803-e0218c4f22396a1be8aa4fde3db17c6fc85904eb.zip |
Merge branch 'dev' into img2img-save
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(): |