File size: 3,185 Bytes
382a356 | 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:
- es
datasets:
- facebook/multilingual_librispeech
library_name: onnx
pipeline_tag: automatic-speech-recognition
tags:
- forced-alignment
- ctc
- zipformer
- onnx
---
# zipfa Spanish: small CTC forced aligner
Forced aligner for Spanish. Given audio and its transcript, it returns a start and end time for every word.
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.
## Training
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.
## Accuracy
On 200 pairs (400 clips) from the MLS Spanish test split:
| | junction pass rate | mean junction error | greedy character error rate |
|---|---|---|---|
| **this model** | **0.935** | 39.2 ms | **0.028** |
| this model, int8 | 0.935 | 39.6 ms | 0.028 |
| the English zipfa model on the same audio | 0.910 | 33.8 ms | 0.428 |
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.
## 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-spanish"), int8=True)
for w in model.align(load_audio("clip.wav"), "buenos dias a todos"):
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.
|