kingabzpro commited on
Commit
128676c
1 Parent(s): 4264f40

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -16
README.md CHANGED
@@ -1,12 +1,35 @@
1
  ---
 
 
 
2
  license: apache-2.0
3
  tags:
4
- - generated_from_trainer
 
5
  datasets:
6
- - common_voice
 
 
 
7
  model-index:
8
  - name: wav2vec2-large-xls-r-300m-Tatar
9
- results: []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
 
12
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
@@ -20,19 +43,32 @@ It achieves the following results on the evaluation set:
20
  - Wer: 0.4263
21
  - Cer: 0.1117
22
 
23
- ## Model description
24
-
25
- More information needed
26
-
27
- ## Intended uses & limitations
28
-
29
- More information needed
30
-
31
- ## Training and evaluation data
32
-
33
- More information needed
34
-
35
- ## Training procedure
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  ### Training hyperparameters
38
 
 
1
  ---
2
+ language:
3
+ - tt
4
+
5
  license: apache-2.0
6
  tags:
7
+ - automatic-speech-recognition
8
+ - robust-speech-event
9
  datasets:
10
+ - mozilla-foundation/common_voice_8_0
11
+ metrics:
12
+ - wer
13
+ - cer
14
  model-index:
15
  - name: wav2vec2-large-xls-r-300m-Tatar
16
+ results:
17
+ - task:
18
+ type: automatic-speech-recognition # Required. Example: automatic-speech-recognition
19
+ name: Speech Recognition # Optional. Example: Speech Recognition
20
+ dataset:
21
+ type: mozilla-foundation/common_voice_8_0 # Required. Example: common_voice. Use dataset id from https://hf.co/datasets
22
+ name: Common Voice tt # Required. Example: Common Voice zh-CN
23
+ args: tt # Optional. Example: zh-CN
24
+ metrics:
25
+ - type: wer # Required. Example: wer
26
+ value: 42.82 # Required. Example: 20.90
27
+ name: Test WER With LM # Optional. Example: Test WER
28
+
29
+ - type: cer # Required. Example: wer
30
+ value: 11.24 # Required. Example: 20.90
31
+ name: Test CER With LM # Optional. Example: Test WER
32
+
33
  ---
34
 
35
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
 
43
  - Wer: 0.4263
44
  - Cer: 0.1117
45
 
46
+ #### Evaluation Commands
47
+ 1. To evaluate on `mozilla-foundation/common_voice_8_0` with split `test`
48
+
49
+ ```bash
50
+ python eval.py --model_id kingabzpro/wav2vec2-large-xls-r-300m-Tatar --dataset mozilla-foundation/common_voice_8_0 --config tt --split test
51
+ ```
52
+
53
+ ### Inference With LM
54
+
55
+ ```python
56
+ import torch
57
+ from datasets import load_dataset
58
+ from transformers import AutoModelForCTC, AutoProcessor
59
+ import torchaudio.functional as F
60
+ model_id = "kingabzpro/wav2vec2-large-xls-r-300m-Tatar"
61
+ sample_iter = iter(load_dataset("mozilla-foundation/common_voice_8_0", "tt", split="test", streaming=True, use_auth_token=True))
62
+ sample = next(sample_iter)
63
+ resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), 48_000, 16_000).numpy()
64
+ model = AutoModelForCTC.from_pretrained(model_id)
65
+ processor = AutoProcessor.from_pretrained(model_id)
66
+ input_values = processor(resampled_audio, return_tensors="pt").input_values
67
+ with torch.no_grad():
68
+ logits = model(input_values).logits
69
+ transcription = processor.batch_decode(logits.numpy()).text
70
+
71
+ ```
72
 
73
  ### Training hyperparameters
74