File size: 2,072 Bytes
510314e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Corsa di conferma (preregistrata 17/10/2026, MAIN-RUN-CONFIRM.md): stesse 100 domande della corsa principale, con la
domanda resa non ambigua. Il banco intende "tool results for round N" come l'uscita dello strumento che PRECEDE il
messaggio "Round N: Guess ..." (verificato su 100/100 risposte ufficiali); la domanda lo dice ora esplicitamente.
Risposte ufficiali e scorer invariati. Crea alb-clar/ (dati con la nota, src condiviso) e le liste main-clar-*.txt."""
import json
import os
from pathlib import Path

B = Path("/mnt/mneme-nvme/proxy-ideas/alb-bench-v2")
SRC = B / "alb/data/benchmark"
DST = B / "alb-clar/data/benchmark"
NOTE = (" Note: in this dialogue, \"the tool results for round N\" means the tool output that appears just BEFORE the"
        " user message \"Round N: Guess ...\" (the result of the query made for the guess of round N), not the one"
        " after it.")
(B / "alb-clar").mkdir(exist_ok=True)
if not (B / "alb-clar/src").exists():
    os.symlink("../alb/src", B / "alb-clar/src")
for L in ("64k", "128k"):
    for t in ("count_frequency", "find_duplicates"):
        rel = Path("kf-c/%s/tool_response/%s_tool.jsonl" % (L, t))
        (DST / rel).parent.mkdir(parents=True, exist_ok=True)
        n = 0
        with open(SRC / rel) as fi, open(DST / rel, "w") as fo:
            for line in fi:
                r = json.loads(line)
                assert "round" in r["question"], r["question"]
                r["question"] = r["question"].rstrip() + NOTE
                fo.write(json.dumps(r, ensure_ascii=False) + "\n")
                n += 1
        print(rel, n)
    src = (B / ("scripts/main-%s.txt" % L)).read_text().splitlines()
    out = ["# CONFERMA (domanda non ambigua, MAIN-RUN-CONFIRM.md); dati in alb-clar/; stesse righe di main-%s.txt" % L]
    out += [l for l in src if l and not l.startswith("#")]
    (B / ("scripts/main-clar-%s.txt" % L)).write_text("\n".join(out) + "\n")
print("esempio:", json.loads(open(DST / "kf-c/64k/tool_response/count_frequency_tool.jsonl").readline())["question"])