Download scripts/check_c2.py from mverde73/mnemonic-proxy-agentlongbench: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/datasets/mverde73/mnemonic-proxy-agentlongbench/resolve/main/scripts/check_c2.py
- Command line
-
hf download hf://datasets/mverde73/mnemonic-proxy-agentlongbench/scripts/check_c2.py
-
curl -L -o check_c2.py https://huggingface.co/datasets/mverde73/mnemonic-proxy-agentlongbench/resolve/main/scripts/check_c2.py
2.08 kB
| """Regole d'arresto del pilota C2 (BRIEF-PILOT-C2-GPU, Blocco GPU punto 4), dopo ogni lavoro. | |
| Uso: check_c2.py RESULT_JSON STATE_JSON -> exit 0 continua, exit 9 STOP (causa su stdout). | |
| - violazione di finestra o di margine vista dal contatore (margin_violations > 0) -> STOP | |
| - rifiuto del motore: http_errors > 0 nel contatore o status ContextOverflow -> STOP | |
| - rifiuto del banco (WindowRefused) per A/T/B: a 32k/64k non deve succedere -> STOP | |
| - errori di sistema (status non ok, esclusi ProxyWindowRefused registrati) 2 di fila -> STOP | |
| - D: risposte vuote o troncate in serie (>= 3 corse D consecutive) -> STOP | |
| ProxyWindowRefused (400 della guardia del proxy senza invio) e' un esito del proxy: registrato, non ferma. | |
| """ | |
| import json | |
| import sys | |
| from pathlib import Path | |
| r = json.load(open(sys.argv[1])) | |
| sp = Path(sys.argv[2]) | |
| st = json.loads(sp.read_text()) if sp.exists() else {"nsys": 0, "d_bad": 0} | |
| eng = r.get("engine") or {} | |
| tag = "%s %s/%s %s" % (r["policy"], r["setting"], r["length"], r["qid"]) | |
| stop = None | |
| if (eng.get("margin_violations") or 0) > 0: | |
| stop = "violazione del margine/finestra vista dal contatore (%s, min_slack %s)" % (tag, eng.get("min_window_slack")) | |
| elif (eng.get("http_errors") or 0) > 0 or r["status"] == "ContextOverflow": | |
| stop = "rifiuto del motore (%s: status %s, http_errors %s)" % (tag, r["status"], eng.get("http_errors")) | |
| elif r["status"] == "WindowRefused": | |
| stop = "rifiuto del banco WindowRefused (%s)" % tag | |
| if r["status"] in ("ok", "ProxyWindowRefused"): | |
| st["nsys"] = 0 | |
| else: | |
| st["nsys"] += 1 | |
| if stop is None and st["nsys"] >= 2: | |
| stop = "2 errori di sistema consecutivi (ultimo %s: %s)" % (tag, r["status"]) | |
| if r["policy"] == "D": | |
| bad = bool(r.get("answer_empty") or r.get("answer_truncated")) | |
| st["d_bad"] = st["d_bad"] + 1 if bad else 0 | |
| if stop is None and st["d_bad"] >= 3: | |
| stop = "D: 3 risposte vuote/troncate di fila (ultima %s)" % tag | |
| sp.write_text(json.dumps(st)) | |
| if stop: | |
| print("STOP: " + stop) | |
| sys.exit(9) | |