|
Download scripts/README.md from matthiastl/sava-onnx: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/matthiastl/sava-onnx/resolve/main/scripts/README.md
- Command line
-
hf download hf://matthiastl/sava-onnx/scripts/README.md
-
curl -L -o README.md https://huggingface.co/matthiastl/sava-onnx/resolve/main/scripts/README.md
2.63 kB
Scripts
The working copies of the code that produced the files and numbers in this repository. They are here as a record and to let you rebuild or re-test; using the model needs none of them.
They expect to sit in one folder together with sava_onnx.py, and they write to build/:
uv venv --python 3.12
uv pip install inworld-sava onnx onnxruntime onnxscript pytest pyarrow scikit-learn scipy
.venv/bin/python export.py # build/sava.onnx (published as sava.onnx)
.venv/bin/python quantize.py # build/sava.int8.onnx (published as sava-int8.onnx)
.venv/bin/python -m pytest test_parity.py
| Script | What it does |
|---|---|
export.py |
exports the PyTorch model's one-frame streaming step to ONNX and names its learned linear layers |
quantize.py |
makes the 8-bit file by quantizing only those layers |
test_parity.py |
checks the export against the reference logits in the upstream repository's tests/fixtures (copy that folder to fixtures/) |
drift.py |
measures how far a smaller version's outputs move from the full-precision export |
bench.py |
scores the PyTorch model and the ONNX files on the TEN-VAD and pipecat smart-turn test sets, clean and through a simulated phone line |
telephony.py |
the simulated phone line bench.py uses: 8 kHz, 4th-order Butterworth band-pass at 300-3400 Hz, G.711 mu-law, back to 16 kHz |
speed.py |
times one 40 ms frame of each ONNX file and of the PyTorch streaming step on one CPU thread |
The test sets: TEN-VAD's from the testset/ folder of
TEN-framework/ten-vad (bench.py tenvad --root), and
pipecat-ai/smart-turn-data-v3.2-test
(bench.py pipecat --root).
Speed tests
ios-bench/: the small iOS app behind the native iPhone numbers. Add the ONNX Runtime xcframework from the officialonnxruntime-cCocoaPods archive undervendor/, copysava.onnx,sava-int8.onnx, the test recording andexpected.jsonintoResources/, set your own team inproject.yml, thenxcodegen generateand build for a device. It runs on launch and prints oneSAVABENCH_RESULTline per file.web-bench/: the page and local server behind the WebAssembly numbers. Put the two model files, the test recording andexpected.jsonnext toindex.html, runpython3 serve.py, and open the page from the device to test.
expected.json holds the per-frame logits of each file on the test recording, as produced by
native ONNX Runtime on an Apple M4 Max; both tests compare against it.