Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9de90e2664 | ||
|
|
d32ec3e301 | ||
|
|
db317c358b | ||
|
|
6e1d1caaf4 | ||
|
|
c8f7597345 | ||
|
|
5925e5f8c7 | ||
|
|
617835dc27 | ||
|
|
92227e7412 | ||
|
|
0fa81b31f1 | ||
|
|
505bd9c0b5 | ||
|
|
895e5a8493 | ||
|
|
a58ff9cb20 | ||
|
|
d13171cdde |
No files matched your search
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
||||
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# Troubleshooting cuDNN Loading Errors
|
||||
|
||||
This guide helps resolve common cuDNN-related errors when running WhisperX on GPU. These issues typically occur when the system can't locate cuDNN libraries or finds conflicting versions.
|
||||
|
||||
## Unable to Load cuDNN Libraries
|
||||
|
||||
If you encounter the following error when running WhisperX:
|
||||
|
||||
`Unable to load any of {libcudnn_cnn.so.9.1.0, libcudnn_cnn.so.9.1, libcudnn_cnn.so.9, libcudnn_cnn.so}`
|
||||
|
||||
This means the cuDNN libraries are installed (via whisperx dependencies) but aren't in a location where the system's dynamic linker can find them.
|
||||
|
||||
### Solution 1: Add to LD_LIBRARY_PATH (Recommended)
|
||||
|
||||
Add this at the start of your Python script or notebook:
|
||||
|
||||
```python
|
||||
import os
|
||||
|
||||
# Get current LD_LIBRARY_PATH
|
||||
original = os.environ.get("LD_LIBRARY_PATH", "")
|
||||
|
||||
cudnn_path = "/usr/local/lib/python3.12/dist-packages/nvidia/cudnn/lib/"
|
||||
os.environ['LD_LIBRARY_PATH'] = original + ":" + cudnn_path
|
||||
```
|
||||
|
||||
**Note:** Adjust the Python version (`python3.12`) to match your environment.
|
||||
|
||||
### Solution 2: Symlink to LD_LIBRARY_PATH Directory
|
||||
|
||||
If Solution 1 didn't work and you still get the "unable to load" error, symlink the libraries to a directory that's already in your `LD_LIBRARY_PATH`:
|
||||
|
||||
1. Check what's in your LD_LIBRARY_PATH: `echo "$LD_LIBRARY_PATH"`
|
||||
2. Assuming that there is only one path set.
|
||||
Symlink the downloaded libcudnn files to that path:
|
||||
`ln -s /usr/local/lib/python3.12/dist-packages/nvidia/cudnn/lib/libcudnn* "$LD_LIBRARY_PATH"/`
|
||||
|
||||
**Note:** If `LD_LIBRARY_PATH` contains multiple paths (separated by `:`), pick one directory and use it instead of `"$LD_LIBRARY_PATH"`. For example: `/usr/lib/x86_64-linux-gnu/`
|
||||
|
||||
## cuDNN Version Incompatibility
|
||||
|
||||
If you encounter this error:
|
||||
|
||||
```
|
||||
RuntimeError: cuDNN version incompatibility: PyTorch was compiled against (9, 10, 2) but found runtime version (9, 2, 1)
|
||||
```
|
||||
|
||||
This means PyTorch is finding a different cuDNN version than the one it was compiled with. **PyTorch comes bundled with its own cuDNN**, but a conflicting cuDNN in `LD_LIBRARY_PATH` is taking precedence.
|
||||
|
||||
### Solution: Remove Conflicting cuDNN from Path
|
||||
|
||||
Check if there's a conflicting cuDNN path:
|
||||
|
||||
```bash
|
||||
echo $LD_LIBRARY_PATH
|
||||
```
|
||||
|
||||
If you see paths pointing to older cuDNN installations (e.g., system-installed cuDNN or manually downloaded), try one of these:
|
||||
|
||||
**Option 1: Clear LD_LIBRARY_PATH temporarily**
|
||||
|
||||
```python
|
||||
import os
|
||||
# Let PyTorch use its bundled cuDNN
|
||||
os.environ.pop('LD_LIBRARY_PATH', None)
|
||||
```
|
||||
|
||||
**Option 2: Set LD_LIBRARY_PATH to only the correct version**
|
||||
|
||||
```python
|
||||
import os
|
||||
# Point only to the cuDNN that matches PyTorch's compiled version
|
||||
os.environ['LD_LIBRARY_PATH'] = "/usr/local/lib/python3.12/dist-packages/nvidia/cudnn/lib/"
|
||||
```
|
||||
|
||||
**Note:** This error is unlikely on a clean install. If it occurs anyway, [open an issue](https://github.com/m-bain/whisperX/issues). If you've modified system libraries or CUDA/cuDNN, the options above should help resolve most cases.
|
||||
+9
-7
@@ -2,10 +2,10 @@
|
||||
urls = { repository = "https://github.com/m-bain/whisperx" }
|
||||
authors = [{ name = "Max Bain" }]
|
||||
name = "whisperx"
|
||||
version = "3.6.0"
|
||||
version = "3.7.5"
|
||||
description = "Time-Accurate Automatic Speech Recognition using Whisper."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9, <3.13"
|
||||
requires-python = ">=3.9, <3.14"
|
||||
license = { text = "BSD-2-Clause" }
|
||||
|
||||
dependencies = [
|
||||
@@ -13,15 +13,17 @@ dependencies = [
|
||||
"faster-whisper>=1.1.1",
|
||||
"nltk>=3.9.1",
|
||||
# Restrict numpy, onnxruntime, pandas, av to be compatible with Python 3.9
|
||||
"numpy>=2.0.2,<2.1.0",
|
||||
"onnxruntime>=1.19,<1.20.0",
|
||||
"numpy>=2.0.2,<2.1.0; python_version <'3.13'",
|
||||
"onnxruntime>=1.19,<1.20.0; python_version <'3.10'",
|
||||
"pandas>=2.2.3,<2.3.0",
|
||||
"av<16.0.0",
|
||||
"numpy>=2.1.0,<2.3.0; python_version >='3.13'",
|
||||
"pyannote-audio>=3.3.2,<4.0.0",
|
||||
"torch>=2.7.1",
|
||||
"torchaudio",
|
||||
"huggingface-hub<1.0.0",
|
||||
"torch~=2.8.0",
|
||||
"torchaudio~=2.8.0",
|
||||
"transformers>=4.48.0",
|
||||
"triton>=3.3.0; sys_platform == 'linux'" # only install triton on Linux
|
||||
"triton>=3.3.0; sys_platform == 'linux' and platform_machine == 'x86_64'" # only install triton on x86_64 Linux
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ def cli():
|
||||
parser.add_argument("--suppress_numerals", action="store_true", help="whether to suppress numeric symbols and currency symbols during sampling, since wav2vec2 cannot align them correctly")
|
||||
|
||||
parser.add_argument("--initial_prompt", type=str, default=None, help="optional text to provide as a prompt for the first window.")
|
||||
parser.add_argument("--hotwords", type=str, default=None, help="hotwords/hint phrases to the model (e.g. \"WhisperX, PyAnnote, GPU\"); improves recognition of rare/technical terms")
|
||||
parser.add_argument("--condition_on_previous_text", type=str2bool, default=False, help="if True, provide the previous output of the model as a prompt for the next window; disabling may make the text inconsistent across windows, but the model becomes less prone to getting stuck in a failure loop")
|
||||
parser.add_argument("--fp16", type=str2bool, default=True, help="whether to perform inference in fp16; True by default")
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import torchaudio
|
||||
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
||||
|
||||
from whisperx.audio import SAMPLE_RATE, load_audio
|
||||
from whisperx.utils import interpolate_nans
|
||||
from whisperx.utils import interpolate_nans, PUNKT_LANGUAGES
|
||||
from whisperx.schema import (
|
||||
AlignedTranscriptionResult,
|
||||
SingleSegment,
|
||||
@@ -73,6 +73,7 @@ DEFAULT_ALIGN_MODELS_HF = {
|
||||
"ka": "xsway/wav2vec2-large-xlsr-georgian",
|
||||
"lv": "jimregan/wav2vec2-large-xlsr-latvian-cv",
|
||||
"tl": "Khalsuu/filipino-wav2vec2-l-xls-r-300m-official",
|
||||
"sv": "KBLab/wav2vec2-large-voxrex-swedish",
|
||||
}
|
||||
|
||||
|
||||
@@ -191,11 +192,13 @@ def align(
|
||||
clean_wdx.append(wdx)
|
||||
|
||||
|
||||
# Use language-specific Punkt model if available otherwise we fallback to English.
|
||||
punkt_lang = PUNKT_LANGUAGES.get(model_lang, 'english')
|
||||
try:
|
||||
sentence_splitter = nltk_load('tokenizers/punkt/english.pickle')
|
||||
sentence_splitter = nltk_load(f'tokenizers/punkt_tab/{punkt_lang}.pickle')
|
||||
except LookupError:
|
||||
nltk.download('punkt_tab', quiet=True)
|
||||
sentence_splitter = nltk_load('tokenizers/punkt/english.pickle')
|
||||
sentence_splitter = nltk_load(f'tokenizers/punkt_tab/{punkt_lang}.pickle')
|
||||
sentence_spans = list(sentence_splitter.span_tokenize(text))
|
||||
|
||||
segment_data[sdx] = {
|
||||
|
||||
@@ -106,6 +106,7 @@ def transcribe_task(args: dict, parser: argparse.ArgumentParser):
|
||||
"no_speech_threshold": args.pop("no_speech_threshold"),
|
||||
"condition_on_previous_text": False,
|
||||
"initial_prompt": args.pop("initial_prompt"),
|
||||
"hotwords": args.pop("hotwords"),
|
||||
"suppress_tokens": [int(x) for x in args.pop("suppress_tokens").split(",")],
|
||||
"suppress_numerals": args.pop("suppress_numerals"),
|
||||
}
|
||||
|
||||
+25
-2
@@ -126,6 +126,29 @@ TO_LANGUAGE_CODE = {
|
||||
|
||||
LANGUAGES_WITHOUT_SPACES = ["ja", "zh"]
|
||||
|
||||
# Mapping of language codes to NLTK Punkt tokenizer model names
|
||||
PUNKT_LANGUAGES = {
|
||||
'cs': 'czech',
|
||||
'da': 'danish',
|
||||
'de': 'german',
|
||||
'el': 'greek',
|
||||
'en': 'english',
|
||||
'es': 'spanish',
|
||||
'et': 'estonian',
|
||||
'fi': 'finnish',
|
||||
'fr': 'french',
|
||||
'it': 'italian',
|
||||
'nl': 'dutch',
|
||||
'no': 'norwegian',
|
||||
'pl': 'polish',
|
||||
'pt': 'portuguese',
|
||||
'sl': 'slovene',
|
||||
'sv': 'swedish',
|
||||
'tr': 'turkish',
|
||||
"ml": "malayalam",
|
||||
"ru": "russian",
|
||||
}
|
||||
|
||||
system_encoding = sys.getdefaultencoding()
|
||||
|
||||
if system_encoding != "utf-8":
|
||||
@@ -410,7 +433,7 @@ class WriteJSON(ResultWriter):
|
||||
|
||||
def get_writer(
|
||||
output_format: str, output_dir: str
|
||||
) -> Callable[[dict, TextIO, dict], None]:
|
||||
) -> Callable[[dict, str, dict], None]:
|
||||
writers = {
|
||||
"txt": WriteTXT,
|
||||
"vtt": WriteVTT,
|
||||
@@ -425,7 +448,7 @@ def get_writer(
|
||||
if output_format == "all":
|
||||
all_writers = [writer(output_dir) for writer in writers.values()]
|
||||
|
||||
def write_all(result: dict, file: TextIO, options: dict):
|
||||
def write_all(result: dict, file: str, options: dict):
|
||||
for writer in all_writers:
|
||||
writer(result, file, options)
|
||||
|
||||
|
||||
Reference in new issue
Block a user