Kiri ASR Small
Real-time Khmer and English speech recognition in 24 million parameters.
Kiri ASR Small writes the transcript while the person is still speaking, runs on a laptop CPU about 20 times faster than real time, and runs inside a web browser with no server.
This is the community version, shared freely for everyone to use and build on. For production use, the Pro version lives at kiritts.com.
- Live demo: kiriasr.blizzer.tech, runs in your browser
- Code: github.com/mrrtmob/kiri-asr
- JavaScript version:
kiri-asr-js, the same model in the browser and on Node
Use it
Python
pip install git+https://github.com/mrrtmob/kiri-asr.git
from kiri_asr import KiriASR
asr = KiriASR() # downloads this model once, then loads from cache
result = asr.transcribe("meeting.wav") # wav, flac, ogg or mp3, any sample rate
print(result.text)
Watch the transcript grow:
for partial in asr.stream_file("meeting.wav"):
print(partial)
Live audio from a microphone, a phone call or a websocket:
stream = asr.create_stream()
for chunk in audio_chunks: # float32 in [-1, 1] or int16 PCM
text_so_far = stream.feed(chunk, sample_rate=16000)
print(text_so_far)
final_text = stream.finish()
JavaScript
kiri-asr-js runs the same files in the browser and on Node. Audio is decoded on the
device; nothing is sent to a server.
import { KiriASR } from "kiri-asr-js";
const asr = await KiriASR.load(); // fetches this model
const result = await asr.transcribe(file, {
onPartial: (text) => (output.textContent = text),
});
console.log(result.text);
Architecture
Kiri ASR Small is a streaming Zipformer transducer. Audio is cut into short frames and described by 80 numbers each. The encoder reads those frames 320 ms at a time, keeping a memory of what it has already heard, and produces one vector for every 40 ms of audio. For each of those, the joiner combines it with a vector from the decoder, which summarises the last two tokens written, and scores every possible next token, including "nothing yet". A search step picks the tokens, and each one it writes is fed back to the decoder. Because nothing needs to see the end of the recording, text appears while you speak.
| Parameters | 23.8 M |
| Input | 16 kHz mono audio, 80-bin log-mel features at 100 frames per second |
| Encoder | Causal Zipformer, 6 stacks of 2 layers each |
| Encoder widths | 192, 256, 256, 256, 256, 256 |
| Feed-forward widths | 512, 768, 768, 768, 768, 768 |
| Encoder output | One vector per 40 ms |
| Chunk / left context | 320 ms / 2.56 s |
| Decoder | Stateless, sees the last 2 tokens |
| Output units | 500 SentencePiece pieces shared by Khmer and English |
CER
Measured on the FLEURS test split in streaming mode. Character error rate, with spaces and punctuation removed before scoring.
| Test set | Clips | Greedy | Beam search |
|---|---|---|---|
FLEURS Khmer (km_kh) test |
771 | 11.50 % | 10.74 % |
FLEURS English (en_us) test |
647 | 14.80 % | 14.69 % |