I’m trying to use wav2vec2 (XLSR model) without any success:
import transformers
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import librosa
import torchwav2vec2_processor = Wav2Vec2Processor.from_pretrained(“facebook/wav2vec2-large-xlsr-53”)
wav2vec2_model = Wav2Vec2ForCTC.from_pretrained(“facebook/wav2vec2-large-xlsr-53”)file_name = “test.wav”
speech, sr = librosa.load(file_name, sr=16000)
input_values = wav2vec2_processor(speech, sampling_rate=16000, return_tensors=“pt”).input_valueslogits = wav2vec2_model(input_values).logits
Error:
OSError: Can’t load tokenizer for ‘facebook/wav2vec2-large-xlsr-53’. If you were trying to load it from ‘Models - Hugging Face’, make sure you don’t have a local directory with the same name. Otherwise, make sure ‘facebook/wav2vec2-large-xlsr-53’ is the correct path to a directory containing all relevant files for a Wav2Vec2CTCTokenizer tokenizer.