Dynamic INT8 quantization was applied to the full Conformer CTC graph using ONNX Runtime's quantize_dynamic. All matrix multiplications are quantized to INT8; activations remain in FP32. The result fits in the assets bundle of a React Native Android app and loads in under 3 seconds on a mid-range phone.
Audio pipeline
The model expects a mel spectrogram computed with the following settings (matching LasrFeatureExtractor):
Parameter
Value
Sample rate
16 000 Hz, mono
FFT size
512
Mel bins
128
Window
Hann
Hop length
160 samples (10 ms)
Frequency range
0–8 000 Hz
CTC greedy decoding is performed over a 512-token SentencePiece vocabulary (blank = token 0). Post-processing converts special punctuation tokens ({period}, {comma}, etc.) and section-header tokens ([EXAM TYPE]) into formatted medical text.
Files
File
Description
medasr_int8.onnx
INT8 quantized ONNX model
medasr_vocab.json
512-token SentencePiece vocabulary
Usage
Python (ONNX Runtime)
python
1import onnxruntime as ort
2import numpy as np
3import json
45# Load vocab and model6withopen("medasr_vocab.json")as f:7 vocab = json.load(f)89session = ort.InferenceSession(10"medasr_int8.onnx",11 providers=["CPUExecutionProvider"]12)1314# audio_array: float32 numpy array, shape (T,), resampled to 16 kHz mono15# mel: shape (1, 128, T') — compute with your mel spectrogram library16mel = compute_mel_spectrogram(audio_array)# see audio pipeline table above1718logits = session.run(None,{"input": mel})[0]# (1, T', 512)19tokens = np.argmax(logits[0], axis=-1)2021# CTC greedy decode (remove blanks and repeated tokens)22decoded =[]23prev =-124for t in tokens:25if t !=0and t != prev:26 decoded.append(vocab[t])27 prev = t
2829transcript =" ".join(decoded)
Weights inherit the license of the base model google/medasr. The quantization artifacts (this card, vocab file) are released under Apache 2.0.
Citation
If you use this model, please cite the original MedASR work and acknowledge the Capsule project:
@misc{capsule2026,
title = {Capsule: Edge AI Clinical Documentation with Agentic Intelligence},
author = {Mohammed K. A. Abed},
year = {2026},
url = {https://github.com/mo-saif/capsule}
}