← Back to blog

2026. 6. 24.

hama v1.4.0: ONNX Runtime is gone, replaced by a Zig engine

Version 1.4.0 removes ONNX Runtime from hama completely. G2P and phoneme ASR now run on a self-contained inference engine we wrote from scratch in Zig. There is no behavior change: the engine reproduces the previous ONNX Runtime outputs byte-for-byte, verified by a golden corpus captured from ONNX Runtime and asserted in both runtimes.

  • Removed onnxruntime (Python) and onnxruntime-node / onnxruntime-web (TypeScript) as dependencies. The Python runtime depends only on numpy; the hama-js runtime has no runtime dependencies at all.
  • Python calls a small native library via ctypes. The wheel bundles prebuilt engines for macOS (arm64 and x86_64) and Linux (x86_64 and aarch64), with the Linux builds pinned to an old glibc for broad compatibility.
  • TypeScript loads one freestanding WebAssembly module (~31 KB) in Node, Bun, and the browser. There is no separate ONNX WASM runtime to host, configure threads for, or cap memory on.
  • The G2P encoder, the location-aware decoder, and the waveform ASR acoustic model (STFT to log-mel, a squeeze-excite convolutional backbone, transformer blocks, and a CTC head) are all hand-written Zig, validated stage-by-stage against ONNX Runtime intermediates.
  • Models now ship as compact .hama weight packages converted from the original ONNX exports. Public APIs are unchanged — existing G2PModel / ASRModel and G2PNodeModel / ASRNodeModel code keeps working.
  • Aligned Python hama and TypeScript hama-js on version 1.4.0.