Resource profile (8.4 s utterance, ONNX Runtime CPU): encoder ~87 ms/chunk (RTF ~0.27),
peak RSS ~3.4 GB. Note: ONNX Runtime up-converts FP16→FP32 on CPU (no native FP16 CPU
kernels), so FP16's runtime wins are realized on GPU / NPU / NNAPI — on CPU its benefit is
the smaller download. For lowest CPU latency/RAM, use the INT8 build.
1import onnxruntime as ort
2
3so = ort.SessionOptions()
4enc = ort.InferenceSession("encoder.onnx", so, providers=["CPUExecutionProvider"])
5dec = ort.InferenceSession("decoder.onnx", so, providers=["CPUExecutionProvider"])
6joint = ort.InferenceSession("joint.onnx", so, providers=["CPUExecutionProvider"])
7
8# Pick the language prompt slot from languages.json, e.g. "en-US" -> 0, "ja-JP" -> 10.
9# Front end: 128-bin log-mel (n_fft=512, win=400, hop=160, preemph=0.97), 16 kHz mono.
10# Streaming contract (per chunk): feed 320 ms of audio + the carried encoder caches
11# (attention / conv / pre-cache), then run the RNN-T greedy loop over the 4 emitted frames.
12# Port wiring for the encoder caches is described by config.json's "streaming" block.
Production streaming, cache management and RNN-T greedy decoding are handled by the
speech-android SDK.