Spaces:
Running
Running
jefffffff9 Claude Sonnet 4.6 commited on
Commit ·
c154b17
1
Parent(s): 53efeab
Fix: install maliba-ai lazily at runtime, not at build time
Browse filesmaliba-ai 2.0.0b0 has strict pins (soundfile==0.13.1, librosa==0.11.0)
that conflict with our requirements.txt. Removing it from requirements.txt
and installing it via subprocess on the first Bambara TTS call instead.
This pattern is standard for HF Spaces when a dependency has irreconcilable
version conflicts with the rest of the stack.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- requirements.txt +5 -6
- src/tts/waxal_tts.py +19 -3
requirements.txt
CHANGED
|
@@ -21,9 +21,9 @@ huggingface-hub==1.9.0
|
|
| 21 |
peft==0.18.1
|
| 22 |
|
| 23 |
# Audio processing
|
| 24 |
-
librosa
|
| 25 |
-
soundfile
|
| 26 |
-
audiomentations
|
| 27 |
|
| 28 |
# Quantization (CPU: installs fine; 4-bit/8-bit requires GPU at runtime)
|
| 29 |
bitsandbytes==0.49.2
|
|
@@ -52,6 +52,5 @@ scipy==1.15.2
|
|
| 52 |
# Phrase matching (fuzzy match for Whisper mis-transcriptions of Bambara/Fula)
|
| 53 |
rapidfuzz==3.13.0
|
| 54 |
|
| 55 |
-
#
|
| 56 |
-
#
|
| 57 |
-
maliba-ai @ git+https://github.com/MALIBA-AI/bambara-tts.git
|
|
|
|
| 21 |
peft==0.18.1
|
| 22 |
|
| 23 |
# Audio processing
|
| 24 |
+
librosa==0.10.2
|
| 25 |
+
soundfile==0.12.1
|
| 26 |
+
audiomentations==0.43.1
|
| 27 |
|
| 28 |
# Quantization (CPU: installs fine; 4-bit/8-bit requires GPU at runtime)
|
| 29 |
bitsandbytes==0.49.2
|
|
|
|
| 52 |
# Phrase matching (fuzzy match for Whisper mis-transcriptions of Bambara/Fula)
|
| 53 |
rapidfuzz==3.13.0
|
| 54 |
|
| 55 |
+
# maliba-ai is NOT listed here — it has strict conflicting pins (librosa, soundfile).
|
| 56 |
+
# It is installed lazily at runtime on first Bambara TTS call (see src/tts/waxal_tts.py).
|
|
|
src/tts/waxal_tts.py
CHANGED
|
@@ -82,15 +82,31 @@ class WaxalTTSEngine:
|
|
| 82 |
# ── Bambara (MALIBA-AI) ───────────────────────────────────────────────────
|
| 83 |
|
| 84 |
def _load_bambara(self) -> None:
|
|
|
|
|
|
|
| 85 |
try:
|
| 86 |
from maliba_ai.tts.inference import BambaraTTSInference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
with self._lock:
|
| 88 |
self._bam_tts = BambaraTTSInference()
|
| 89 |
self._bam_ready = True
|
| 90 |
logger.info("WaxalTTS: Bambara TTS ready (MALIBA-AI)")
|
| 91 |
-
except ImportError:
|
| 92 |
-
self._bam_error = "maliba-ai package not installed"
|
| 93 |
-
logger.warning("WaxalTTS: %s", self._bam_error)
|
| 94 |
except Exception as exc:
|
| 95 |
self._bam_error = str(exc)
|
| 96 |
logger.error("WaxalTTS: Bambara load failed: %s", exc)
|
|
|
|
| 82 |
# ── Bambara (MALIBA-AI) ───────────────────────────────────────────────────
|
| 83 |
|
| 84 |
def _load_bambara(self) -> None:
|
| 85 |
+
# maliba-ai has strict dependency pins that conflict with the main requirements.txt,
|
| 86 |
+
# so it is NOT listed there. Install it on first use instead.
|
| 87 |
try:
|
| 88 |
from maliba_ai.tts.inference import BambaraTTSInference
|
| 89 |
+
except ImportError:
|
| 90 |
+
logger.info("WaxalTTS: installing maliba-ai (first Bambara TTS call)…")
|
| 91 |
+
try:
|
| 92 |
+
import subprocess, sys
|
| 93 |
+
subprocess.run(
|
| 94 |
+
[sys.executable, "-m", "pip", "install", "-q",
|
| 95 |
+
"git+https://github.com/MALIBA-AI/bambara-tts.git"],
|
| 96 |
+
check=True,
|
| 97 |
+
capture_output=True,
|
| 98 |
+
)
|
| 99 |
+
from maliba_ai.tts.inference import BambaraTTSInference
|
| 100 |
+
except Exception as exc:
|
| 101 |
+
self._bam_error = f"maliba-ai install failed: {exc}"
|
| 102 |
+
logger.error("WaxalTTS: %s", self._bam_error)
|
| 103 |
+
return
|
| 104 |
+
|
| 105 |
+
try:
|
| 106 |
with self._lock:
|
| 107 |
self._bam_tts = BambaraTTSInference()
|
| 108 |
self._bam_ready = True
|
| 109 |
logger.info("WaxalTTS: Bambara TTS ready (MALIBA-AI)")
|
|
|
|
|
|
|
|
|
|
| 110 |
except Exception as exc:
|
| 111 |
self._bam_error = str(exc)
|
| 112 |
logger.error("WaxalTTS: Bambara load failed: %s", exc)
|