mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-09-12 12:37:01 +00:00
Add pytorch attention support to VAE.
This commit is contained in:
@@ -41,6 +41,14 @@ else:
|
||||
except:
|
||||
XFORMERS_IS_AVAILBLE = False
|
||||
|
||||
ENABLE_PYTORCH_ATTENTION = False
|
||||
if "--use-pytorch-cross-attention" in sys.argv:
|
||||
torch.backends.cuda.enable_math_sdp(True)
|
||||
torch.backends.cuda.enable_flash_sdp(True)
|
||||
torch.backends.cuda.enable_mem_efficient_sdp(True)
|
||||
ENABLE_PYTORCH_ATTENTION = True
|
||||
XFORMERS_IS_AVAILBLE = False
|
||||
|
||||
|
||||
if "--cpu" in sys.argv:
|
||||
vram_state = CPU
|
||||
@@ -175,6 +183,9 @@ def xformers_enabled():
|
||||
return False
|
||||
return XFORMERS_IS_AVAILBLE
|
||||
|
||||
def pytorch_attention_enabled():
|
||||
return ENABLE_PYTORCH_ATTENTION
|
||||
|
||||
def get_free_memory(dev=None, torch_free_too=False):
|
||||
if dev is None:
|
||||
dev = get_torch_device()
|
||||
|
Reference in New Issue
Block a user