mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
zluda flash attention 2
This commit is contained in:
+1
-1
@@ -453,7 +453,7 @@ def get_default_modes():
|
||||
default_cross_attention = "Scaled-Dot-Product"
|
||||
|
||||
if devices.backend == "zluda":
|
||||
default_sdp_options = ['Math attention', 'Dynamic attention']
|
||||
default_sdp_options = ['Math attention', 'Flash attention', 'Dynamic attention']
|
||||
else:
|
||||
default_sdp_options = ['Flash attention', 'Memory attention', 'Math attention']
|
||||
|
||||
|
||||
+5
-7
@@ -34,15 +34,13 @@ def initialize_zluda():
|
||||
|
||||
from modules import zluda_installer
|
||||
torch.backends.cudnn.enabled = zluda_installer.MIOpen_available
|
||||
torch.backends.cuda.enable_flash_sdp(False)
|
||||
torch.backends.cuda.enable_flash_sdp = do_nothing
|
||||
torch.backends.cuda.enable_math_sdp(True)
|
||||
torch.backends.cuda.enable_math_sdp = do_nothing
|
||||
torch.backends.cuda.enable_mem_efficient_sdp(False)
|
||||
torch.backends.cuda.enable_mem_efficient_sdp = do_nothing
|
||||
if hasattr(torch.backends.cuda, "enable_cudnn_sdp"):
|
||||
if not zluda_installer.MIOpen_available:
|
||||
torch.backends.cuda.enable_cudnn_sdp(False)
|
||||
torch.backends.cuda.enable_cudnn_sdp = do_nothing
|
||||
torch.backends.cuda.enable_flash_sdp(False)
|
||||
torch.backends.cuda.enable_flash_sdp = torch.backends.cuda.enable_cudnn_sdp
|
||||
torch.backends.cuda.enable_mem_efficient_sdp(False)
|
||||
torch.backends.cuda.enable_mem_efficient_sdp = do_nothing
|
||||
|
||||
# ONNX Runtime is not supported
|
||||
ort.capi._pybind_state.get_available_providers = lambda: [v for v in available_execution_providers if v != ExecutionProvider.CUDA] # pylint: disable=protected-access
|
||||
|
||||
Reference in New Issue
Block a user