Spaces:
Sleeping
Sleeping
ibcplateformes Claude Opus 4.6 commited on
Commit ·
a7c6af3
1
Parent(s): 1a64668
Fix missing 'munch' dep + add detailed error wrapper for ZeroGPU
Browse files- Add munch and pydub to requirements.txt (required by Seed-VC modules)
- Add sys.path + chdir fix in GPU worker to find bundled modules
- Wrap convert_voice in try/except to surface full error details
instead of just 'ModuleNotFoundError' class name from ZeroGPU
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- pipeline/inference.py +22 -0
- requirements.txt +2 -0
pipeline/inference.py
CHANGED
|
@@ -186,6 +186,28 @@ def convert_voice(
|
|
| 186 |
Convert voice using Seed-VC zero-shot singing voice conversion.
|
| 187 |
Based on the official app_svc.py voice_conversion function.
|
| 188 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
import soundfile as sf
|
| 190 |
|
| 191 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
|
|
|
| 186 |
Convert voice using Seed-VC zero-shot singing voice conversion.
|
| 187 |
Based on the official app_svc.py voice_conversion function.
|
| 188 |
"""
|
| 189 |
+
# CRITICAL: Ensure app directory is in sys.path for ZeroGPU worker
|
| 190 |
+
app_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 191 |
+
if app_dir not in sys.path:
|
| 192 |
+
sys.path.insert(0, app_dir)
|
| 193 |
+
# Also ensure current working directory is the app directory
|
| 194 |
+
os.chdir(app_dir)
|
| 195 |
+
|
| 196 |
+
try:
|
| 197 |
+
return _convert_voice_impl(
|
| 198 |
+
audio_path, reference_path, pitch, index_rate, diffusion_steps
|
| 199 |
+
)
|
| 200 |
+
except Exception as e:
|
| 201 |
+
import traceback
|
| 202 |
+
tb = traceback.format_exc()
|
| 203 |
+
# Re-raise as RuntimeError with full details so ZeroGPU forwards the message
|
| 204 |
+
raise RuntimeError("Seed-VC error: {}: {}\n{}".format(
|
| 205 |
+
type(e).__name__, str(e), tb[-800:]
|
| 206 |
+
))
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
def _convert_voice_impl(audio_path, reference_path, pitch, index_rate, diffusion_steps):
|
| 210 |
+
"""Actual conversion implementation (called from GPU-decorated wrapper)."""
|
| 211 |
import soundfile as sf
|
| 212 |
|
| 213 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
requirements.txt
CHANGED
|
@@ -22,10 +22,12 @@ demucs
|
|
| 22 |
# Seed-VC dependencies
|
| 23 |
einops
|
| 24 |
transformers>=4.40.0
|
|
|
|
| 25 |
pyyaml
|
| 26 |
requests
|
| 27 |
tqdm
|
| 28 |
numba
|
|
|
|
| 29 |
|
| 30 |
# Vocoder
|
| 31 |
bigvgan
|
|
|
|
| 22 |
# Seed-VC dependencies
|
| 23 |
einops
|
| 24 |
transformers>=4.40.0
|
| 25 |
+
munch
|
| 26 |
pyyaml
|
| 27 |
requests
|
| 28 |
tqdm
|
| 29 |
numba
|
| 30 |
+
pydub
|
| 31 |
|
| 32 |
# Vocoder
|
| 33 |
bigvgan
|