Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,23 @@ subprocess.run([sys.executable, "-m", "pip", "install", "xformers==0.0.32.post2"
|
|
| 12 |
# Install video preprocessing dependencies (pose/canny/depth extraction)
|
| 13 |
subprocess.run([sys.executable, "-m", "pip", "install", "controlnet_aux", "imageio[ffmpeg]"], check=False)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# Clone LTX-2 repo and install packages
|
| 16 |
LTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"
|
| 17 |
LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")
|
|
|
|
| 12 |
# Install video preprocessing dependencies (pose/canny/depth extraction)
|
| 13 |
subprocess.run([sys.executable, "-m", "pip", "install", "controlnet_aux", "imageio[ffmpeg]"], check=False)
|
| 14 |
|
| 15 |
+
# Reinstall torchaudio to match the torch CUDA version on this space.
|
| 16 |
+
# controlnet_aux or other deps can pull in a CPU-only torchaudio that conflicts
|
| 17 |
+
# with the pre-installed CUDA torch, causing "undefined symbol" errors.
|
| 18 |
+
_tv = subprocess.run([sys.executable, "-c", "import torch; print(torch.__version__)"],
|
| 19 |
+
capture_output=True, text=True)
|
| 20 |
+
if _tv.returncode == 0:
|
| 21 |
+
_full_ver = _tv.stdout.strip()
|
| 22 |
+
# Extract CUDA suffix if present (e.g. "2.7.0+cu124" -> "cu124")
|
| 23 |
+
_cuda_suffix = _full_ver.split("+")[-1] if "+" in _full_ver else "cu124"
|
| 24 |
+
_base_ver = _full_ver.split("+")[0]
|
| 25 |
+
print(f"Detected torch {_full_ver}, reinstalling matching torchaudio...")
|
| 26 |
+
subprocess.run([
|
| 27 |
+
sys.executable, "-m", "pip", "install", "--force-reinstall", "--no-deps",
|
| 28 |
+
f"torchaudio=={_base_ver}",
|
| 29 |
+
"--index-url", f"https://download.pytorch.org/whl/{_cuda_suffix}",
|
| 30 |
+
], check=False)
|
| 31 |
+
|
| 32 |
# Clone LTX-2 repo and install packages
|
| 33 |
LTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"
|
| 34 |
LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")
|