omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / ty7_round.sh
| 1 | #!/bin/sh |
| 2 | # One TY-7 WORK window: every prompt of round R, one request at a time. |
| 3 | # usage: tools/ty7_round.sh OUTDIR PROMPTS R URL |
| 4 | # Request body per protocol section 5. The interval logged for a reply is |
| 5 | # send..last byte of the attempt that was served. A request is sent only when |
| 6 | # the hive GPU lock (/tmp/aien-gb10.lock, which the server takes itself for |
| 7 | # each generation) is free at that instant, so the interval holds our |
| 8 | # generation and not a wait behind another chip job (amendment 1). Refusals |
| 9 | # (HTTP 503: server_busy or "GPU busy") are retried after 0.05 s and are not |
| 10 | # inside any interval. Any other non-200 reply is logged and the round is |
| 11 | # refused by the reducer (no endless retry). |
| 12 | set -u |
| 13 | OUT=$1; PROMPTS=$2; R=$3; URL=$4 |
| 14 | LOCK=${TY7_GPU_LOCK:-/tmp/aien-gb10.lock} |
| 15 | LEAD='Continue this text in plain prose. Write only the continuation.\n\n' |
| 16 | i=0 |
| 17 | while IFS= read -r line; do |
| 18 | i=$((i + 1)) |
| 19 | esc=$(printf '%s' "$line" | sed 's/\\/\\\\/g; s/"/\\"/g') |
| 20 | body=$(printf '{"messages":[{"role":"user","content":"%s%s"}],"temperature":1.0,"top_p":1.0,"top_k":0,"max_tokens":256,"seed":%d,"aien_return_token_ids":true,"stream":false}' \ |
| 21 | "$LEAD" "$esc" $((1000 * R + i))) |
| 22 | f="$OUT/r$R-p$i.json" |
| 23 | tries=0; lockwaits=0 |
| 24 | while :; do |
| 25 | if ! flock -n "$LOCK" true; then |
| 26 | lockwaits=$((lockwaits + 1)); sleep 0.05; continue |
| 27 | fi |
| 28 | tries=$((tries + 1)) |
| 29 | t0=$(date +%s%N) |
| 30 | code=$(curl -s -m 1200 -o "$f" -w '%{http_code}' -H 'Content-Type: application/json' -d "$body" "$URL/v1/chat/completions") |
| 31 | t1=$(date +%s%N) |
| 32 | [ "$code" = 503 ] || break |
| 33 | sleep 0.05 |
| 34 | done |
| 35 | echo "$R $i $t0 $t1 http=$code tries=$tries lockwaits=$lockwaits" >> "$OUT/intervals.log" |
| 36 | done < "$PROMPTS" |