mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-12-25 01:01:34 -05:00
added torch.mps.empty_cache() to torch_gc()
changed a bunch of places that use torch.cuda.empty_cache() to use torch_gc() instead
This commit is contained in:
@@ -49,10 +49,13 @@ 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()
|
||||
elif has_mps() and hasattr(torch.mps, 'empty_cache'):
|
||||
torch.mps.empty_cache()
|
||||
|
||||
|
||||
def enable_tf32():
|
||||
|
||||
Reference in New Issue
Block a user