diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-12 13:57:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 13:57:07 +0000 |
commit | e5ca9877781bf2ce45edfb9c46ba532668c50de9 (patch) | |
tree | 8f7b7906d1257ddfe71aa56427d1103d7ba10c26 | |
parent | 15adff3d6d5e8ba186b3df6eee8a8d774c8f3879 (diff) | |
parent | 3d524fd3f1bdb17946bf6fa8a3cdf7b10859c495 (diff) | |
download | stable-diffusion-webui-gfx803-e5ca9877781bf2ce45edfb9c46ba532668c50de9.tar.gz stable-diffusion-webui-gfx803-e5ca9877781bf2ce45edfb9c46ba532668c50de9.tar.bz2 stable-diffusion-webui-gfx803-e5ca9877781bf2ce45edfb9c46ba532668c50de9.zip |
Merge pull request #11749 from akx/mps-gc-fix-2
Don't do MPS GC when there's a latent
-rw-r--r-- | modules/mac_specific.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/mac_specific.py b/modules/mac_specific.py index 2c2f15ca..9ceb43ba 100644 --- a/modules/mac_specific.py +++ b/modules/mac_specific.py @@ -5,7 +5,7 @@ import platform from modules.sd_hijack_utils import CondFunc from packaging import version -log = logging.getLogger() +log = logging.getLogger(__name__) # before torch version 1.13, has_mps is only available in nightly pytorch and macOS 12.3+, @@ -30,6 +30,10 @@ has_mps = check_for_mps() def torch_mps_gc() -> None: try: + from modules.shared import state + if state.current_latent is not None: + log.debug("`current_latent` is set, skipping MPS garbage collection") + return from torch.mps import empty_cache empty_cache() except Exception: |