Download tools/show_run3.py from RightNowAI/duplex-v0: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/RightNowAI/duplex-v0/resolve/main/tools/show_run3.py
- Command line
-
hf download hf://RightNowAI/duplex-v0/tools/show_run3.py
-
curl -L -o show_run3.py https://huggingface.co/RightNowAI/duplex-v0/resolve/main/tools/show_run3.py
2.01 kB
| """One table over the arms of a benchmark folder, from each arm's per-question files. | |
| python -m tools.show_run3 eval/results/bba3 [arm ...] | |
| """ | |
| import json | |
| import sys | |
| from pathlib import Path | |
| from eval.ws_client import percentiles | |
| root = Path(sys.argv[1]) | |
| arms = sys.argv[2:] or sorted(p.name for p in root.iterdir() if (p / "judge").is_dir()) | |
| def answer_ms(r): | |
| """Caller finished -> first audio of the answer itself (not of a lead-in). Older results have no such event: first audio.""" | |
| ev = [e for e in r["events"] if e["type"] == "reply.answer.first"] | |
| return (ev[-1]["t_client"] - r["question_s"]) * 1000 if ev else r["latency_ms"] | |
| print("| Arm | Questions | Right | First audio after, p50 / p90 (s) | Answer after, p50 / p90 (s) | Reasoning left at the end, p50 (s) | Heard false starts | Withdrawn unheard " | |
| "| Requests while listening | Replies needing no reasoning | Errors |") | |
| print("|---|---|---|---|---|---|---|---|---|---|---|") | |
| for arm in arms: | |
| rows = [json.loads(p.read_text(encoding="utf-8")) for p in sorted((root / arm / "judge").glob("q_*.json"))] | |
| if not rows: | |
| continue | |
| last = [([e for e in r["events"] if e["type"] == "reply.done"] or [{}])[-1] for r in rows] | |
| lat = percentiles([r["latency_ms"] for r in rows if r["replied"]]) | |
| th = percentiles([d.get("thought_ms") for d in last]) | |
| ans = percentiles([answer_ms(r) for r in rows if r["replied"]]) | |
| s = lambda v: "-" if v is None else f"{v / 1000:.1f}" | |
| print(f"| {arm} | {len(rows)} | {sum(r['correct'] for r in rows)} | {s(lat.get('p50'))} / {s(lat.get('p90'))} | {s(ans.get('p50'))} / {s(ans.get('p90'))} | {s(th.get('p50'))} " | |
| f"| {sum(r['replies_cut_off'] > 0 for r in rows)} | {sum(sum(1 for e in r['events'] if e['type'] == 'reply.withdrawn') for r in rows)} " | |
| f"| {sum(sum(1 for e in r['events'] if e.get('label') == 'LISTEN') for r in rows)} | {sum(bool(d.get('thought_ready')) for d in last)} " | |
| f"| {sum(bool(r['error']) for r in rows)} |") | |