aloudreader commited on
Commit
382a356
·
verified ·
1 Parent(s): 7b5530c

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
+ - es
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 Spanish: small CTC forced aligner
17
+
18
+ Forced aligner for Spanish. 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, ñ and ü are folded (señor → senor) and ¿ ¡ are dropped, but times are reported for the words as written.
21
+
22
+ ## Training
23
+
24
+ Multilingual LibriSpeech Spanish (CC BY 4.0), 918 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 Spanish test split:
29
+
30
+ | | junction pass rate | mean junction error | greedy character error rate |
31
+ |---|---|---|---|
32
+ | **this model** | **0.935** | 39.2 ms | **0.028** |
33
+ | this model, int8 | 0.935 | 39.6 ms | 0.028 |
34
+ | the English zipfa model on the same audio | 0.910 | 33.8 ms | 0.428 |
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. The pass rate is below the project's 0.95 target. In 12 of the 13 failed pairs, a transcript word at the join is missing from the model's own transcript of that clip (for example "fin del capitulo cinco" is in the transcript but not in the audio), which points at how MLS clips were cut; the check is crude, so not every failure is proven to be a data error. Word boundary error is not measured: no Spanish 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-spanish"), int8=True)
57
+ for w in model.align(load_audio("clip.wav"), "buenos dias a todos"):
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:32f1b4c37f532e415357fc4d1f8a68118c48510144e7db0c878e727ea026f909
3
+ size 19364248
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5317e085bfb841a4c0595a5a63194ff59bd33cb2d066fce5aaa7055bded3e2c
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.433983564376831,
8
+ -3.433983564376831,
9
+ -3.433983564376831,
10
+ -3.433983564376831,
11
+ -3.433983564376831,
12
+ -3.433983564376831,
13
+ -3.433983564376831,
14
+ -3.433983564376831,
15
+ -3.433983564376831,
16
+ -3.433983564376831,
17
+ -3.433983564376831,
18
+ -3.433983564376831,
19
+ -3.433983564376831,
20
+ -3.433983564376831,
21
+ -3.433983564376831,
22
+ -3.433983564376831,
23
+ -3.433983564376831,
24
+ -3.433983564376831,
25
+ -3.433983564376831,
26
+ -3.433983564376831,
27
+ -3.433983564376831,
28
+ -3.433983564376831,
29
+ -3.433983564376831,
30
+ -3.433983564376831,
31
+ -3.433983564376831,
32
+ -3.433983564376831,
33
+ -3.433983564376831,
34
+ -3.433983564376831,
35
+ -3.433983564376831,
36
+ -3.433983564376831,
37
+ -3.433983564376831
38
+ ]
39
+ }