patrickvonplaten commited on
Commit
b76675f
1 Parent(s): 52df200

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +59 -0
README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ datasets:
4
+ - librispeech_asr
5
+ tags:
6
+ - speech
7
+
8
+ license: apache-2.0
9
+ ---
10
+
11
+ # Data2Vec-Audio-Large-100h
12
+
13
+ [Facebook's Data2Vec](https://ai.facebook.com/research/data2vec-a-general-framework-for-self-supervised-learning-in-speech-vision-and-language/)
14
+
15
+ The large model pretrained and fine-tuned on 100 hours of Librispeech on 16kHz sampled speech audio. When using the model
16
+ make sure that your speech input is also sampled at 16Khz.
17
+
18
+ [Paper](https://arxiv.org/abs/2202.03555)
19
+
20
+ Authors: Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, Michael Auli
21
+
22
+ **Abstract**
23
+
24
+ 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.
25
+
26
+ The original model can be found under https://github.com/pytorch/fairseq/tree/main/examples/data2vec .
27
+
28
+ # Pre-Training method
29
+
30
+ ![model image](https://raw.githubusercontent.com/patrickvonplaten/scientific_images/master/data2vec.png)
31
+
32
+ For more information, please take a look at the [official paper](https://arxiv.org/abs/2202.03555).
33
+
34
+ # Usage
35
+
36
+ To transcribe audio files the model can be used as a standalone acoustic model as follows:
37
+
38
+ ```python
39
+ from transformers import Wav2Vec2Processor, Data2VecForCTC
40
+ from datasets import load_dataset
41
+ import torch
42
+
43
+ # load model and processor
44
+ processor = Wav2Vec2Processor.from_pretrained("facebook/data2vec-audio-large-100h")
45
+ model = Data2VecForCTC.from_pretrained("facebook/data2vec-audio-large-100h")
46
+
47
+ # load dummy dataset and read soundfiles
48
+ ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
49
+
50
+ # tokenize
51
+ input_values = processor(ds[0]["audio"]["array"],, return_tensors="pt", padding="longest").input_values # Batch size 1
52
+
53
+ # retrieve logits
54
+ logits = model(input_values).logits
55
+
56
+ # take argmax and decode
57
+ predicted_ids = torch.argmax(logits, dim=-1)
58
+ transcription = processor.batch_decode(predicted_ids)
59
+ ```