tuieval 0.2.0.dev145__tar.gz → 0.2.0.dev147__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/CHANGELOG.md +1 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/PKG-INFO +2 -1
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/README.md +1 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/models.md +6 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/_version.py +2 -2
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/compare.py +43 -1
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/insights.py +4 -4
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/pta.py +10 -4
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/run_evals.py +50 -14
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/tui.py +51 -4
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/verdict.py +20 -6
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/tests/test_tuieval.py +63 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/.gitignore +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/LICENSE +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/RELEASING.md +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/agent-packs.md +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/README.md +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/favicon.ico +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/readme-header.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/social-preview.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-1024.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-128.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-16.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-16.svg +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-256.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-32.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-48.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-512.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-64.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon-animated.svg +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/brand/tuieval-icon.svg +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/tui-answer-reasoning.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/tui-run-reasoning.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/images/tui-setup.png +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/docs/writing-packs.md +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/pyproject.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/__init__.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/__main__.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/agents.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/builtin.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/cli.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/client.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/dates.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/doctor.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/engine.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/export.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/graders/__init__.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/graders/answer.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/graders/code.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/graders/rag.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/graders/reply.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/graders/tool_call.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/logs.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/machines.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/onboard.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/packs.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/profiles.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/remove.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/scaffold.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/selftest.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/models.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/answer/pack.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/answer/system.txt +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/answer/tests.yaml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/code/pack.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/code/system.txt +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/code/tests.yaml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/rag/pack.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/rag/system.txt +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/rag/tests.yaml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/reply/pack.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/reply/system.txt +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/reply/tests.yaml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/pack.toml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/system.txt +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/tests.yaml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/tools.yaml +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/tune.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/watch_proxy.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/workspace.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/yamlout.py +0 -0
- {tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/tests/mock_server.py +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Results from more than one machine: a **Machine** dropdown in Results keeps only the answers that ran on one machine, in every tab (hosted models' answers count from any machine unless **Hosted from any machine** is unticked). `--ran-on <id>` (and `--ran-on-strict`) on `tuieval pta`, `compare`, `verdict`, `report` and `insights`.
|
|
5
6
|
- Fix: the PTA index's Score ≥ filter did nothing once a pack was picked; it now filters the models that answered the pack (models picked by hand are still always shown).
|
|
6
7
|
- PTA index: models scoring below 85% are left out by default (listed with their score), unless every model is. The **Score ≥** dropdown (`tuieval pta --min-score N`) sets the minimum, Any score shows all; picked models are always shown.
|
|
7
8
|
- Per question → Comparison: a **Pass rate** column beside Passed, the share of answers right with repeats included (shown when some model has repeats).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: tuieval
|
|
3
|
-
Version: 0.2.0.
|
|
3
|
+
Version: 0.2.0.dev147
|
|
4
4
|
Summary: Evaluate local and frontier LLMs on your own questions: accuracy, speed, tokens and PASS/FAIL verdicts, in the terminal.
|
|
5
5
|
Project-URL: Homepage, https://github.com/ashe-wb/tuieval
|
|
6
6
|
Project-URL: Issues, https://github.com/ashe-wb/tuieval/issues
|
|
@@ -163,6 +163,7 @@ tuieval report # the same with evidence, as a mar
|
|
|
163
163
|
tuieval history # every verdict change over time
|
|
164
164
|
tuieval compare --speed --pairwise --failures # scorecards
|
|
165
165
|
tuieval compare --reference <model> --packs X # each model vs one: better, tie or worse
|
|
166
|
+
tuieval pta --ran-on <machine> # only the answers that ran on one machine
|
|
166
167
|
tuieval selftest # check every test's reference and wrong answers
|
|
167
168
|
tuieval items # tests that don't separate models or look broken
|
|
168
169
|
tuieval logs # follow the server log of the model running now
|
|
@@ -137,6 +137,7 @@ tuieval report # the same with evidence, as a mar
|
|
|
137
137
|
tuieval history # every verdict change over time
|
|
138
138
|
tuieval compare --speed --pairwise --failures # scorecards
|
|
139
139
|
tuieval compare --reference <model> --packs X # each model vs one: better, tie or worse
|
|
140
|
+
tuieval pta --ran-on <machine> # only the answers that ran on one machine
|
|
140
141
|
tuieval selftest # check every test's reference and wrong answers
|
|
141
142
|
tuieval items # tests that don't separate models or look broken
|
|
142
143
|
tuieval logs # follow the server log of the model running now
|
|
@@ -86,6 +86,12 @@ With `nvidia-smi` (Nvidia) or `amd-smi` / `rocm-smi` (AMD) installed, tuieval re
|
|
|
86
86
|
|
|
87
87
|
Windows isn't supported (WSL2 works like Linux).
|
|
88
88
|
|
|
89
|
+
### Results from one machine
|
|
90
|
+
|
|
91
|
+
Results from several machines (a synced workspace) are shown together. Once answers come from more than one, Results has a **Machine** dropdown at the top: pick one, and every tab (PTA index, Insights, Production readiness, Per question, Failures) keeps only the answers that ran there. Hosted models' answers stay whatever machine tuieval ran on, since an API's answer doesn't depend on it; untick **Hosted from any machine** to keep only theirs from that machine too. Verdicts then come from that machine's answers alone, so they can differ from the all-machines ones (the tab says so). Answers that recorded no machine are listed as `unknown`.
|
|
92
|
+
|
|
93
|
+
On the command line, `--ran-on <id>` does the same for `tuieval pta`, `compare`, `verdict`, `report` and `insights`, and `--ran-on-strict` drops hosted models' answers from other machines. It's not `compare --machine <id>`, which shows speeds as they'd be on that machine; the two combine.
|
|
94
|
+
|
|
89
95
|
## Several models at a time
|
|
90
96
|
|
|
91
97
|
By default a run serves one model at a time. On a machine with room for more, set `parallel_models = 2` (or more) under `[machines.<id>]`, type a number in **Models at a time** on the TUI's setup screen (blank uses the machine's setting), or pass `tuieval run --parallel N`.
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.2.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2, 0, '
|
|
21
|
+
__version__ = version = '0.2.0.dev147'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 0, 'dev147')
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -4,6 +4,8 @@ Usage:
|
|
|
4
4
|
tuieval compare # everything in results/<model>/<pack>.json
|
|
5
5
|
tuieval compare --speed # speed & tokens table (TTFT, tok/s, tokens, memory)
|
|
6
6
|
tuieval compare --machine m3max-64gb # speed on another machine (measured there, or projected)
|
|
7
|
+
tuieval compare --ran-on m3max-64gb # only the answers that ran there (hosted models: any machine;
|
|
8
|
+
# --ran-on-strict: those too)
|
|
7
9
|
tuieval compare --pairwise --failures # is each difference real? which tests failed?
|
|
8
10
|
tuieval compare --reference MODEL # every model paired against one: better, tie or worse
|
|
9
11
|
tuieval compare --packs coding,rag # only these packs (works with every option)
|
|
@@ -63,6 +65,7 @@ def _load_native(data):
|
|
|
63
65
|
"severity": r.get("severity"), "group": r.get("group"), "repeat": r.get("repeat", 0),
|
|
64
66
|
"difficulty": r.get("difficulty", "unrated"),
|
|
65
67
|
"machine": r.get("machine") or run.get("machine"), "prompt_tokens": r.get("prompt_tokens"),
|
|
68
|
+
"hosted": info["hosted"], # an API's answer: it doesn't depend on the machine tuieval ran on (ran_on)
|
|
66
69
|
# other models served at the same time (parallel_models): its speed was shared with them
|
|
67
70
|
"alongside": r.get("ran_alongside") or [],
|
|
68
71
|
"agent": r.get("agent"), # an agent pack's task: the agent's stats (see agents.py)
|
|
@@ -95,12 +98,41 @@ def load(paths):
|
|
|
95
98
|
def local(along):
|
|
96
99
|
return [l for l in along if l not in labels and not l.startswith(tuple(prefixes))]
|
|
97
100
|
for row in rows:
|
|
101
|
+
row["hosted"] = row["hosted"] or row["model"] in labels or row["model"].startswith(tuple(prefixes) or ("\0",))
|
|
98
102
|
row["alongside"] = [] if row["model"] in labels else local(row["alongside"])
|
|
99
103
|
for i in infos:
|
|
100
104
|
i["loaded_alongside"] = [] if i["label"] in labels else local(i["loaded_alongside"])
|
|
101
105
|
return rows, infos
|
|
102
106
|
|
|
103
107
|
|
|
108
|
+
UNKNOWN_MACHINE = "unknown" # answers that recorded no machine
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def machine_of(r):
|
|
112
|
+
"""The machine an answer (a row, or a stored record) ran on, or UNKNOWN_MACHINE."""
|
|
113
|
+
return r.get("machine") or UNKNOWN_MACHINE
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def machines(rows):
|
|
117
|
+
"""{machine id: answers}, most answers first: the machines these answers ran on."""
|
|
118
|
+
return dict(collections.Counter(machine_of(r) for r in rows).most_common())
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def ran_on(rows, machine, hosted_any=True):
|
|
122
|
+
"""The answers that ran on machine (None: all of them). hosted_any: hosted models' answers are kept
|
|
123
|
+
whatever machine tuieval ran on, since an API's answer doesn't depend on it."""
|
|
124
|
+
if not machine:
|
|
125
|
+
return rows
|
|
126
|
+
return [r for r in rows if machine_of(r) == machine or (hosted_any and r.get("hosted"))]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def ran_on_note(machine, hosted_any=True):
|
|
130
|
+
"""" on m3max-64gb" (hosted models from any machine) for a scope sentence, or "" for every machine."""
|
|
131
|
+
if not machine:
|
|
132
|
+
return ""
|
|
133
|
+
return f" on {machine}" + (" (hosted models: any machine)" if hosted_any else "")
|
|
134
|
+
|
|
135
|
+
|
|
104
136
|
def _configs(paths):
|
|
105
137
|
"""The models.toml configs of the workspaces these results/<label>/<pack>.json are from (unreadable
|
|
106
138
|
ones left out)."""
|
|
@@ -663,13 +695,23 @@ def main(argv):
|
|
|
663
695
|
machine_arg = argv[argv.index("--machine") + 1] if "--machine" in argv else None
|
|
664
696
|
ref = argv[argv.index("--reference") + 1] if "--reference" in argv else None
|
|
665
697
|
only_packs = argv[argv.index("--packs") + 1].split(",") if "--packs" in argv else None
|
|
666
|
-
|
|
698
|
+
ran = argv[argv.index("--ran-on") + 1] if "--ran-on" in argv else None
|
|
699
|
+
values = (log_dir, machine_arg, ref, ",".join(only_packs) if only_packs else None, ran)
|
|
667
700
|
paths = [a for a in argv if not a.startswith("--") and a not in values] or default_paths()
|
|
668
701
|
if only_packs:
|
|
669
702
|
paths = [p for p in paths if os.path.basename(p)[:-len(".json")] in only_packs]
|
|
670
703
|
if not paths:
|
|
671
704
|
sys.exit(__doc__ + "\n(no results found in results/<model>/<pack>.json: run some evals first)")
|
|
672
705
|
rows, infos = load(paths)
|
|
706
|
+
if "--ran-on-strict" in flags and not ran:
|
|
707
|
+
sys.exit("--ran-on-strict needs --ran-on MACHINE")
|
|
708
|
+
if ran:
|
|
709
|
+
known = machines(rows)
|
|
710
|
+
if ran not in known:
|
|
711
|
+
sys.exit(f"no answers ran on {ran!r}; machines with answers: "
|
|
712
|
+
+ ", ".join(f"{m} ({n})" for m, n in known.items()))
|
|
713
|
+
rows = ran_on(rows, ran, "--ran-on-strict" not in flags)
|
|
714
|
+
print(f"Only the answers{ran_on_note(ran, '--ran-on-strict' not in flags)}.")
|
|
673
715
|
if ref:
|
|
674
716
|
if ref not in {r["model"] for r in rows}:
|
|
675
717
|
sys.exit(f"no results for reference model {ref!r}" + (f" in {', '.join(only_packs)}" if only_packs else ""))
|
|
@@ -476,12 +476,12 @@ def _dur(secs):
|
|
|
476
476
|
|
|
477
477
|
|
|
478
478
|
# ---------------------------------------------------------------- 7 next runs
|
|
479
|
-
def next_runs(engine, models, ranking, limit=4, skip=()):
|
|
479
|
+
def next_runs(engine, models, ranking, limit=4, skip=(), ran_on=None):
|
|
480
480
|
"""ranking: models best first (by the reference comparison, else accuracy). The Certify runs that
|
|
481
481
|
would settle the open verdicts of the strongest `limit` models, with their time."""
|
|
482
482
|
from . import verdict
|
|
483
483
|
title = "Next runs"
|
|
484
|
-
table = verdict.readiness(engine, models)
|
|
484
|
+
table = verdict.readiness(engine, models, ran_on)
|
|
485
485
|
times = engine.answer_times()
|
|
486
486
|
med = {l: {p: statistics.median(ts) for p, ts in pp.items() if ts} for l, pp in times.items()}
|
|
487
487
|
lines, actions, total = [], [], 0
|
|
@@ -525,7 +525,7 @@ def ranking(rows, models, ref):
|
|
|
525
525
|
return sorted(acc, key=lambda m: (key(m), m))
|
|
526
526
|
|
|
527
527
|
|
|
528
|
-
def panels(rows, models, packs, ref=None, bases=None, by="tokens", engine=None):
|
|
528
|
+
def panels(rows, models, packs, ref=None, bases=None, by="tokens", engine=None, ran_on=None):
|
|
529
529
|
"""All seven (the last needs the engine: verdicts and answer times). Models are shown best first."""
|
|
530
530
|
order = ranking(rows, models, ref)
|
|
531
531
|
order += [m for m in models if m not in order]
|
|
@@ -533,7 +533,7 @@ def panels(rows, models, packs, ref=None, bases=None, by="tokens", engine=None):
|
|
|
533
533
|
out = [vs_reference(rows, order, ref), use_cases(rows, order, packs), vs_base(rows, order, bases or {}, packs),
|
|
534
534
|
failure_mix(rows, order), accuracy_cost(rows, order, by, hosted=hosted), question_health(rows, order)]
|
|
535
535
|
if engine is not None:
|
|
536
|
-
out.append(next_runs(engine, order, order, skip={ref}))
|
|
536
|
+
out.append(next_runs(engine, order, order, skip={ref}, ran_on=ran_on))
|
|
537
537
|
return out
|
|
538
538
|
|
|
539
539
|
|
|
@@ -288,7 +288,8 @@ def scope_note(result, models):
|
|
|
288
288
|
"""What the scores compare, in a sentence."""
|
|
289
289
|
if not result["questions"]:
|
|
290
290
|
return "These models have no question in common yet, so there's nothing to compare."
|
|
291
|
-
return (f"Compared on the {result['questions']} questions all {len(result['models'])} model(s) answered
|
|
291
|
+
return (f"Compared on the {result['questions']} questions all {len(result['models'])} model(s) answered"
|
|
292
|
+
f"{compare.ran_on_note(*(result.get('ran_on') or (None,)))}. "
|
|
292
293
|
"P parsimony (tokens) and T time: bars as long as the tokens / time used (shorter is better), "
|
|
293
294
|
"and how many times the leanest / fastest model's (1.0×, ★ in the table). A accuracy: answers right "
|
|
294
295
|
"(longer is better); score: partial credit, e.g. 5 of 6 checks passed is 83% (shown when it differs)"
|
|
@@ -303,14 +304,19 @@ def scope_note(result, models):
|
|
|
303
304
|
if any(x.get("over") for x in result["models"]) else ""))
|
|
304
305
|
|
|
305
306
|
|
|
306
|
-
def for_engine(e, labels=None, packs=None, results_dir=None, sort="accuracy", min_score=MIN_SCORE):
|
|
307
|
-
"""(result, models) from a workspace's finished results (results on their way out excluded).
|
|
307
|
+
def for_engine(e, labels=None, packs=None, results_dir=None, sort="accuracy", min_score=MIN_SCORE, ran_on=None):
|
|
308
|
+
"""(result, models) from a workspace's finished results (results on their way out excluded).
|
|
309
|
+
ran_on: (machine, hosted_any) to keep only the answers that ran on that machine (compare.ran_on)."""
|
|
308
310
|
paths = [p for p in compare.default_paths(results_dir or e.results_dir) if not e.superseded(p)]
|
|
309
311
|
rows, infos = compare.load(paths) if paths else ([], [])
|
|
310
312
|
if packs:
|
|
311
313
|
rows = [r for r in rows if r["suite"] in packs]
|
|
314
|
+
if ran_on:
|
|
315
|
+
rows = compare.ran_on(rows, *ran_on)
|
|
312
316
|
models = sorted({r["model"] for r in rows} & set(labels) if labels else {r["model"] for r in rows})
|
|
313
|
-
|
|
317
|
+
result = index(rows, models if labels else None, memory_gb(infos), sort, min_score)
|
|
318
|
+
result["ran_on"] = ran_on
|
|
319
|
+
return result, models
|
|
314
320
|
|
|
315
321
|
|
|
316
322
|
def markdown(result, models):
|
|
@@ -305,6 +305,30 @@ def cmd_regrade(argv):
|
|
|
305
305
|
print(f"verdict changed: {h['model']} {h['use_case']}: {h.get('previous')} -> {h['status']}")
|
|
306
306
|
|
|
307
307
|
|
|
308
|
+
def add_ran_on(p):
|
|
309
|
+
"""--ran-on and --ran-on-strict on a results command."""
|
|
310
|
+
p.add_argument("--ran-on", metavar="MACHINE",
|
|
311
|
+
help="only the answers that ran on this machine (its id, as tuieval machines shows it); "
|
|
312
|
+
"hosted models' answers count from any machine")
|
|
313
|
+
p.add_argument("--ran-on-strict", action="store_true",
|
|
314
|
+
help="with --ran-on: hosted models' answers must have run there too")
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def ran_on_arg(a, e):
|
|
318
|
+
"""(machine, hosted_any) from --ran-on, or None. Exits naming the machines with answers when none ran there."""
|
|
319
|
+
if not a.ran_on:
|
|
320
|
+
if a.ran_on_strict:
|
|
321
|
+
sys.exit("--ran-on-strict needs --ran-on MACHINE")
|
|
322
|
+
return None
|
|
323
|
+
from . import compare
|
|
324
|
+
paths = compare.default_paths(e.results_dir)
|
|
325
|
+
known = compare.machines(compare.load(paths)[0] if paths else [])
|
|
326
|
+
if a.ran_on not in known:
|
|
327
|
+
sys.exit(f"no answers ran on {a.ran_on!r}; machines with answers: "
|
|
328
|
+
+ (", ".join(f"{m} ({n})" for m, n in known.items()) or "none yet"))
|
|
329
|
+
return a.ran_on, not a.ran_on_strict
|
|
330
|
+
|
|
331
|
+
|
|
308
332
|
MARK = {"PASS": "\033[32mPASS\033[0m", "FAIL": "\033[31mFAIL\033[0m",
|
|
309
333
|
"INCONCLUSIVE": "\033[33mINCONCLUSIVE\033[0m", "NO DATA": "-"}
|
|
310
334
|
|
|
@@ -312,14 +336,18 @@ MARK = {"PASS": "\033[32mPASS\033[0m", "FAIL": "\033[31mFAIL\033[0m",
|
|
|
312
336
|
def cmd_verdict(argv):
|
|
313
337
|
p = argparse.ArgumentParser(prog="tuieval verdict", description="Production readiness per model and use case.")
|
|
314
338
|
p.add_argument("--only", help="comma-separated model labels")
|
|
339
|
+
add_ran_on(p)
|
|
315
340
|
p.add_argument("--models")
|
|
316
341
|
p.add_argument("--results-dir")
|
|
317
342
|
a = p.parse_args(argv)
|
|
318
|
-
from . import verdict
|
|
343
|
+
from . import compare, verdict
|
|
319
344
|
e = engine.Engine(models_path=a.models, results_dir=a.results_dir)
|
|
320
|
-
|
|
345
|
+
ran_on = ran_on_arg(a, e)
|
|
346
|
+
table = verdict.readiness(e, a.only.split(",") if a.only else None, ran_on)
|
|
321
347
|
if not table:
|
|
322
|
-
sys.exit("no results yet: tuieval run first")
|
|
348
|
+
sys.exit("no results yet: tuieval run first" if not ran_on else f"no verdicts from answers on {a.ran_on}")
|
|
349
|
+
if ran_on:
|
|
350
|
+
print(f"{DIM}Verdicts from the answers{compare.ran_on_note(*ran_on)} only.{RESET}")
|
|
323
351
|
summary = verdict.plain_summary(table)
|
|
324
352
|
print(f"{BOLD}In short{RESET}")
|
|
325
353
|
certify = {}
|
|
@@ -335,7 +363,7 @@ def cmd_verdict(argv):
|
|
|
335
363
|
f"clears the pack's gate):{RESET}")
|
|
336
364
|
for label, groups in table.items():
|
|
337
365
|
print(f"\n{BOLD}{label}{RESET}")
|
|
338
|
-
lat = verdict.latency_table(e, [label], {label: groups}).get(label, {})
|
|
366
|
+
lat = verdict.latency_table(e, [label], {label: groups}, ran_on).get(label, {})
|
|
339
367
|
for group, (v, packs) in groups.items():
|
|
340
368
|
print(f" {group:18s} {MARK[v.status]}")
|
|
341
369
|
for name, pv in packs.items():
|
|
@@ -347,10 +375,11 @@ def cmd_verdict(argv):
|
|
|
347
375
|
print(f" {DIM}speed on{RESET} {mid:18s} {color}{x.summary}{RESET}")
|
|
348
376
|
|
|
349
377
|
|
|
350
|
-
def report_markdown(e, labels=None):
|
|
351
|
-
from . import verdict
|
|
352
|
-
table = verdict.readiness(e, labels)
|
|
353
|
-
lines = ["# Production readiness report", "", f"Generated {time.strftime('%Y-%m-%d %H:%M')}."
|
|
378
|
+
def report_markdown(e, labels=None, ran_on=None):
|
|
379
|
+
from . import compare, verdict
|
|
380
|
+
table = verdict.readiness(e, labels, ran_on)
|
|
381
|
+
lines = ["# Production readiness report", "", f"Generated {time.strftime('%Y-%m-%d %H:%M')}."
|
|
382
|
+
+ (f" From the answers{compare.ran_on_note(*ran_on)} only." if ran_on else ""), "",
|
|
354
383
|
"PASS needs a full certification run, zero critical failures across enough trials, and accuracy "
|
|
355
384
|
"whose 95% lower bound clears the gate. See verdict.py for the rules and each pack.toml for its gate.", ""]
|
|
356
385
|
lines += ["## In short", ""]
|
|
@@ -361,7 +390,7 @@ def report_markdown(e, labels=None):
|
|
|
361
390
|
lines += ["| model | " + " | ".join(groups) + " |", "|---|" + "---|" * len(groups)]
|
|
362
391
|
for label, gs in table.items():
|
|
363
392
|
lines.append(f"| {label} | " + " | ".join(gs[g][0].status if g in gs else "-" for g in groups) + " |")
|
|
364
|
-
lat = verdict.latency_table(e, labels, table)
|
|
393
|
+
lat = verdict.latency_table(e, labels, table, ran_on)
|
|
365
394
|
for label, gs in table.items():
|
|
366
395
|
lines += ["", f"## {label}"]
|
|
367
396
|
for group, (v, packs) in gs.items():
|
|
@@ -380,7 +409,7 @@ def report_markdown(e, labels=None):
|
|
|
380
409
|
+ (f"; p90 {ev['p90_s']:.1f}s" if ev.get("p90_s") is not None else "")
|
|
381
410
|
+ f"; truncated {100 * ev['truncation']:.1f}%"
|
|
382
411
|
+ (f"; consistency {100 * ev['consistency']:.0f}% of {ev['groups']} groups" if ev.get("consistency") is not None else ""))
|
|
383
|
-
recs =
|
|
412
|
+
recs = verdict.records(e, label, name, ran_on)
|
|
384
413
|
from .compare import pct
|
|
385
414
|
levels = []
|
|
386
415
|
for lvl in ("easy", "medium", "hard"):
|
|
@@ -392,7 +421,7 @@ def report_markdown(e, labels=None):
|
|
|
392
421
|
for ex in ev.get("critical_examples", []):
|
|
393
422
|
lines.append(f" - critical: {ex}")
|
|
394
423
|
from . import pta
|
|
395
|
-
lines += [""] + pta.markdown(*pta.for_engine(e, labels))
|
|
424
|
+
lines += [""] + pta.markdown(*pta.for_engine(e, labels, ran_on=ran_on))
|
|
396
425
|
return "\n".join(lines) + "\n"
|
|
397
426
|
|
|
398
427
|
|
|
@@ -408,6 +437,7 @@ def cmd_pta(argv):
|
|
|
408
437
|
p.add_argument("--min-score", type=float, default=None,
|
|
409
438
|
help="leave out models scoring below this %% (default 85; 0 shows every model; "
|
|
410
439
|
"models named with --only are always shown)")
|
|
440
|
+
add_ran_on(p)
|
|
411
441
|
p.add_argument("--models")
|
|
412
442
|
p.add_argument("--results-dir")
|
|
413
443
|
a = p.parse_args(argv)
|
|
@@ -417,7 +447,8 @@ def cmd_pta(argv):
|
|
|
417
447
|
labels = [x.strip() for x in a.only.split(",")] if a.only else None
|
|
418
448
|
packs = [x.strip() for x in a.packs.split(",")] if a.packs else None
|
|
419
449
|
result, models = pta.for_engine(e, labels, packs, sort=a.sort,
|
|
420
|
-
min_score=pta.MIN_SCORE if a.min_score is None else a.min_score
|
|
450
|
+
min_score=pta.MIN_SCORE if a.min_score is None else a.min_score,
|
|
451
|
+
ran_on=ran_on_arg(a, e))
|
|
421
452
|
out = Console(highlight=False)
|
|
422
453
|
if not models:
|
|
423
454
|
sys.exit("no finished results to compare" + (" for those models or packs" if labels or packs else ""))
|
|
@@ -450,6 +481,7 @@ def cmd_insights(argv):
|
|
|
450
481
|
"most accurate)")
|
|
451
482
|
p.add_argument("--packs", help="comma-separated packs (default: all)")
|
|
452
483
|
p.add_argument("--cost", choices=("tokens", "time"), default="tokens", help="the cost axis of the accuracy chart")
|
|
484
|
+
add_ran_on(p)
|
|
453
485
|
p.add_argument("--models")
|
|
454
486
|
p.add_argument("--results-dir")
|
|
455
487
|
a = p.parse_args(argv)
|
|
@@ -460,6 +492,9 @@ def cmd_insights(argv):
|
|
|
460
492
|
rows, _ = compare.load(paths) if paths else ([], [])
|
|
461
493
|
if a.packs:
|
|
462
494
|
rows = [r for r in rows if r["suite"] in {x.strip() for x in a.packs.split(",")}]
|
|
495
|
+
ran_on = ran_on_arg(a, e)
|
|
496
|
+
if ran_on:
|
|
497
|
+
rows = compare.ran_on(rows, *ran_on)
|
|
463
498
|
wanted = a.reference or e.cfg["defaults"].get("reference")
|
|
464
499
|
picked = {x.strip() for x in a.only.split(",")} if a.only else None
|
|
465
500
|
rows, models = insights.prepare(rows, picked, wanted)
|
|
@@ -470,7 +505,7 @@ def cmd_insights(argv):
|
|
|
470
505
|
ref = insights.default_reference(rows, models, wanted)
|
|
471
506
|
bases = {m["label"]: m["base"] for m in e.cfg["models"] if m.get("base")}
|
|
472
507
|
out = Console(highlight=False)
|
|
473
|
-
for i, panel in enumerate(insights.panels(rows, models, e.packs, ref, bases, a.cost, engine=e), 1):
|
|
508
|
+
for i, panel in enumerate(insights.panels(rows, models, e.packs, ref, bases, a.cost, engine=e, ran_on=ran_on), 1):
|
|
474
509
|
out.print(insights.render(panel, i), soft_wrap=True)
|
|
475
510
|
out.print()
|
|
476
511
|
|
|
@@ -479,11 +514,12 @@ def cmd_report(argv):
|
|
|
479
514
|
p = argparse.ArgumentParser(prog="tuieval report", description="Write the readiness report as markdown.")
|
|
480
515
|
p.add_argument("-o", "--output", help="default: reports/readiness-<date>.md")
|
|
481
516
|
p.add_argument("--only", help="comma-separated model labels")
|
|
517
|
+
add_ran_on(p)
|
|
482
518
|
p.add_argument("--models")
|
|
483
519
|
p.add_argument("--results-dir")
|
|
484
520
|
a = p.parse_args(argv)
|
|
485
521
|
e = engine.Engine(models_path=a.models, results_dir=a.results_dir)
|
|
486
|
-
text = report_markdown(e, a.only.split(",") if a.only else None)
|
|
522
|
+
text = report_markdown(e, a.only.split(",") if a.only else None, ran_on_arg(a, e))
|
|
487
523
|
out = a.output or workspace.path("reports", time.strftime("readiness-%Y%m%d-%H%M.md"))
|
|
488
524
|
os.makedirs(os.path.dirname(os.path.abspath(out)), exist_ok=True)
|
|
489
525
|
with open(out, "w") as f:
|
|
@@ -2938,6 +2938,9 @@ class ResultsScreen(Screen):
|
|
|
2938
2938
|
yield Header()
|
|
2939
2939
|
with Horizontal(id="results-top"):
|
|
2940
2940
|
yield Static(id="results-info")
|
|
2941
|
+
# which machine the answers ran on: shown once answers come from more than one (fill)
|
|
2942
|
+
yield Select([("All machines", "")], id="results-machine", allow_blank=False, value="")
|
|
2943
|
+
yield Checkbox("Hosted from any machine", True, id="results-hosted-any")
|
|
2941
2944
|
if self.smoke_dir:
|
|
2942
2945
|
yield Button("Show this Smoke run's results", id="toggle-smoke")
|
|
2943
2946
|
with TabbedContent(initial="tab-pta"):
|
|
@@ -3067,6 +3070,7 @@ class ResultsScreen(Screen):
|
|
|
3067
3070
|
self.fill_pta()
|
|
3068
3071
|
return
|
|
3069
3072
|
rows, infos = compare.load(paths)
|
|
3073
|
+
rows, self.partial_rows = self.machine_filter(rows, self.partial_rows)
|
|
3070
3074
|
notes = compare.settings_notes(infos)
|
|
3071
3075
|
smoke = os.path.abspath(results_dir) != os.path.abspath(self.app.engine.results_dir)
|
|
3072
3076
|
info.update(f"{len(paths)} {'Smoke ' if smoke else ''}result files in {os.path.relpath(results_dir)}/" + banner
|
|
@@ -3081,6 +3085,42 @@ class ResultsScreen(Screen):
|
|
|
3081
3085
|
self.fill_insights()
|
|
3082
3086
|
self.sort_tables()
|
|
3083
3087
|
|
|
3088
|
+
def ran_on(self):
|
|
3089
|
+
"""(machine, hosted_any) picked under Machine, or None for every machine (kept for the session)."""
|
|
3090
|
+
machine, hosted_any = getattr(self.app, "results_ran_on", ("", True))
|
|
3091
|
+
return (machine, hosted_any) if machine else None
|
|
3092
|
+
|
|
3093
|
+
def machine_filter(self, rows, partial):
|
|
3094
|
+
"""The Machine dropdown (every machine these answers ran on; shown when there's more than one, or
|
|
3095
|
+
one is picked) and the answers it keeps: (rows, partial rows)."""
|
|
3096
|
+
known = compare.machines(rows + partial)
|
|
3097
|
+
machine, hosted_any = getattr(self.app, "results_ran_on", ("", True))
|
|
3098
|
+
if machine and machine not in known: # no answers from it here (e.g. smoke results): every machine
|
|
3099
|
+
machine = ""
|
|
3100
|
+
sel, box = self.query_one("#results-machine", Select), self.query_one("#results-hosted-any", Checkbox)
|
|
3101
|
+
options = [("All machines", "")] + [(f"{m} ({n:,} answers)", m) for m, n in known.items()]
|
|
3102
|
+
with sel.prevent(Select.Changed):
|
|
3103
|
+
if [v for _, v in options] != getattr(self, "machine_values", None):
|
|
3104
|
+
self.machine_values = [v for _, v in options]
|
|
3105
|
+
sel.set_options(options)
|
|
3106
|
+
sel.value = machine
|
|
3107
|
+
with box.prevent(Checkbox.Changed):
|
|
3108
|
+
box.value = hosted_any
|
|
3109
|
+
sel.display = len(known) > 1 or bool(machine)
|
|
3110
|
+
box.display = bool(machine)
|
|
3111
|
+
if not machine:
|
|
3112
|
+
return rows, partial
|
|
3113
|
+
return compare.ran_on(rows, machine, hosted_any), compare.ran_on(partial, machine, hosted_any)
|
|
3114
|
+
|
|
3115
|
+
@on(Select.Changed, "#results-machine")
|
|
3116
|
+
@on(Checkbox.Changed, "#results-hosted-any")
|
|
3117
|
+
def machine_changed(self):
|
|
3118
|
+
"""A machine picked (or All machines), or hosted models' answers kept or not: every tab follows."""
|
|
3119
|
+
self.app.results_ran_on = (self.query_one("#results-machine", Select).value or "",
|
|
3120
|
+
self.query_one("#results-hosted-any", Checkbox).value)
|
|
3121
|
+
if getattr(self, "rows", None) is not None:
|
|
3122
|
+
self.reload()
|
|
3123
|
+
|
|
3084
3124
|
def fill_failures(self):
|
|
3085
3125
|
"""Every wrong answer, of the models picked (Models: shared with the other tabs), of the kind picked
|
|
3086
3126
|
(insights.kind: near miss, partly right, wrong, cut off, …)."""
|
|
@@ -3276,7 +3316,8 @@ class ResultsScreen(Screen):
|
|
|
3276
3316
|
main = os.path.abspath(self.results_dir or e.results_dir) == os.path.abspath(e.results_dir)
|
|
3277
3317
|
bases = {m["label"]: m["base"] for m in e.cfg["models"] if m.get("base")}
|
|
3278
3318
|
by = self.query_one("#ins-cost", Select).value or "tokens"
|
|
3279
|
-
out = insights.panels(rows, models, e.packs, ref, bases, by, engine=e if main else None
|
|
3319
|
+
out = insights.panels(rows, models, e.packs, ref, bases, by, engine=e if main else None,
|
|
3320
|
+
ran_on=self.ran_on())
|
|
3280
3321
|
body.update("\n\n".join(insights.render(p, i) for i, p in enumerate(out, 1)))
|
|
3281
3322
|
|
|
3282
3323
|
@on(Select.Changed, "#pta-min-score")
|
|
@@ -3369,6 +3410,7 @@ class ResultsScreen(Screen):
|
|
|
3369
3410
|
result = pta.index(rows, sorted(chosen) or None, pta.memory_gb(self.infos),
|
|
3370
3411
|
self.query_one("#pta-sort", Select).value or "accuracy",
|
|
3371
3412
|
self.query_one("#pta-min-score", Select).value or 0, score_models=by_pack)
|
|
3413
|
+
result["ran_on"] = self.ran_on()
|
|
3372
3414
|
self.query_one("#pta-note", Static).update(pta.scope_note(result, sorted(present)))
|
|
3373
3415
|
self.pta_result = result
|
|
3374
3416
|
removed = [m for m in self.pta_removed_now() if m in present]
|
|
@@ -3606,8 +3648,11 @@ class ResultsScreen(Screen):
|
|
|
3606
3648
|
help_text.update("[yellow]These are smoke-test results; they don't count toward production readiness."
|
|
3607
3649
|
"[/yellow]")
|
|
3608
3650
|
return
|
|
3609
|
-
|
|
3610
|
-
|
|
3651
|
+
ran_on = self.ran_on()
|
|
3652
|
+
help_text.update(self.READINESS_HELP + (f"\n[yellow]Verdicts from the answers{compare.ran_on_note(*ran_on)} "
|
|
3653
|
+
"only: with fewer answers a verdict can differ from all machines'.[/yellow]"
|
|
3654
|
+
if ran_on else ""))
|
|
3655
|
+
table = verdict.readiness(self.app.engine, None, ran_on)
|
|
3611
3656
|
short = ["[b]In short[/b]"] # one line per model; what to run next is in the table below
|
|
3612
3657
|
for label, sentence, todo in verdict.plain_summary(table):
|
|
3613
3658
|
short.append(f" [b]{rich_escape(label)}[/b]: {rich_escape(sentence)}")
|
|
@@ -3623,7 +3668,7 @@ class ResultsScreen(Screen):
|
|
|
3623
3668
|
when = collections.defaultdict(list)
|
|
3624
3669
|
for r in self.rows:
|
|
3625
3670
|
when[(r["model"], r["suite"])].append(dates.answered_at(r.get("raw") or {}))
|
|
3626
|
-
lat = verdict.latency_table(self.app.engine, None, table)
|
|
3671
|
+
lat = verdict.latency_table(self.app.engine, None, table, ran_on)
|
|
3627
3672
|
machine_ids = [mc.id for mc in self.app.engine.machines()]
|
|
3628
3673
|
lt = self.query_one("#latency", DataTable)
|
|
3629
3674
|
lt.add_columns("Model", "Use case", *[f"{mid}{' (here)' if i == 0 else ''}" for i, mid in enumerate(machine_ids)])
|
|
@@ -3706,6 +3751,8 @@ class EvalsApp(App):
|
|
|
3706
3751
|
#tune-log { height: 1fr; }
|
|
3707
3752
|
#results-top { height: auto; }
|
|
3708
3753
|
#results-info { width: 1fr; height: auto; }
|
|
3754
|
+
#results-top #results-machine { width: 40; }
|
|
3755
|
+
#results-top #results-hosted-any { width: auto; }
|
|
3709
3756
|
#toggle-smoke { width: auto; min-width: 32; }
|
|
3710
3757
|
#pq-controls { height: 3; }
|
|
3711
3758
|
#pta-controls { height: 3; }
|
|
@@ -229,10 +229,23 @@ def machine_speeds(engine, m, machine):
|
|
|
229
229
|
return speeds, (None if sv.fits else sv.fit_note)
|
|
230
230
|
|
|
231
231
|
|
|
232
|
-
def
|
|
232
|
+
def records(engine, label, pack_name, ran_on=None):
|
|
233
|
+
"""engine.records, keeping only the answers that ran on a machine when ran_on = (machine, hosted_any)
|
|
234
|
+
is given (a hosted model's answers stay, with hosted_any: they don't depend on the machine)."""
|
|
235
|
+
recs = engine.records(label, pack_name)
|
|
236
|
+
if not ran_on or not ran_on[0]:
|
|
237
|
+
return recs
|
|
238
|
+
from . import compare
|
|
239
|
+
machine, hosted_any = ran_on
|
|
240
|
+
if hosted_any and engine.hosted(engine.model(label)):
|
|
241
|
+
return recs
|
|
242
|
+
return [r for r in recs if compare.machine_of(r) == machine]
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def latency_table(engine, labels=None, table=None, ran_on=None):
|
|
233
246
|
"""{label: {use_case: {machine_id: Latency}}}: the worst pack with a time limit per use case
|
|
234
247
|
(use cases whose packs have no limit report their slowest pack)."""
|
|
235
|
-
table = table if table is not None else readiness(engine, labels)
|
|
248
|
+
table = table if table is not None else readiness(engine, labels, ran_on)
|
|
236
249
|
out = {}
|
|
237
250
|
known = engine.machines()
|
|
238
251
|
for label, groups in table.items():
|
|
@@ -243,7 +256,7 @@ def latency_table(engine, labels=None, table=None):
|
|
|
243
256
|
row = {}
|
|
244
257
|
for mc in known:
|
|
245
258
|
speeds, fit_note = per_machine[mc.id]
|
|
246
|
-
lats = [latency(engine.packs[name],
|
|
259
|
+
lats = [latency(engine.packs[name], records(engine, label, name, ran_on), mc.id, speeds, fit_note)
|
|
247
260
|
for name, pv in packs.items() if pv.status != "NO DATA"]
|
|
248
261
|
limited = [x for x in lats if x.limit] or lats
|
|
249
262
|
if limited:
|
|
@@ -252,16 +265,17 @@ def latency_table(engine, labels=None, table=None):
|
|
|
252
265
|
return out
|
|
253
266
|
|
|
254
267
|
|
|
255
|
-
def readiness(engine, labels=None):
|
|
268
|
+
def readiness(engine, labels=None, ran_on=None):
|
|
256
269
|
"""{label: {use_case: (verdict, {pack: verdict})}} for every model with results.
|
|
257
|
-
A use case is a pack group (pack.toml `group`), e.g. Coding = the coding and coding-advanced packs.
|
|
270
|
+
A use case is a pack group (pack.toml `group`), e.g. Coding = the coding and coding-advanced packs.
|
|
271
|
+
ran_on: (machine, hosted_any) judges only the answers that ran on that machine (see records)."""
|
|
258
272
|
out = {}
|
|
259
273
|
for m in engine.cfg["models"]:
|
|
260
274
|
if labels and m["label"] not in labels:
|
|
261
275
|
continue
|
|
262
276
|
by_group = {}
|
|
263
277
|
for name, pack in engine.packs.items():
|
|
264
|
-
recs =
|
|
278
|
+
recs = records(engine, m["label"], name, ran_on)
|
|
265
279
|
if engine.result_status(m["label"], name) not in ("certified", "screened"):
|
|
266
280
|
recs = [] # missing or outdated results don't count
|
|
267
281
|
by_group.setdefault(pack.group, {})[name] = evaluate(pack, recs, engine.certify_repeat(pack))
|
|
@@ -1777,6 +1777,26 @@ class PTAIndex(unittest.TestCase):
|
|
|
1777
1777
|
picked = pta.index(rows, ["a", "few"]) # picked by hand: compared anyway
|
|
1778
1778
|
self.assertEqual((picked["questions"], picked["left_out"]), (1, []))
|
|
1779
1779
|
|
|
1780
|
+
def test_ran_on_keeps_one_machines_answers(self):
|
|
1781
|
+
from tuieval import compare, pta
|
|
1782
|
+
|
|
1783
|
+
def row(model, test, machine, hosted=False, ok=True):
|
|
1784
|
+
return {"model": model, "suite": "p", "test": f"p: {test}", "ok": ok, "score": float(ok), "latency": 1000,
|
|
1785
|
+
"tokens": 10, "truncated": False, "gen_tps": None, "repeat": 0, "machine": machine, "hosted": hosted}
|
|
1786
|
+
rows = ([row("here", f"q{i}", "mac") for i in range(4)] + [row("there", f"q{i}", "studio") for i in range(4)]
|
|
1787
|
+
+ [row("api", f"q{i}", "mac", hosted=True) for i in range(4)] + [row("old", "q0", None)])
|
|
1788
|
+
self.assertEqual(compare.machines(rows), {"mac": 8, "studio": 4, "unknown": 1})
|
|
1789
|
+
self.assertIs(compare.ran_on(rows, None), rows)
|
|
1790
|
+
self.assertEqual({r["model"] for r in compare.ran_on(rows, "studio")}, {"there", "api"}) # hosted: any machine
|
|
1791
|
+
self.assertEqual({r["model"] for r in compare.ran_on(rows, "studio", hosted_any=False)}, {"there"})
|
|
1792
|
+
self.assertEqual({r["model"] for r in compare.ran_on(rows, "unknown", False)}, {"old"})
|
|
1793
|
+
self.assertEqual(compare.ran_on_note("studio"), " on studio (hosted models: any machine)")
|
|
1794
|
+
self.assertEqual((compare.ran_on_note("studio", False), compare.ran_on_note(None)), (" on studio", ""))
|
|
1795
|
+
res = pta.index(compare.ran_on(rows, "studio"), min_score=0)
|
|
1796
|
+
res["ran_on"] = ("studio", True)
|
|
1797
|
+
self.assertEqual([x["model"] for x in res["models"]], ["api", "there"])
|
|
1798
|
+
self.assertIn("all 2 model(s) answered on studio (hosted models: any machine).", pta.scope_note(res, []))
|
|
1799
|
+
|
|
1780
1800
|
def test_low_scores_left_out_by_default(self):
|
|
1781
1801
|
from tuieval import pta
|
|
1782
1802
|
|
|
@@ -1999,6 +2019,13 @@ class PTAIndex(unittest.TestCase):
|
|
|
1999
2019
|
self.assertIn(" 0%", bars["hosted"])
|
|
2000
2020
|
self.assertIn("P parsimony", out)
|
|
2001
2021
|
self.assertIn("4/4", tuieval(ws, "pta", "--only", "good").stdout)
|
|
2022
|
+
bad = tuieval(ws, "pta", "--ran-on", "nope", check=False) # names the machines that have answers
|
|
2023
|
+
self.assertNotEqual(bad.returncode, 0)
|
|
2024
|
+
here = re.search(r"machines with answers: (\S+) \(8\)", bad.stderr).group(1)
|
|
2025
|
+
self.assertIn(f"answered on {here} (hosted", tuieval(ws, "pta", "--ran-on", here, "--min-score", "0").stdout)
|
|
2026
|
+
self.assertIn(f"Verdicts from the answers on {here}", tuieval(ws, "verdict", "--ran-on", here).stdout)
|
|
2027
|
+
self.assertIn(f"Only the answers on {here}.", tuieval(ws, "compare", "--ran-on", here, "--ran-on-strict").stdout)
|
|
2028
|
+
self.assertIn("needs --ran-on", tuieval(ws, "pta", "--ran-on-strict", check=False).stderr)
|
|
2002
2029
|
report = os.path.join(tmp, "r.md")
|
|
2003
2030
|
tuieval(ws, "report", "-o", report)
|
|
2004
2031
|
self.assertIn("## PTA index", read(report))
|
|
@@ -2124,6 +2151,42 @@ class PTAIndex(unittest.TestCase):
|
|
|
2124
2151
|
self.assertEqual(fails["all"], [4, "4 failures"])
|
|
2125
2152
|
self.assertEqual(fails["good"], [0, "0 failures of 1 model", "Models: 1 picked", []])
|
|
2126
2153
|
self.assertEqual(fails["hosted"], [4, "4 failures of 1 model", "Models: 1 picked", ["hosted"]])
|
|
2154
|
+
# answers from a second machine: the Machine dropdown shows, and every tab keeps that machine's
|
|
2155
|
+
path = os.path.join(ws, "results", "hosted", "apps.json")
|
|
2156
|
+
data = json.loads(read(path))
|
|
2157
|
+
for r in data["results"]:
|
|
2158
|
+
r["machine"] = "other-mac"
|
|
2159
|
+
write(path, json.dumps(data))
|
|
2160
|
+
code = textwrap.dedent("""
|
|
2161
|
+
import asyncio, json
|
|
2162
|
+
from tuieval.tui import EvalsApp, ResultsScreen
|
|
2163
|
+
from textual.widgets import Checkbox, Select, Static
|
|
2164
|
+
async def go():
|
|
2165
|
+
app = EvalsApp({})
|
|
2166
|
+
async with app.run_test(size=(180, 60)) as pilot:
|
|
2167
|
+
await pilot.pause()
|
|
2168
|
+
app.pta_min_score = 0
|
|
2169
|
+
app.push_screen(ResultsScreen())
|
|
2170
|
+
await pilot.pause(0.5)
|
|
2171
|
+
sel = app.screen.query_one("#results-machine", Select)
|
|
2172
|
+
box = app.screen.query_one("#results-hosted-any", Checkbox)
|
|
2173
|
+
got = {"shown": [sel.display, box.display], "options": [str(o[0]) for o in sel._options]}
|
|
2174
|
+
sel.value = "other-mac"
|
|
2175
|
+
await pilot.pause(0.5)
|
|
2176
|
+
got["note"] = str(app.screen.query_one("#pta-note", Static).render())
|
|
2177
|
+
got["fails"] = str(app.screen.query_one("#fail-count", Static).render())
|
|
2178
|
+
got["box"] = box.display
|
|
2179
|
+
print(json.dumps(got))
|
|
2180
|
+
asyncio.run(go())
|
|
2181
|
+
""")
|
|
2182
|
+
out = subprocess.run([sys.executable, "-c", code], capture_output=True, text=True,
|
|
2183
|
+
env=dict(os.environ, TUIEVAL_HOME=ws, TUIEVAL_DETECT_PORTS=""), timeout=60)
|
|
2184
|
+
got = json.loads(out.stdout.strip().splitlines()[-1])
|
|
2185
|
+
self.assertEqual(got["shown"], [True, False]) # the checkbox only once a machine is picked
|
|
2186
|
+
self.assertEqual(got["options"][0], "All machines")
|
|
2187
|
+
self.assertIn("other-mac (4 answers)", got["options"])
|
|
2188
|
+
self.assertIn("all 1 model(s) answered on other-mac (hosted models: any machine)", got["note"])
|
|
2189
|
+
self.assertEqual((got["fails"], got["box"]), ("4 failures", True))
|
|
2127
2190
|
|
|
2128
2191
|
|
|
2129
2192
|
class Unavailable(unittest.TestCase):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/pack.toml
RENAMED
|
File without changes
|
{tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/system.txt
RENAMED
|
File without changes
|
{tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/tests.yaml
RENAMED
|
File without changes
|
{tuieval-0.2.0.dev145 → tuieval-0.2.0.dev147}/src/tuieval/templates/packs/tool_call/tools.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|