aloudreader commited on
Commit
79b9ee2
·
verified ·
1 Parent(s): 31acdf8

Add zipfa model

Browse files
Files changed (6) hide show
  1. README.md +70 -0
  2. bpe.model +3 -0
  3. model.int8.onnx +3 -0
  4. model.onnx +3 -0
  5. tokens.txt +31 -0
  6. zipfa.json +39 -0
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - fr
5
+ datasets:
6
+ - facebook/multilingual_librispeech
7
+ library_name: onnx
8
+ pipeline_tag: automatic-speech-recognition
9
+ tags:
10
+ - forced-alignment
11
+ - ctc
12
+ - zipformer
13
+ - onnx
14
+ ---
15
+
16
+ # zipfa French: small CTC forced aligner
17
+
18
+ Forced aligner for French. Given audio and its transcript, it returns a start and end time for every word.
19
+
20
+ Text uses the Latin alphabet of the English model: accents are folded (é → e, ç → c) and hyphens are dropped ("dit-il" is aligned as one word), but times are reported for the words as written.
21
+
22
+ ## Training
23
+
24
+ Multilingual LibriSpeech French (CC BY 4.0), 1,077 h, 20 epochs, starting from the English zipfa model; export averaged over the last 7. MLS has no reference word timings, so the time offset (0.03 s) is the English model's.
25
+
26
+ ## Accuracy
27
+
28
+ On 200 pairs (400 clips) from the MLS French test split:
29
+
30
+ | | junction pass rate | mean junction error | greedy character error rate |
31
+ |---|---|---|---|
32
+ | **this model** | **0.975** | **13.6 ms** | **0.053** |
33
+ | this model, int8 | 0.970 | 14.4 ms | 0.053 |
34
+ | the English zipfa model on the same audio | 0.975 | 76.2 ms | 0.512 |
35
+
36
+ Junction test: two clips joined by 0.3 s of silence; it passes when the first clip's words end before the join and the second's start after the silence, within 0.10 s. 4 of the 5 failed pairs are dataset errors (a transcript that does not match its audio). Word boundary error is not measured: no French reference timings exist.
37
+
38
+ ## Files
39
+
40
+ | file | what it is |
41
+ |---|---|
42
+ | `model.onnx` | full-precision model (47 MB) |
43
+ | `model.int8.onnx` | int8-quantised model (19 MB), same accuracy, faster on CPU |
44
+ | `tokens.txt`, `bpe.model` | the character tokenizer |
45
+ | `zipfa.json` | script, frame shift (20 ms) and calibrated time offset |
46
+
47
+ ## Use
48
+
49
+ With the `zipfa` package (numpy + onnxruntime + kaldi-native-fbank):
50
+
51
+ ```python
52
+ from huggingface_hub import snapshot_download
53
+ from zipfa.audio import load_audio
54
+ from zipfa.model import ZipfaModel
55
+
56
+ model = ZipfaModel(snapshot_download("aloudreader/zipfa-french"), int8=True)
57
+ for w in model.align(load_audio("clip.wav"), "bonjour tout le monde"):
58
+ print(w.word, w.start, w.end)
59
+ ```
60
+
61
+ or `python -m zipfa.cli --model-dir <folder> --audio clip.wav --text "..." --int8`.
62
+
63
+ - Input: 16 kHz mono audio, up to 120 s per call. Audio over 30 s is encoded in overlapping 30 s windows, so memory stays around 600 MB natively.
64
+ - Output: one start and end time per word of the given text, 20 ms resolution.
65
+ - Words that cannot be spelled in this model's alphabet share one wildcard span; the `zipfa` package can re-align such runs with a second model (`--second-model-dir`).
66
+ - In the browser it runs with onnxruntime-web (WASM): about 25–35 ms for a 5 s clip with 8 threads, about 275 MB of WASM heap.
67
+
68
+ ## Model
69
+
70
+ Zipformer CTC encoder (icefall), 9.7M parameters, 80-dim filterbank input, 50 output frames per second, trained with CR-CTC. Exported to ONNX with long-audio support.
bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25134f58e4d80efa39854d3340cbb9f65fd3771db74c5e2d6a8d356a45c37c98
3
+ size 464
model.int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8065b38f90899deea68c4f74baf707e393acd2221a5c77f0197b7733677e996
3
+ size 19364248
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0f01a62131ad56cc976c007139e3f07ba13c21cb49df9d847a6117fc96952a2
3
+ size 46952668
tokens.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <blk> 0
2
+ <sos/eos> 1
3
+ <unk> 2
4
+ ▁ 3
5
+ a 4
6
+ b 5
7
+ c 6
8
+ d 7
9
+ e 8
10
+ f 9
11
+ g 10
12
+ h 11
13
+ i 12
14
+ j 13
15
+ k 14
16
+ l 15
17
+ m 16
18
+ n 17
19
+ o 18
20
+ p 19
21
+ q 20
22
+ r 21
23
+ s 22
24
+ t 23
25
+ u 24
26
+ v 25
27
+ w 26
28
+ x 27
29
+ y 28
30
+ z 29
31
+ ' 30
zipfa.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "script": "latin",
3
+ "frame_shift": 0.02,
4
+ "time_offset": 0.03,
5
+ "prior_scale": 0.0,
6
+ "log_priors": [
7
+ -3.433987855911255,
8
+ -3.433987855911255,
9
+ -3.433987855911255,
10
+ -3.433987855911255,
11
+ -3.433987855911255,
12
+ -3.433987855911255,
13
+ -3.433987855911255,
14
+ -3.433987855911255,
15
+ -3.433987855911255,
16
+ -3.433987855911255,
17
+ -3.433987855911255,
18
+ -3.433987855911255,
19
+ -3.433987855911255,
20
+ -3.433987855911255,
21
+ -3.433987855911255,
22
+ -3.433987855911255,
23
+ -3.433987855911255,
24
+ -3.433987855911255,
25
+ -3.433987855911255,
26
+ -3.433987855911255,
27
+ -3.433987855911255,
28
+ -3.433987855911255,
29
+ -3.433987855911255,
30
+ -3.433987855911255,
31
+ -3.433987855911255,
32
+ -3.433987855911255,
33
+ -3.433987855911255,
34
+ -3.433987855911255,
35
+ -3.433987855911255,
36
+ -3.433987855911255,
37
+ -3.433987855911255
38
+ ]
39
+ }