Update app.py
Browse files
app.py
CHANGED
|
@@ -7,10 +7,20 @@ os.environ["TORCH_COMPILE_DISABLE"] = "1"
|
|
| 7 |
os.environ["TORCHDYNAMO_DISABLE"] = "1"
|
| 8 |
|
| 9 |
subprocess.run(
|
| 10 |
-
[sys.executable, "-m", "pip", "install", "
|
| 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")
|
|
|
|
| 7 |
os.environ["TORCHDYNAMO_DISABLE"] = "1"
|
| 8 |
|
| 9 |
subprocess.run(
|
| 10 |
+
[sys.executable, "-m", "pip", "install", "flash-attn", "--no-build-isolation"],
|
| 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")
|