boumehdi commited on
Commit
361f4f3
1 Parent(s): 7af6364

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ary
3
+ metrics:
4
+ - wer
5
+ tags:
6
+ - audio
7
+ - automatic-speech-recognition
8
+ - speech
9
+ - xlsr-fine-tuning-week
10
+ license: apache-2.0
11
+ model-index:
12
+ - name: XLSR Wav2Vec2 Moroccan Arabic dialect by Boumehdi
13
+ results:
14
+ - task:
15
+ name: Speech Recognition
16
+ type: automatic-speech-recognition
17
+ metrics:
18
+ - name: Test WER
19
+ type: wer
20
+ value: 0.496
21
+ ---
22
+ # Wav2Vec2-Large-XLSR-53-Moroccan
23
+
24
+ Fine-tuned [othrif/wav2vec2-large-xlsr-moroccan](https://huggingface.co/othrif/wav2vec2-large-xlsr-moroccan) on 6 hours of labelled speech
25
+
26
+ ## Usage
27
+
28
+ The model can be used directly (without a language model) as follows:
29
+
30
+ ```python
31
+ import librosa
32
+ import torch
33
+ from transformers import Wav2Vec2CTCTokenizer, Wav2Vec2ForCTC, Wav2Vec2Processor, TrainingArguments, Wav2Vec2FeatureExtractor, Trainer
34
+
35
+ tokenizer = Wav2Vec2CTCTokenizer("./vocab.json", unk_token="[UNK]", pad_token="[PAD]", word_delimiter_token="|")
36
+ processor = Wav2Vec2Processor.from_pretrained('boumehdi/wav2vec2-large-xlsr-moroccan-darija-v1', tokenizer=tokenizer)
37
+ model=Wav2Vec2ForCTC.from_pretrained('boumehdi/wav2vec2-large-xlsr-moroccan-darija-v1')
38
+
39
+
40
+ # load the audio data (use your own wav file here!)
41
+ input_audio, sr = librosa.load('file.wav', sr=16000)
42
+
43
+ # tokenize
44
+ input_values = processor(input_audio, return_tensors="pt", padding=True).input_values
45
+
46
+ # retrieve logits
47
+ logits = model(input_values).logits
48
+
49
+ tokens=torch.argmax(logits, axis=-1)
50
+
51
+ # decode using n-gram
52
+ transcription = tokenizer.batch_decode(tokens)
53
+
54
+ # print the output
55
+ print(transcription)
56
+ ```
57
+
58
+ ## Evaluation
59
+
60
+
61
+ **Test Result**: 49.68