Spaces:
Running on Zero
Running on Zero
Fix numpy 2.x crash: bump tensorboard to 2.18 + np.bool8 compat shim
Browse filestensorboard 2.9 references np.bool8 which was removed in NumPy 2.x, crashing synthesis at import time (via audiotools). Upgraded tensorboard to 2.18.0 and added a numpy compat shim as a safety net for other legacy pinned libraries.
- app.py +14 -0
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -86,6 +86,18 @@ def _download_model() -> Path:
|
|
| 86 |
return MODEL_DIR
|
| 87 |
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
def _warm_up() -> None:
|
| 90 |
"""Prepare dependencies and model files at Space startup, on the CPU.
|
| 91 |
|
|
@@ -94,6 +106,7 @@ def _warm_up() -> None:
|
|
| 94 |
longer.
|
| 95 |
"""
|
| 96 |
try:
|
|
|
|
| 97 |
_install_runtime_dependencies()
|
| 98 |
_download_model()
|
| 99 |
print("[warmup] runtime dependencies and model snapshot are ready", flush=True)
|
|
@@ -143,6 +156,7 @@ def _get_tts():
|
|
| 143 |
if not torch.cuda.is_available():
|
| 144 |
raise RuntimeError("CUDA GPU is not available in this Space.")
|
| 145 |
|
|
|
|
| 146 |
_install_runtime_dependencies()
|
| 147 |
model_dir = _download_model()
|
| 148 |
from indextts.infer_v2 import IndexTTS2
|
|
|
|
| 86 |
return MODEL_DIR
|
| 87 |
|
| 88 |
|
| 89 |
+
def _patch_numpy_compat() -> None:
|
| 90 |
+
"""Restore NumPy aliases removed in NumPy 2.x for legacy pinned libraries.
|
| 91 |
+
|
| 92 |
+
Old tensorboard/keras code (imported via audiotools) references np.bool8,
|
| 93 |
+
which no longer exists in NumPy 2.x, crashing synthesis at import time.
|
| 94 |
+
"""
|
| 95 |
+
import numpy as np
|
| 96 |
+
|
| 97 |
+
if not hasattr(np, "bool8"):
|
| 98 |
+
np.bool8 = np.bool_
|
| 99 |
+
|
| 100 |
+
|
| 101 |
def _warm_up() -> None:
|
| 102 |
"""Prepare dependencies and model files at Space startup, on the CPU.
|
| 103 |
|
|
|
|
| 106 |
longer.
|
| 107 |
"""
|
| 108 |
try:
|
| 109 |
+
_patch_numpy_compat()
|
| 110 |
_install_runtime_dependencies()
|
| 111 |
_download_model()
|
| 112 |
print("[warmup] runtime dependencies and model snapshot are ready", flush=True)
|
|
|
|
| 156 |
if not torch.cuda.is_available():
|
| 157 |
raise RuntimeError("CUDA GPU is not available in this Space.")
|
| 158 |
|
| 159 |
+
_patch_numpy_compat()
|
| 160 |
_install_runtime_dependencies()
|
| 161 |
model_dir = _download_model()
|
| 162 |
from indextts.infer_v2 import IndexTTS2
|
requirements.txt
CHANGED
|
@@ -30,4 +30,4 @@ WeTextProcessing
|
|
| 30 |
requests>=2.28
|
| 31 |
tqdm>=4.67.1
|
| 32 |
protobuf==3.19.6
|
| 33 |
-
tensorboard==2.
|
|
|
|
| 30 |
requests>=2.28
|
| 31 |
tqdm>=4.67.1
|
| 32 |
protobuf==3.19.6
|
| 33 |
+
tensorboard==2.18.0
|