sraivante's picture
tiny-superfast-agentic-MLM-6.5m-v1: 6.44M-param NumPy command parser, sample executor, benchmarks
76d666a verified
Raw History Blame Contribute Delete
952 Bytes
# usage: run_all.sh <python> <model> <data> <outdir> <thread options...>
PY=$1; M=$2; D=$3; O=$4; shift 4; best=""; bestms=999999
for t in "$@"; do
if [ "$t" = default ]; then env -u OPENBLAS_NUM_THREADS -u OMP_NUM_THREADS $PY bench_device.py --model $M --data $D --out $O/probe_$t.json --probe-only --probe-n 300
else OPENBLAS_NUM_THREADS=$t OMP_NUM_THREADS=$t $PY bench_device.py --model $M --data $D --out $O/probe_$t.json --probe-only --probe-n 300; fi
ms=$($PY -c "import json;print(json.load(open('$O/probe_$t.json'))['mean_ms'])"); echo "probe $t mean $ms"
if $PY -c "import sys;sys.exit(0 if $ms < $bestms else 1)"; then best=$t; bestms=$ms; fi
done
echo "best threads: $best"; sleep 120
if [ "$best" = default ]; then $PY bench_device.py --model $M --data $D --out $O/main.json --minutes 10
else OPENBLAS_NUM_THREADS=$best OMP_NUM_THREADS=$best $PY bench_device.py --model $M --data $D --out $O/main.json --minutes 10; fi
echo ALLDONE