|
Download scripts/README.md from matthiastl/tyger-coreml: direct link, hf CLI and curl.
- Browser
- Download file 3.26 kB
-
https://huggingface.co/matthiastl/tyger-coreml/resolve/main/scripts/README.md
- Command line
-
hf download hf://matthiastl/tyger-coreml/scripts/README.md
-
curl -L -o README.md https://huggingface.co/matthiastl/tyger-coreml/resolve/main/scripts/README.md
3.26 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 re-test; using the model needs none of them. Run them from this folder.
They ran in two Python 3.12 environments:
- A (the original):
torch==2.15.0 transformers==5.23.0 onnx==1.23.2 safetensors pyarrow soundfile - B (the port, the scores and Core ML, on a Mac):
onnxruntime==1.32.0 onnx==1.23.2 torch==2.15.0 numpy scipy safetensors pyarrow soundfile
Core ML runs on a Mac with Apple Silicon and macOS 15 or later. test_runtime.py and the iPhone app need Xcode.
# TYGER, the Open Yap sample (CC-BY-4.0), and the test calls (CallHome is gated: accept its terms on its page first).
hf download nineninesix/tyger --include config.json model.safetensors "nemotron/*.json" --local-dir data/tyger
hf download TheAgenticDataCompany/open-yap-1k shard-00000.tar shard-00001.tar --repo-type dataset --local-dir data/openyap
hf download talkbank/callhome eng/data-00000-of-00005.parquet --repo-type dataset --local-dir data/callhome
# The encoder's 15 layers and the turn-taker from TYGER's file (A): data/l15.safetensors, data/mel_filters.npy,
# export/turn_taker.onnx.
A/bin/python -I export.py --out export
# The fixed-size, 16-bit encoder for both streams at once (B), checked against the original encoder, then the package.
B/bin/python -I -B coreml_export.py --out export --batch 2
B/bin/python -I -B coreml_package.py --model export/l15.static.b2.fp16.onnx --out ../TygerEncoder.mlpackage
# Decisions and events on the 28 calls: the original (A, about 35 minutes), then this version (B), then the rule.
A/bin/python -I tyger_ref.py features --out runs/ref --threads 1
B/bin/python -I -B phone_coreml.py features --model export/l15.static.b2.fp16.onnx --out runs/coreml
B/bin/python -I -B turns.py --reference runs/ref --port runs/coreml --out results/gate.json
# Speed on the Mac it runs on, and the outputs the iPhone app compares with.
B/bin/python -I -B phone_coreml.py prepare --model export/l15.static.b2.fp16.onnx --out results/m4max.json
# The runtime gives the Python version's events.
B/bin/python -I -B test_runtime.py --onnxruntime path/to/onnxruntime.xcframework
| Script | What it does |
|---|---|
tyger_ref.py |
the original, as tyger-s2s's CPU reference runs it: 8 s windows, layer 15, per-hop frames |
l15.py |
Nemotron's encoder to layer 15 in plain PyTorch, and the log-mels in numpy |
export.py |
the 15 layers' and the turn-taker's weights, and the turn-taker's ONNX export |
coreml_export.py |
the encoder with fixed shapes, for one or both streams, checked against l15.py |
coreml_package.py |
the Core ML package from the exported file |
coreml_try.py |
opens the exported file on Core ML |
phone_coreml.py |
this version's frames on a Mac, its speed, and what the iPhone app compares with |
turns.py |
the decisions and events of both, and the pass/fail numbers |
port.py |
the turn-taker in ONNX Runtime |
openyap.py |
the development audio |
test_runtime.py, test_runtime.m |
ios/Tyger.m against the Python version |
check_release.py |
refuses to publish a folder that names the machine it was made on |