Download scripts/docker_bench.sh from eschmidbauer/GigaAM-v4-c: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/eschmidbauer/GigaAM-v4-c/resolve/main/scripts/docker_bench.sh
- Command line
-
hf download hf://eschmidbauer/GigaAM-v4-c/scripts/docker_bench.sh
-
curl -L -o docker_bench.sh https://huggingface.co/eschmidbauer/GigaAM-v4-c/resolve/main/scripts/docker_bench.sh
1.35 kB
| # Build the image for one platform and benchmark native kernels against OpenBLAS. | |
| # usage: scripts/docker_bench.sh <linux/arm64|linux/amd64> <wav> [contexts...] | |
| set -eu | |
| cd "$(dirname "$0")/.." | |
| [ $# -ge 2 ] || { echo "usage: $0 <linux/arm64|linux/amd64> <wav> [contexts...]" >&2; exit 2; } | |
| platform="$1" | |
| wav="$2" | |
| shift 2 | |
| contexts="${*:-640 320 160}" | |
| model="${MODEL:-build/gigaam-v4-rnnt.gigaam}" | |
| tag="gigaam-bench:$(echo "$platform" | tr / -)" | |
| python="${PYTHON:-.venv/bin/python}" | |
| docker buildx build --platform "$platform" -t "$tag" --load . >/dev/null | |
| mkdir -p out | |
| run() { | |
| docker run --rm --platform "$platform" -v "$PWD":/work -e OPENBLAS_NUM_THREADS="${2:-1}" \ | |
| --entrypoint "$1" "$tag" "$model" "$wav" --context-ms "$3" --out "$4" --dump "$4" \ | |
| 2>&1 >/dev/null | sed "s/^/ /" | |
| } | |
| for ctx in $contexts; do | |
| echo "== $platform, context ${ctx} ms ==" | |
| echo " native (hand-rolled, 1 thread)" | |
| run gigaam_bench 1 "$ctx" "out/docker_native_$ctx" | |
| echo " openblas (1 thread)" | |
| run gigaam_bench-openblas 1 "$ctx" "out/docker_openblas_$ctx" | |
| echo " openblas (4 threads)" | |
| run gigaam_bench-openblas 4 "$ctx" "out/docker_openblas4_$ctx" | |
| echo " native vs openblas:" | |
| "$python" scripts/compare_dumps.py "out/docker_openblas_$ctx" "out/docker_native_$ctx" \ | |
| | sed "s/^/ /" || true | |
| done | |