đ Wav2Vec-OSR
A finetuned facebook's wav2vec2 model for the speech - to - text module of The Sound Of AI open source research group. The original base model is pretrained and fine - tuned on 960 hours of Librispeech on 16kHz sampled speech audio.
đ Quick Start
The original base model is pretrained and fine - tuned on 960 hours of Librispeech on 16kHz sampled speech audio. When using the model, make sure that your speech input is also sampled at 16Khz.
⨠Features
This model is a finetuned version of facebook's wav2vec2 model, specifically designed for the speech - to - text module of The Sound Of AI open source research group.
đ Documentation
Paper
Authors: Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli
Abstract
We show for the first time that learning powerful representations from speech audio alone followed by fine - tuning on transcribed speech can outperform the best semi - supervised methods while being conceptually simpler. wav2vec 2.0 masks the speech input in the latent space and solves a contrastive task defined over a quantization of the latent representations which are jointly learned. Experiments using all labeled data of Librispeech achieve 1.8/3.3 WER on the clean/other test sets. When lowering the amount of labeled data to one hour, wav2vec 2.0 outperforms the previous state of the art on the 100 hour subset while using 100 times less labeled data. Using just ten minutes of labeled data and pre - training on 53k hours of unlabeled data still achieves 4.8/8.2 WER. This demonstrates the feasibility of speech recognition with limited amounts of labeled data.
The original model can be found under https://github.com/pytorch/fairseq/tree/master/examples/wav2vec#wav2vec - 20.
The original model can also be found in hugging face public model repository [here](https://huggingface.co/facebook/wav2vec2 - base - 960h)
đģ Usage Examples
Basic Usage
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
from datasets import load_dataset
import soundfile as sf
import torch
tokenizer = Wav2Vec2CTCTokenizer.from_pretrained("iamtarun/wav2vec-osr")
processor = Wav2Vec2Processor.from_pretrained("iamtarun/wav2vec-osr")
model = Wav2Vec2ForCTC.from_pretrained("iamtarun/wav2vec-osr")
model = model.eval()
device = "cuda" if torch.cuda.is_available() else "cpu"
model = model.to(device)
def map_to_array(batch):
speech, _ = sf.read(batch["file"])
batch["speech"] = speech
return batch
ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
ds = ds.map(map_to_array)
input_values = processor(ds["speech"][:2], sampling_rate=rate, padding="longest", return_tensors="pt").input_values.to(device)
logits = model(input_values).logits
predicted_ids = torch.argmax(logits, dim =-1)
transcriptions = tokenizer.decode(predicted_ids[0])
print(transcriptions)
đ License
This project is licensed under the apache - 2.0 license.
Property |
Details |
Model Type |
Finetuned facebook's wav2vec2 model |
Training Data |
960 hours of Librispeech on 16kHz sampled speech audio |
â ī¸ Important Note
When using the model, make sure that your speech input is sampled at 16Khz.
đĄ Usage Tip
The provided code is a basic example. You can adjust it according to your specific requirements.