Conversation
faster-whisper pulls in the nvidia-cublas-cu12 wheel on Windows, whose cublas64_12.dll lands under site-packages/nvidia/cublas/bin — not on PATH. ctranslate2 loads cuBLAS lazily, so the CUDA backend fails and Hermes silently falls back to CPU (int8); on an RTX 4060 that turned an 8 s clip into ~48 s of wrong-language output with no error surfaced. Register every site-packages/nvidia/<pkg>/bin (cublas, cudnn, cuda_nvrtc, cufft, curand) via os.add_dll_directory and PATH before the model loads. Handles are kept alive (add_dll_directory unregisters on GC). No-op off Windows; idempotent. After: ~2.2 s cold / 0.4 s warm, correct output. Tests: no-op off Windows, directory discovery, PATH augmentation, handle retention, idempotency.
zwn-ai
force-pushed
the
fix/windows-cublas-dll-registration
branch
from
September 14, 2026 07:50
8e923b8 to
96cc3ad
Compare
Contributor
This was referenced Sep 15, 2026
Contributor
This was referenced Sep 15, 2026
Contributor
This was referenced Sep 15, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Windows,
faster-whisperpulls in thenvidia-cublas-cu12wheel (and friends), whosecublas64_12.dll/cublasLt64_12.dllland undersite-packages/nvidia/cublas/bin— a directory that is not onPATH.ctranslate2loads cuBLAS lazily viaLoadLibrary, so with the directory unregistered the CUDA backend fails — frequently only at the firsttranscribe()call, not at model load. Hermes then takes the existing CPU (int8) fallback and runs an order of magnitude slower, with no error surfaced to the user.Measured on an RTX 4060 Laptop, 8 s Chinese clip,
small/float16:Change
_register_windows_cuda_dll_dirs()— called from_load_local_whisper_model()before the model is created — registers everysite-packages/nvidia/<pkg>/binit finds (cublas,cudnn,cuda_nvrtc,cufft,curand) with bothos.add_dll_directoryandPATH, covering the different loader flagsctranslate2may use.The
os.add_dll_directoryhandles are retained for the life of the process, because the directory is unregistered again once the return value is garbage-collected.No-op on non-Windows hosts; idempotent.
Test Plan
ruff check tools/transcription_tools.py tests/tools/test_transcription_tools.py— cleanscripts/run_tests.shon the STT test set — 98 passed, 0 failedPATHaugmentation, handle retention, idempotencyPATH, the CUDA backend loads (2 handles registered) and transcription runs ~2.2 s vs ~48 s before