From cc11d147ce9b46270f3bd318c41220b4316b6b29 Mon Sep 17 00:00:00 2001 From: bnitsan <88460625+bnitsan@users.noreply.github.com> Date: Wed, 1 Jan 2025 14:22:27 +0200 Subject: [PATCH] feat: use model_dir as cache_dir for wav2vec2 (#681) --- whisperx/alignment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whisperx/alignment.py b/whisperx/alignment.py index 5ff09d9c..42d9b176 100644 --- a/whisperx/alignment.py +++ b/whisperx/alignment.py @@ -85,8 +85,8 @@ def load_align_model(language_code, device, model_name=None, model_dir=None): align_dictionary = {c.lower(): i for i, c in enumerate(labels)} else: try: - processor = Wav2Vec2Processor.from_pretrained(model_name) - align_model = Wav2Vec2ForCTC.from_pretrained(model_name) + processor = Wav2Vec2Processor.from_pretrained(model_name, cache_dir=model_dir) + align_model = Wav2Vec2ForCTC.from_pretrained(model_name, cache_dir=model_dir) except Exception as e: print(e) print(f"Error loading model from huggingface, check https://huggingface.co/models for finetuned wav2vec2.0 models")