zipfa-english / README.md
aloudreader's picture
Add zipfa model
ca80867 verified
|
Raw History Blame Contribute Delete
2.56 kB
metadata
license: apache-2.0
language:
  - en
datasets:
  - openslr/librispeech_asr
library_name: onnx
pipeline_tag: automatic-speech-recognition
tags:
  - forced-alignment
  - ctc
  - zipformer
  - onnx

zipfa English: small CTC forced aligner (Latin script)

Forced aligner for English (and other text written in the 26-letter Latin alphabet, plus apostrophe). Given audio and its transcript, it returns a start and end time for every word.

Training

LibriSpeech 960 h (CC BY 4.0), 30 epochs, export averaged over the last 10. Time offset calibrated on dev_clean (0.03 s).

Accuracy

measure value
word boundary error, LibriSpeech test_clean (1,000 utterances, against Montreal Forced Aligner timings) 46.5 ms (int8: 46.5 ms)
boundaries within 50 ms 68.8%
same measure, facebook/wav2vec2-base-960h through the same aligner 54.6 ms
junction test (200 pairs of clips joined by 0.3 s silence, 0.10 s tolerance) 1.000
greedy character error rate 0.028
speed, int8, 1 CPU thread real-time factor 0.008 (5 s of audio in about 40 ms)

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):

from huggingface_hub import snapshot_download
from zipfa.audio import load_audio
from zipfa.model import ZipfaModel

model = ZipfaModel(snapshot_download("aloudreader/zipfa-english"), int8=True)
for w in model.align(load_audio("clip.wav"), "hello world"):
    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.