openslr/librispeech_asr
Viewer • Updated • 585k • 63k • 234
How to use takehika/wav2vec2-librispeech-en-finetuned with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("automatic-speech-recognition", model="takehika/wav2vec2-librispeech-en-finetuned") # Load model directly
from transformers import AutoProcessor, AutoModelForCTC
processor = AutoProcessor.from_pretrained("takehika/wav2vec2-librispeech-en-finetuned")
model = AutoModelForCTC.from_pretrained("takehika/wav2vec2-librispeech-en-finetuned", device_map="auto")Fine-tuned facebook/wav2vec2-large-xlsr-53 for English ASR using LibriSpeech (openslr/librispeech_asr, clean, train.360).
facebook/wav2vec2-large-xlsr-53openslr/librispeech_asr0.0691import torch
import librosa
from transformers import AutoProcessor, AutoModelForCTC
repo_id = "takehika/wav2vec2-librispeech-en-finetuned"
processor = AutoProcessor.from_pretrained(repo_id)
model = AutoModelForCTC.from_pretrained(repo_id)
speech, _ = librosa.load("sample.wav", sr=16_000)
inputs = processor(speech, sampling_rate=16_000, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
pred_ids = torch.argmax(logits, dim=-1)
text = processor.batch_decode(pred_ids)[0]
print(text)
HELLO, WORLD. I'M JOHN.hello world im johnopenslr/librispeech_asrcleantrain.360 (104,014 samples)validation (2,703 samples)test (2,620 samples)82 (effective 16)2e-5constant_with_warmup5005000.0691facebook/wav2vec2-large-xlsr-53: Apache-2.0openslr/librispeech_asr: CC BY 4.0References:
@inproceedings{panayotov2015librispeech,
title={Librispeech: an ASR corpus based on public domain audio books},
author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},
booktitle={Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on},
pages={5206--5210},
year={2015},
organization={IEEE}
}
Base model
facebook/wav2vec2-large-xlsr-53