ASR Kroko community - #122
Conversation
Port the public free Kroko Zipformer2 RNN-T packages to the native audio.cpp runtime. Add offline and stateful streaming recognition, partial results, word timestamps, dynamic 64-L/128-L layouts, ten single-language packages, safetensors conversion, standalone Q8 GGUF loading, model_specs/model_specs_v1 metadata, model-manager integration, probes, parity tooling, and documentation. Quality and parity: all ten multilingual requests exactly match the original sherpa-onnx greedy transcripts with zero reference WER. Word counts match and the worst word-start delta is 0.305 microseconds. Native-vs-ONNX encoder-boundary cosine is 0.99957-0.99988. The standalone Swedish Q8 GGUF produces transcript and word JSON byte-identical to native safetensors. Performance on Ryzen 9 7950X3D / RTX 3090: native CPU runs at 0.0875-0.0972 RTF (about 10-11x realtime), while optimized ONNX Runtime CPU runs at 0.0182-0.0222 RTF and is 4.3-4.7x faster for these short requests. The Swedish 4.968 s standalone Q8 GGUF CUDA run completes in 462.556 ms (0.0931 RTF); warm server requests complete in 491.622 ms with 111.753 ms TTFT. Full commands, per-request results, memory notes, artifacts, and limitations are recorded in docs/reports/kroko_asr_validation.md.
|
You're on fire 🔥! |
Remove redundant work from the parity-safe Kroko execution path. Compute the 512-value joiner tanh activation once per encoder frame instead of once per 650 vocabulary rows, evaluate independent vocabulary projections in parallel while preserving each row's accumulation order and the serial argmax, batch graph input/state/output transfers asynchronously at graph boundaries, reuse the padded feature chunk, and decode directly from the valid encoder-output prefix. A fully device-resident recurrent-state path was tested but deliberately rejected because it shifted several token emissions by one 40 ms frame. The retained host-state round trip preserves exact transcript and timestamp behavior. Performance on Ryzen 9 7950X3D / RTX 3090: the ten-language CPU matrix improves by 1.804-1.957x (1.881x arithmetic mean), with 0.0448-0.0531 RTF. Seven standalone Q8 CUDA CLI runs take 223.328-244.833 ms, 232.341 ms median and 0.0468 RTF, versus the 462.556 ms pre-optimization validation run (1.991x faster). The 49.68 s streaming/offline CPU paths improve from 3981.768/3936.170 ms to 2051.994/1984.566 ms. Warm server wall time improves from 491.622 ms to 138.293 ms, with 125.561 ms measured inside the session. All ten languages still exactly match sherpa-onnx with zero reference WER and a worst word-start delta of 0.305 microseconds. Seven Q8 outputs, 128-L English, and long-audio offline/streaming text and word JSON remain byte-identical. Windows CPU/CUDA builds, 64-L/128-L boundary probes, WebUI catalog tests, and loader/catalog synchronization pass. Update the validation report with commands and per-request results.
|
Added commit What changed
I also tested keeping recurrent state fully device-resident. That version was not retained because it shifted several token emissions by one 40 ms frame. The committed host-state path preserves exact transcript and timestamp parity. PerformanceTest system: Ryzen 9 7950X3D and RTX 3090.
Parity and validation
The full commands and per-request results are recorded in |
|
Implemented the remaining Kroko decoding and streaming work in commit f1fe367. What changed
Request options
The kroko_asr.* namespaced aliases are also accepted. Hotwords require modified beam search. Validation
CPU performance and parity safeguardsA focused five-run EN_3 CPU test measured 203.664 ms mean native session time versus 88.704 ms for optimized ONNX Runtime, a 2.296x ratio. Native execution remains roughly 20x faster than real time on this machine. I also tested keeping recurrent state resident and retaining allocator-managed graph constants between calls. Both shortcuts changed decoded tokens, so they were rejected. The committed path preserves the explicit transfers required for transcript and timestamp parity. Intentionally unchanged / known limitations
|
|
Added commit followup to #123 (comment)
Validation: JSON/model-manager checks pass, loader/catalog synchronization passes ( |
|
@mirek190 I've become the ruthless button-clicker and merged all three of your PRs. 😄 |
Hehe |
Summary
Adds native support for the public free Kroko Community ASR packages.
141/128) and 128-L (269/256) package layouts.datapackages to the audio.cpp safetensors layoutmodel_specs/runtime layout andmodel_specs_v1/catalog metadataKroko packages are single-language. The original
.datapackage is needed only to create the safetensors/GGUF model. Running a standalone GGUF does not require the.datafile or external sidecars.Build
Tested on Windows 11, Ryzen 9 7950X3D, RTX 3090 24 GiB, CUDA 12.4, MSVC 2022, and CMake 3.29.2.
Conversion and run
Converter/model-manager package id:
kroko_asr_community_converted.Original implementation and GGUF comparison
The original comparison uses
sherpa-onnx1.13.4 with the source Kroko ONNX graph and greedy RNN-T decoder.Across ten public 64-L language packages:
0for every request0.305 us0.99957-0.999880.0875-0.0972(about 10-11x real time)0.0182-0.0222, 4.3-4.7x faster for these short requestsSame 4.968-second Swedish request:
The 167,754,176-byte Q8 GGUF embeds
config.json,tokens.txt, and its package spec. It runs directly from a random file path without the source.datapackage or sidecars.Streaming, server, and memory
A 49.680-second Swedish sample produced byte-identical offline and streaming transcript/timestamp artifacts:
The stream accepted 794,880 samples while retaining only 38,560 values at peak.
Two Q8 CUDA requests through the long-lived server returned the exact reference transcript:
After request 2 the server used 619.5 MiB RSS and 1478.1 MiB private memory. Reliable per-process CUDA VRAM is unavailable through Windows WDDM.
Validation
Results:
Backends tested:
The complete exact commands, per-request language table, generated artifact paths, hashes, boundary metrics, server configuration, timing, RSS, and known limitations are in
docs/reports/kroko_asr_validation.md.GGUF models to test
https://huggingface.co/mirek190/audio.cpp/tree/main/Audio%20to%20text%20(ASR)/Kroko