File size: 1,287 Bytes
3fd1a35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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"