summaryrefslogtreecommitdiff
path: root/tools/whistle-eval/setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/whistle-eval/setup.sh')
-rwxr-xr-xtools/whistle-eval/setup.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/whistle-eval/setup.sh b/tools/whistle-eval/setup.sh
new file mode 100755
index 0000000..fde74fe
--- /dev/null
+++ b/tools/whistle-eval/setup.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+# Fetches everything the Whistle evaluation harness needs and rebuilds the
+# ONNX external-data files from the small whistle.pack.
+set -euo pipefail
+cd "$(dirname "$0")"
+
+WHISTLE_BASE="https://huggingface.co/mrfakename/whistle-ONNX/resolve/main"
+WHISPER_BASE="https://huggingface.co/csukuangfj/sherpa-onnx-whisper"
+
+mkdir -p vendor/js vendor/onnx models/tiny models/base
+
+echo "==> Downloading the Whistle pack and ONNX graphs"
+curl -L --fail -o vendor/whistle.pack "$WHISTLE_BASE/whistle.pack"
+curl -L --fail -o vendor/onnx/encoder.onnx "$WHISTLE_BASE/onnx/encoder.onnx"
+curl -L --fail -o vendor/onnx/decoder.onnx "$WHISTLE_BASE/onnx/decoder.onnx"
+
+echo "==> Downloading the reference JS pipeline"
+for file in pack.js whistle.js backend.js example.mjs; do
+ curl -L --fail -o "vendor/js/$file" "$WHISTLE_BASE/js/$file"
+done
+
+echo "==> Installing onnxruntime-node"
+npm install --no-audit --no-fund
+
+echo "==> Rebuilding fp32 ONNX data from whistle.pack"
+node build-data.mjs
+
+echo "==> Downloading Whisper tiny/base int8 (sherpa-onnx)"
+for model in tiny base; do
+ for file in encoder.int8.onnx decoder.int8.onnx tokens.txt; do
+ curl -L --fail -o "models/$model/$file" "$WHISPER_BASE-$model/resolve/main/$model-$file"
+ done
+done
+
+echo
+echo "Done. Next:"
+echo " python3 -m venv .venv && .venv/bin/pip install sherpa-onnx numpy"
+echo " .venv/bin/python evaluate.py \"samples/*.wav\""