File size: 3,058 Bytes
7f08796 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | ---
license: apache-2.0
language:
- de
datasets:
- facebook/multilingual_librispeech
library_name: onnx
pipeline_tag: automatic-speech-recognition
tags:
- forced-alignment
- ctc
- zipformer
- onnx
---
# zipfa German: small CTC forced aligner
Forced aligner for German. Given audio and its transcript, it returns a start and end time for every word.
Text uses the Latin alphabet of the English model: umlauts are folded (schön → schon) and ß becomes ss, but times are reported for the words as written.
## Training
Multilingual LibriSpeech German (CC BY 4.0), 1,967 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.
## Accuracy
On 200 pairs (400 clips) from the MLS German test split:
| | junction pass rate | mean junction error | greedy character error rate |
|---|---|---|---|
| **this model** | **0.955** | 21.0 ms | **0.046** |
| this model, int8 | 0.955 | 20.9 ms | 0.046 |
| the English zipfa model on the same audio | 0.920 | 34.5 ms | 0.504 |
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. Of the 9 failed pairs, about 7 have a transcript word at the join that is not in the audio (for example a clip whose transcript opens with "teil zwei kapitel dreiundzwanzig", which its audio does not contain); 2 are alignment errors on clean clips. Word boundary error is not measured: no German reference timings exist.
## Files
| file | what it is |
|---|---|
| `model.onnx` | full-precision model (47 MB) |
| `model.int8.onnx` | int8-quantised model (19 MB), same accuracy, faster on CPU |
| `tokens.txt`, `bpe.model` | the character tokenizer |
| `zipfa.json` | script, frame shift (20 ms) and calibrated time offset |
## Use
With the `zipfa` package (numpy + onnxruntime + kaldi-native-fbank):
```python
from huggingface_hub import snapshot_download
from zipfa.audio import load_audio
from zipfa.model import ZipfaModel
model = ZipfaModel(snapshot_download("aloudreader/zipfa-german"), int8=True)
for w in model.align(load_audio("clip.wav"), "guten morgen zusammen"):
print(w.word, w.start, w.end)
```
or `python -m zipfa.cli --model-dir <folder> --audio clip.wav --text "..." --int8`.
- 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.
- Output: one start and end time per word of the given text, 20 ms resolution.
- 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`).
- 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.
## Model
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.
|