Update app.py
Browse files
app.py
CHANGED
|
@@ -11,16 +11,6 @@ subprocess.run(
|
|
| 11 |
check=False,
|
| 12 |
)
|
| 13 |
|
| 14 |
-
from flash_attn import flash_attn_func
|
| 15 |
-
|
| 16 |
-
try:
|
| 17 |
-
from ltx_core.model.transformer import attention as _attn_mod
|
| 18 |
-
_attn_mod.memory_efficient_attention = flash_attn_func
|
| 19 |
-
except Exception as e:
|
| 20 |
-
print(f"[ATTN] FA3 import failed: {e}, using xformers")
|
| 21 |
-
from xformers.ops import memory_efficient_attention as _mea
|
| 22 |
-
_attn_mod.memory_efficient_attention = _mea
|
| 23 |
-
|
| 24 |
# Clone LTX-2 repo and install packages
|
| 25 |
LTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"
|
| 26 |
LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")
|
|
@@ -93,6 +83,16 @@ from ltx_pipelines.utils.media_io import decode_audio_from_file, encode_video
|
|
| 93 |
from ltx_core.loader.primitives import LoraPathStrengthAndSDOps
|
| 94 |
from ltx_core.loader.sd_ops import LTXV_LORA_COMFY_RENAMING_MAP
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
# Attention kernels: try FlashAttention-3 first, fall back to xformers
|
| 97 |
from ltx_core.model.transformer import attention as _attn_mod
|
| 98 |
print(f"[ATTN] Before patch: memory_efficient_attention={_attn_mod.memory_efficient_attention}")
|
|
|
|
| 11 |
check=False,
|
| 12 |
)
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Clone LTX-2 repo and install packages
|
| 15 |
LTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"
|
| 16 |
LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")
|
|
|
|
| 83 |
from ltx_core.loader.primitives import LoraPathStrengthAndSDOps
|
| 84 |
from ltx_core.loader.sd_ops import LTXV_LORA_COMFY_RENAMING_MAP
|
| 85 |
|
| 86 |
+
from flash_attn import flash_attn_func
|
| 87 |
+
|
| 88 |
+
try:
|
| 89 |
+
from ltx_core.model.transformer import attention as _attn_mod
|
| 90 |
+
_attn_mod.memory_efficient_attention = flash_attn_func
|
| 91 |
+
except Exception as e:
|
| 92 |
+
print(f"[ATTN] FA3 import failed: {e}, using xformers")
|
| 93 |
+
from xformers.ops import memory_efficient_attention as _mea
|
| 94 |
+
_attn_mod.memory_efficient_attention = _mea
|
| 95 |
+
|
| 96 |
# Attention kernels: try FlashAttention-3 first, fall back to xformers
|
| 97 |
from ltx_core.model.transformer import attention as _attn_mod
|
| 98 |
print(f"[ATTN] Before patch: memory_efficient_attention={_attn_mod.memory_efficient_attention}")
|