vrashad commited on
Commit
1258f2f
·
verified ·
1 Parent(s): f1c4033

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -13
README.md CHANGED
@@ -9,6 +9,7 @@ tags:
9
  - ctc
10
  - fastconformer
11
  - kenlm
 
12
  - azerbaijani
13
  ---
14
 
@@ -23,28 +24,54 @@ Azerbaijani speech recognition for CPU: FastConformer-CTC (18 layers, d512) with
23
  [LocalDoc/fleurs-azerbaijani-asr](https://huggingface.co/datasets/LocalDoc/fleurs-azerbaijani-asr), not used for training. Reference: `text_norm`
24
  (numbers as words). WER and CER ignore case and punctuation. Clips with `norm_status = failed` are excluded (11 of 3977).
25
 
26
- | split | clips | hours | no LM: WER / CER | KenLM: WER / CER |
27
- |---|---|---|---|---|
28
- | test | 914 | 3.20 | 16.34 / 4.75 | **10.98 / 3.57** |
29
- | dev | 397 | 1.34 | 16.52 / 4.75 | 11.05 / 3.50 |
30
- | train | 2655 | 9.27 | 15.82 / 4.80 | 11.30 / 3.78 |
31
- | all | 3966 | 13.81 | 16.01 / 4.79 | 11.20 / 3.70 |
 
 
32
 
33
  - Decoder weights (`alpha` 1.0, `beta` 2.0) were chosen on the FLEURS dev split from 8 pairs, so the test row is the one to quote.
 
34
  - Sentences of the FLEURS test split were excluded from the KenLM text; dev and train sentences were not.
35
  - Internal validation, no LM, on our own data mix: WER 13.48 / CER 6.01.
36
 
37
- Speed, PyTorch float32 on one i7-12700K, in Docker, times faster than real time, for the acoustic model plus KenLM:
38
 
39
- | threads | speed | measured on |
40
- |---|---|---|
41
- | 1 | 12.7x | an earlier checkpoint of this model, 100 clips |
42
- | 8 | ~45x | this checkpoint, all FLEURS |
 
 
43
 
44
- The machine had other load during the runs, so these are rough. KenLM takes about 1.5% of the time. ONNX runtimes were not measured.
45
 
46
  ## Use
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  Needs [balbal](https://github.com/erayyap/balbal) at commit `1be9f88b77c63fbafa7713c6e46e79847f6c390e` (Python 3.11-3.12, Linux; install
49
  `requirements/full.txt`, then run `inference/build_native.py`). Copy this repository's `refiner.json` over balbal's
50
  `configs/balbal-v2-manas/refiner.json`: this model's memory size differs from balbal's default, and the weights will not load otherwise.
@@ -61,7 +88,7 @@ print(engine.transcribe(read_audio("speech.mp3"), itn=False)["text"])
61
 
62
  Keep `itn=False`: balbal's number conversion is Turkish. Long audio is cut into fixed 30 s chunks.
63
 
64
- To use the model without the KenLM, take the argmax of the CTC output instead of `Engine`: without an LM, WER on FLEURS test is 16.34. The `lm/` folder is then not needed.
65
 
66
  ## Training
67
 
 
9
  - ctc
10
  - fastconformer
11
  - kenlm
12
+ - onnx
13
  - azerbaijani
14
  ---
15
 
 
24
  [LocalDoc/fleurs-azerbaijani-asr](https://huggingface.co/datasets/LocalDoc/fleurs-azerbaijani-asr), not used for training. Reference: `text_norm`
25
  (numbers as words). WER and CER ignore case and punctuation. Clips with `norm_status = failed` are excluded (11 of 3977).
26
 
27
+ WER / CER:
28
+
29
+ | split | clips | hours | PyTorch, no LM | PyTorch + KenLM | ONNX fast + KenLM |
30
+ |---|---|---|---|---|---|
31
+ | test | 914 | 3.20 | 16.34 / 4.75 | **10.98 / 3.57** | **11.03 / 3.61** |
32
+ | dev | 397 | 1.34 | 16.52 / 4.75 | 11.05 / 3.50 | 11.25 / 3.59 |
33
+ | train | 2655 | 9.27 | 15.82 / 4.80 | 11.30 / 3.78 | 11.36 / 3.83 |
34
+ | all | 3966 | 13.81 | 16.01 / 4.79 | 11.20 / 3.70 | 11.27 / 3.75 |
35
 
36
  - Decoder weights (`alpha` 1.0, `beta` 2.0) were chosen on the FLEURS dev split from 8 pairs, so the test row is the one to quote.
37
+ - The ONNX plain graph also gives 11.03 / 3.61 on FLEURS test; it was not run on the other splits.
38
  - Sentences of the FLEURS test split were excluded from the KenLM text; dev and train sentences were not.
39
  - Internal validation, no LM, on our own data mix: WER 13.48 / CER 6.01.
40
 
41
+ Speed on one i7-12700K, in Docker, times faster than real time, for the acoustic model plus KenLM:
42
 
43
+ | runtime | threads | speed | weights | measured on |
44
+ |---|---|---|---|---|
45
+ | ONNX fast | 8 | 84-87x | 268 MB | this checkpoint, FLEURS test, dev and train |
46
+ | ONNX plain | 8 | ~68x | 548 MB | this checkpoint, FLEURS test |
47
+ | PyTorch float32 | 8 | ~45x | 865 MB | this checkpoint, all FLEURS |
48
+ | PyTorch float32 | 1 | 12.7x | 865 MB | an earlier checkpoint of this model, 100 clips |
49
 
50
+ The machine had other load during the runs, so these are rough. KenLM takes about 1.5% of the time in the PyTorch runs and adds 1 GB to the download for every runtime. ONNX was not measured on 1 thread.
51
 
52
  ## Use
53
 
54
+ ```bash
55
+ pip install balbal
56
+ ```
57
+
58
+ ```python
59
+ import balbal
60
+
61
+ model = balbal.Model("LocalDoc/speakwrite-azerbaijani", threads=8)
62
+ print(model.transcribe("speech.wav")["text"])
63
+ ```
64
+
65
+ Tested with balbal 0.3.0 on Python 3.12 and Linux. The first run downloads about 1.3 GB: the fast graph and the KenLM. Pass `runtime="onnx"` for the plain graph, which uses standard ONNX operators only.
66
+
67
+ `transcribe` takes a file path or a waveform array with its sample rate: `model.transcribe(wave, 16000)`. WAV, FLAC and OGG are read directly; other formats need FFmpeg. The result also has `words`, with `word`, `start`, `end` and `confidence` for each word.
68
+
69
+ Audio longer than 30 s is cut into 30 s windows with 10 s overlap. `overlap_seconds=0` cuts fixed 30 s chunks instead, which is faster but gave a higher WER on our long recordings.
70
+
71
+ ### PyTorch
72
+
73
+ `model.pt` is the original checkpoint, for further training and experiments.
74
+
75
  Needs [balbal](https://github.com/erayyap/balbal) at commit `1be9f88b77c63fbafa7713c6e46e79847f6c390e` (Python 3.11-3.12, Linux; install
76
  `requirements/full.txt`, then run `inference/build_native.py`). Copy this repository's `refiner.json` over balbal's
77
  `configs/balbal-v2-manas/refiner.json`: this model's memory size differs from balbal's default, and the weights will not load otherwise.
 
88
 
89
  Keep `itn=False`: balbal's number conversion is Turkish. Long audio is cut into fixed 30 s chunks.
90
 
91
+ To use the PyTorch model without the KenLM, take the argmax of the CTC output instead of `Engine`: without an LM, WER on FLEURS test is 16.34. The `lm/` folder is then not needed.
92
 
93
  ## Training
94