Ling-3.0-tiny-RKNN / tools /run_quant_loss_board.sh
Sariel00's picture
Publish Ling-3.0-tiny RKNN engine and model
3fd1a35 verified
Raw History Blame Contribute Delete
1.29 kB
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -ne 4 ]; then
printf 'usage: run_quant_loss_board.sh PROBE MODEL SUITE OUTPUT_DIR\n' >&2
exit 2
fi
probe=$1
model=$2
suite=$3
output=$4
board_root=${LING3_BOARD_ROOT:-.}
test -x "$probe"
test -r "$model"
test -r "$suite"
python3 - <<'PY'
import json,urllib.request
client=urllib.request.build_opener(urllib.request.ProxyHandler({}))
with client.open('http://127.0.0.1:9091/health',timeout=5) as response:
health=json.load(response)
assert health['status']=='ok' and health['context_length']==65536 and not health['active'], health
PY
stopped=0
restore() {
result=$?
trap - EXIT
if [ "$stopped" -eq 1 ]; then
systemd-run --user --unit=mindnano-ling3 --collect \
--property=Restart=on-failure --property=RestartSec=5 \
--working-directory="$board_root/deployment/mindnano-ling3-rk3588" \
"$board_root/deployment/mindnano-ling3-rk3588/mindnano-infer" \
--context 64K --host 0.0.0.0 --port 9091 --no-console \
--log "$board_root/deployment/mindnano-ling3-rk3588/metrics-live.jsonl" || result=1
fi
exit "$result"
}
trap restore EXIT
systemctl --user stop mindnano-ling3.service
stopped=1
mkdir -p "$output"
"$probe" "$model" "$suite" "$output"