Skip to content

Commit

Permalink
feat: use model_dir as cache_dir for wav2vec2 (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnitsan authored Jan 1, 2025
1 parent 0fdb55d commit 1c6d932
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions whisperx/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 1c6d932

Please sign in to comment.