Skip to content

Commit

Permalink
Don't do MPS GC when there's a latent that could still be sampled
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Jul 12, 2023
1 parent 8f6b24c commit 3d524fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/mac_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def check_for_mps() -> bool:

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:
Expand Down

0 comments on commit 3d524fd

Please sign in to comment.