patrickvonplaten / data2vec-audio-base-960h-4-gram

huggingface.co
Total runs: 12
24-hour runs: 1
7-day runs: -1
30-day runs: 0
Model's Last Updated: May 24 2022
automatic-speech-recognition

Introduction of data2vec-audio-base-960h-4-gram

Model Details of data2vec-audio-base-960h-4-gram

Data2Vec-Audio-Base-960h

Facebook's Data2Vec

The base model 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.

Paper

Authors: Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, Michael Auli

Abstract

While the general idea of self-supervised learning is identical across modalities, the actual algorithms and objectives differ widely because they were developed with a single modality in mind. To get us closer to general self-supervised learning, we present data2vec, a framework that uses the same learning method for either speech, NLP or computer vision. The core idea is to predict latent representations of the full input data based on a masked view of the input in a self-distillation setup using a standard Transformer architecture. Instead of predicting modality-specific targets such as words, visual tokens or units of human speech which are local in nature, data2vec predicts contextualized latent representations that contain information from the entire input. Experiments on the major benchmarks of speech recognition, image classification, and natural language understanding demonstrate a new state of the art or competitive performance to predominant approaches.

The original model can be found under https://github.com/pytorch/fairseq/tree/main/examples/data2vec .

Pre-Training method

model image

For more information, please take a look at the official paper .

Usage

To transcribe audio files the model can be used as a standalone acoustic model as follows:

 from transformers import Wav2Vec2Processor, Data2VecForCTC
 from datasets import load_dataset
 import torch
 
 # load model and processor
 processor = Wav2Vec2Processor.from_pretrained("facebook/data2vec-audio-base-960h")
 model = Data2VecForCTC.from_pretrained("facebook/data2vec-audio-base-960h")
     
 # load dummy dataset and read soundfiles
 ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
 
 # tokenize
 input_values = processor(ds[0]["audio"]["array"],, return_tensors="pt", padding="longest").input_values  # Batch size 1
 
 # retrieve logits
 logits = model(input_values).logits
 
 # take argmax and decode
 predicted_ids = torch.argmax(logits, dim=-1)
 transcription = processor.batch_decode(predicted_ids)
Evaluation

This code snippet shows how to evaluate facebook/data2vec-audio-base-960h on LibriSpeech's "clean" and "other" test data.

 from transformers import Wav2Vec2Processor, Data2VecForCTC
 from datasets import load_dataset
 import torch
 from jiwer import wer
 
 # load model and processor
 processor = Wav2Vec2Processor.from_pretrained("facebook/data2vec-audio-base-960h").to("cuda")
 model = Data2VecForCTC.from_pretrained("facebook/data2vec-audio-base-960h")
 

librispeech_eval = load_dataset("librispeech_asr", "clean", split="test")

def map_to_pred(batch):
    input_values = processor(batch["audio"]["array"], return_tensors="pt", padding="longest").input_values
    with torch.no_grad():
        logits = model(input_values.to("cuda")).logits

    predicted_ids = torch.argmax(logits, dim=-1)
    transcription = processor.batch_decode(predicted_ids)
    batch["transcription"] = transcription
    return batch

result = librispeech_eval.map(map_to_pred, batched=True, batch_size=1, remove_columns=["audio"])

print("WER:", wer(result["text"], result["transcription"]))

Result (WER) :

"clean" "other"
2.77 7.08

Runs of patrickvonplaten data2vec-audio-base-960h-4-gram on huggingface.co

12
Total runs
1
24-hour runs
0
3-day runs
-1
7-day runs
0
30-day runs

More Information About data2vec-audio-base-960h-4-gram huggingface.co Model

More data2vec-audio-base-960h-4-gram license Visit here:

https://choosealicense.com/licenses/apache-2.0

data2vec-audio-base-960h-4-gram huggingface.co

data2vec-audio-base-960h-4-gram huggingface.co is an AI model on huggingface.co that provides data2vec-audio-base-960h-4-gram's model effect (), which can be used instantly with this patrickvonplaten data2vec-audio-base-960h-4-gram model. huggingface.co supports a free trial of the data2vec-audio-base-960h-4-gram model, and also provides paid use of the data2vec-audio-base-960h-4-gram. Support call data2vec-audio-base-960h-4-gram model through api, including Node.js, Python, http.

data2vec-audio-base-960h-4-gram huggingface.co Url

https://huggingface.co/patrickvonplaten/data2vec-audio-base-960h-4-gram

patrickvonplaten data2vec-audio-base-960h-4-gram online free

data2vec-audio-base-960h-4-gram huggingface.co is an online trial and call api platform, which integrates data2vec-audio-base-960h-4-gram's modeling effects, including api services, and provides a free online trial of data2vec-audio-base-960h-4-gram, you can try data2vec-audio-base-960h-4-gram online for free by clicking the link below.

patrickvonplaten data2vec-audio-base-960h-4-gram online free url in huggingface.co:

https://huggingface.co/patrickvonplaten/data2vec-audio-base-960h-4-gram

data2vec-audio-base-960h-4-gram install

data2vec-audio-base-960h-4-gram is an open source model from GitHub that offers a free installation service, and any user can find data2vec-audio-base-960h-4-gram on GitHub to install. At the same time, huggingface.co provides the effect of data2vec-audio-base-960h-4-gram install, users can directly use data2vec-audio-base-960h-4-gram installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

data2vec-audio-base-960h-4-gram install url in huggingface.co:

https://huggingface.co/patrickvonplaten/data2vec-audio-base-960h-4-gram

Url of data2vec-audio-base-960h-4-gram

data2vec-audio-base-960h-4-gram huggingface.co Url

Provider of data2vec-audio-base-960h-4-gram huggingface.co

patrickvonplaten
ORGANIZATIONS

Other API from patrickvonplaten