zipfa-french / README.md
aloudreader's picture
Add zipfa model
79b9ee2 verified
|
Raw History Blame Contribute Delete
2.94 kB
metadata
license: apache-2.0
language:
  - fr
datasets:
  - facebook/multilingual_librispeech
library_name: onnx
pipeline_tag: automatic-speech-recognition
tags:
  - forced-alignment
  - ctc
  - zipformer
  - onnx

zipfa French: small CTC forced aligner

Forced aligner for French. 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 are folded (é → e, ç → c) and hyphens are dropped ("dit-il" is aligned as one word), but times are reported for the words as written.

Training

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.

Accuracy

On 200 pairs (400 clips) from the MLS French test split:

junction pass rate mean junction error greedy character error rate
this model 0.975 13.6 ms 0.053
this model, int8 0.970 14.4 ms 0.053
the English zipfa model on the same audio 0.975 76.2 ms 0.512

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.

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-french"), int8=True)
for w in model.align(load_audio("clip.wav"), "bonjour tout le monde"):
    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.