Ratna
Ratna is a streaming Nepali speech recognition model from Ampixa Labs. It has 31,963,576 parameters and ships as a 35.10 MB int8 ONNX bundle that runs on one CPU thread or in a browser through WebAssembly. Try it at ampixa.com/ratna.
Files
| File | Bytes | Purpose |
|---|---|---|
encoder.int8.onnx |
32,667,500 | Causal Zipformer2 encoder |
decoder.int8.onnx |
1,333,266 | Stateless predictor |
joiner.int8.onnx |
1,058,185 | Joiner |
tokens.txt |
38,953 | 2,048 BPE tokens |
web/model-0.data, web/model-1.data |
18,000,000 and 17,097,904 | The same model packed for the sherpa-onnx WebAssembly runtime |
Use it
import sherpa_onnx
import soundfile as sf
from huggingface_hub import snapshot_download
path = snapshot_download("ampixa/ratna-asr", allow_patterns=["*.onnx", "tokens.txt"])
recognizer = sherpa_onnx.OnlineRecognizer.from_transducer(
tokens=f"{path}/tokens.txt",
encoder=f"{path}/encoder.int8.onnx",
decoder=f"{path}/decoder.int8.onnx",
joiner=f"{path}/joiner.int8.onnx",
num_threads=1,
sample_rate=16000,
feature_dim=80,
decoding_method="greedy_search",
model_type="zipformer2",
)
audio, sr = sf.read("clip.wav", dtype="float32") # mono, 16 kHz
stream = recognizer.create_stream()
stream.accept_waveform(sr, audio)
stream.accept_waveform(sr, [0.0] * int(0.5 * sr))
stream.input_finished()
while recognizer.is_ready(stream):
recognizer.decode_stream(stream)
print(recognizer.get_result(stream))
How it works
16 kHz audio becomes an 80-dimensional log-mel filterbank every 10 ms. A Conv2d layer reduces it to 50 frames per second. A causal Zipformer2 encoder with six stacks runs at 50, 25, 12.5, 6.25, 12.5 and 25 Hz. A stateless predictor and joiner emit BPE tokens with greedy search. The model reads 320 ms chunks with 2.56 s of left context and no look-ahead.
Results
| Test | CER % | WER % |
|---|---|---|
| PV read speech, 100 sentences | 16.33 | 39.26 |
| Fresh read speech | 27.15 | 48.91 |
| FLEURS | 28.03 | 55.94 |
The real-time factor is 0.0273 on one thread of an Apple M2 Ultra, with a peak of 205 MiB of memory. Ratna was trained with public and synthetic speech, including machine-generated labels, and not on real call audio. NepTel 0.2 phone audio scores 67.32% WER, and exact phone numbers are not captured, so it should not be used for those tasks. This is a research release.
The full report is on the Ampixa blog.
Licence
If you use Ratna, or build on it, name it properly: Ratna (Ampixa Labs), in your model card or documentation. See LICENSE-MODEL.md.