Spaces:
Running on Zero
Running on Zero
Commit ·
4254e77
1
Parent(s): b89b02d
Preload cu13 NVRTC and default Whisper validation on
Browse filesForce-load libnvrtc.so.13 and libnvrtc-builtins.so.13.0 at app startup
with RTLD_GLOBAL. Required because nvidia-cuda-nvrtc-cu12 (pulled in
transitively by nvidia-cudnn-cu12 for faster-whisper) creates
nvidia/cuda_nvrtc/, which torch's _preload_cuda_deps prefers over
nvidia/cu13/ and ends up loading the wrong nvrtc version — breaking
torch's JIT (e.g. Kokoro/voice cloning) with "failed to open
libnvrtc-builtins.so.13.0". Pre-resolving cu13 by absolute path makes
torch's later mistaken preload a no-op; cuDNN-cu12 still loads its own
libnvrtc.so.12 by versioned soname.
Also flip Whisper validation default to on across the three tabs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
app.py
CHANGED
|
@@ -5,6 +5,7 @@
|
|
| 5 |
"""Gradio web UI for Scenema Audio (ZeroGPU, single-process)."""
|
| 6 |
|
| 7 |
import asyncio
|
|
|
|
| 8 |
import io
|
| 9 |
import logging
|
| 10 |
import os
|
|
@@ -15,6 +16,17 @@ import uuid
|
|
| 15 |
from pathlib import Path
|
| 16 |
from xml.sax.saxutils import escape
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
os.environ.setdefault("PYTORCH_CUDA_ALLOC_CONF", "expandable_segments:True")
|
| 19 |
|
| 20 |
# ── Model paths ───────────────────────────────────────────────
|
|
@@ -631,7 +643,7 @@ def create_demo() -> gr.Blocks:
|
|
| 631 |
)
|
| 632 |
gen_validate = gr.Checkbox(
|
| 633 |
label="Whisper Validation",
|
| 634 |
-
value=
|
| 635 |
interactive=True
|
| 636 |
)
|
| 637 |
gen_skip_vc = gr.Checkbox(
|
|
@@ -822,7 +834,7 @@ def create_demo() -> gr.Blocks:
|
|
| 822 |
)
|
| 823 |
vc_validate = gr.Checkbox(
|
| 824 |
label="Whisper Validation",
|
| 825 |
-
value=
|
| 826 |
interactive=True,
|
| 827 |
)
|
| 828 |
vc_btn = gr.Button("Generate with Voice Cloning", variant="primary")
|
|
@@ -901,7 +913,7 @@ def create_demo() -> gr.Blocks:
|
|
| 901 |
)
|
| 902 |
raw_validate = gr.Checkbox(
|
| 903 |
label="Whisper Validation",
|
| 904 |
-
value=
|
| 905 |
interactive=True,
|
| 906 |
)
|
| 907 |
raw_skip_vc = gr.Checkbox(
|
|
|
|
| 5 |
"""Gradio web UI for Scenema Audio (ZeroGPU, single-process)."""
|
| 6 |
|
| 7 |
import asyncio
|
| 8 |
+
import ctypes
|
| 9 |
import io
|
| 10 |
import logging
|
| 11 |
import os
|
|
|
|
| 16 |
from pathlib import Path
|
| 17 |
from xml.sax.saxutils import escape
|
| 18 |
|
| 19 |
+
# Preload cu13 NVRTC so torch's JIT (built against CUDA 13) finds its builtins.
|
| 20 |
+
# nvidia-cuda-nvrtc-cu12 (transitive dep of nvidia-cudnn-cu12, installed for
|
| 21 |
+
# faster-whisper) creates nvidia/cuda_nvrtc/, which torch's preload prefers over
|
| 22 |
+
# nvidia/cu13/ — making torch load the wrong nvrtc version. RTLD_GLOBAL here puts
|
| 23 |
+
# cu13 in memory first; cuDNN-cu12 still dlopens its own libnvrtc.so.12 by soname.
|
| 24 |
+
_CU13_LIB = "/usr/local/lib/python3.12/site-packages/nvidia/cu13/lib"
|
| 25 |
+
for _lib in ("libnvrtc-builtins.so.13.0", "libnvrtc.so.13"):
|
| 26 |
+
_path = os.path.join(_CU13_LIB, _lib)
|
| 27 |
+
if os.path.exists(_path):
|
| 28 |
+
ctypes.CDLL(_path, mode=ctypes.RTLD_GLOBAL)
|
| 29 |
+
|
| 30 |
os.environ.setdefault("PYTORCH_CUDA_ALLOC_CONF", "expandable_segments:True")
|
| 31 |
|
| 32 |
# ── Model paths ───────────────────────────────────────────────
|
|
|
|
| 643 |
)
|
| 644 |
gen_validate = gr.Checkbox(
|
| 645 |
label="Whisper Validation",
|
| 646 |
+
value=True,
|
| 647 |
interactive=True
|
| 648 |
)
|
| 649 |
gen_skip_vc = gr.Checkbox(
|
|
|
|
| 834 |
)
|
| 835 |
vc_validate = gr.Checkbox(
|
| 836 |
label="Whisper Validation",
|
| 837 |
+
value=True,
|
| 838 |
interactive=True,
|
| 839 |
)
|
| 840 |
vc_btn = gr.Button("Generate with Voice Cloning", variant="primary")
|
|
|
|
| 913 |
)
|
| 914 |
raw_validate = gr.Checkbox(
|
| 915 |
label="Whisper Validation",
|
| 916 |
+
value=True,
|
| 917 |
interactive=True,
|
| 918 |
)
|
| 919 |
raw_skip_vc = gr.Checkbox(
|