From 3dbf1c1b1bc783a1a52e518606d8db9e1a72d3f2 Mon Sep 17 00:00:00 2001 From: Holly Grimm Date: Fri, 17 Jul 2026 16:02:51 -0600 Subject: [PATCH] fix(transcribe): preload pip-installed cuDNN/cuBLAS before WhisperX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ctranslate2 dlopens libcudnn_cnn.so.9 by soname; the nvidia wheels' libs aren't on the loader path, aborting the whisper encoder (SIGABRT) on real speech — VAD-empty audio never hit the encoder, which is why the synthetic smoke test passed. Preload with RTLD_GLOBAL from site-packages before the heavy import. Verified on real audio with diarization. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_015NjFiMWkgrVy4foGF1Zbax --- scripts/transcribe_worklist.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/transcribe_worklist.py b/scripts/transcribe_worklist.py index 5949e5d..eff213b 100644 --- a/scripts/transcribe_worklist.py +++ b/scripts/transcribe_worklist.py @@ -141,6 +141,20 @@ def main() -> int: wav_dir = args.work_dir / "wav" wav_dir.mkdir(exist_ok=True) + # ctranslate2 dlopens cuDNN by soname; pip-installed nvidia wheels are not + # on the loader path, so preload them (RTLD_GLOBAL) or the whisper encoder + # aborts with "Unable to load libcudnn_cnn.so.9". + import ctypes + import site + + for sp in site.getsitepackages(): + for pattern in ("nvidia/cublas/lib/libcublas*.so*", "nvidia/cudnn/lib/libcudnn*.so.9"): + for lib in sorted(Path(sp).glob(pattern)): + try: + ctypes.CDLL(str(lib), mode=ctypes.RTLD_GLOBAL) + except OSError: + pass + # Heavy import deferred so dry runs work without GPU deps loaded. from journal_utilities.transcribe.transcribe import TranscriptionService