--- license: apache-2.0 language: - uk datasets: - speech-uk/cv22 library_name: onnx pipeline_tag: automatic-speech-recognition tags: - forced-alignment - ctc - zipformer - onnx --- # zipfa Ukrainian: small CTC forced aligner (Cyrillic script) Forced aligner for Ukrainian (Cyrillic script). Given audio and its transcript, it returns a start and end time for every word. Latin-script words in the text (names, English terms) get a shared wildcard span, or can be re-aligned with the English zipfa model as a second model. ## Training `speech-uk/cv22` (Common Voice 22 Ukrainian, 97.5 h), 60 epochs, starting from the English zipfa encoder; export averaged over the last 15. No reference word timings exist for Ukrainian, so the time offset (0.04 s) is copied from the English model. ## Accuracy | measure | value | |---|---| | junction test (200 pairs of clips joined by 0.3 s silence, 0.10 s tolerance) | 0.995 (int8: 0.995) | | greedy character error rate | 0.027 (int8: 0.027) | | speed, int8, 1 CPU thread | real-time factor 0.008 | Word boundary error is not measured: no Ukrainian 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-ukrainian"), int8=True) for w in model.align(load_audio("clip.wav"), "добрий день"): print(w.word, w.start, w.end) ``` or `python -m zipfa.cli --model-dir --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.