tuieval 0.2.0.dev141__py3-none-any.whl → 0.2.0.dev145__py3-none-any.whl

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/_version.py CHANGED
@@ -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.dev141'
22
- __version_tuple__ = version_tuple = (0, 2, 0, 'dev141')
21
+ __version__ = version = '0.2.0.dev145'
22
+ __version_tuple__ = version_tuple = (0, 2, 0, 'dev145')
23
23
 
24
24
  __commit_id__ = commit_id = None
tuieval/pta.py CHANGED
@@ -21,7 +21,8 @@ it varies). A ×1 model's accuracy rests on one answer per question, so it is ro
21
21
  Models are compared on the questions all of them answered, so one that skipped some never looks
22
22
  faster. Server and connection errors aren't answers. By default a model with fewer than half as many
23
23
  answers as the most-answered model is left out (listed, so it can be picked), or it would shrink the
24
- shared questions for everyone. There's no combined number: the three stay side by side, and verdicts
24
+ shared questions for everyone, and so is one that scores below MIN_SCORE (also listed), unless every
25
+ model does. There's no combined number: the three stay side by side, and verdicts
25
26
  and critical failures stay where they are (verdict.py).
26
27
  """
27
28
  import math
@@ -31,6 +32,8 @@ from rich.markup import escape as rich_escape
31
32
  from . import compare
32
33
 
33
34
  MIN_SHARE = 0.5 # fewer answers than this share of the most-answered model's: left out by default
35
+ MIN_SCORE = 85 # a score (partial credit, %) below this: left out by default, unless every model's is
36
+ MIN_SCORES = (0, 50, 70, 80, 85, 90, 95) # the choices offered (0: every score)
34
37
  POINTS_PER_DOUBLING = 15
35
38
 
36
39
 
@@ -55,13 +58,15 @@ def memory_gb(infos):
55
58
  SORTS = ("accuracy", "score")
56
59
 
57
60
 
58
- def index(rows, models=None, memory=None, sort="accuracy"):
61
+ def index(rows, models=None, memory=None, sort="accuracy", min_score=MIN_SCORE, score_models=False):
59
62
  """{"questions": n shared, "models": [{model, P, T, A, S, cut, cut_pct, tokens, total_s, passed, answers, alongside,
60
63
  fewest, fastest, tps, ttft, memory_gb, repeats: (fewest, most) answers per question}],
61
- "left_out": [(model, questions answered)], "no_answers": [model], "most": questions answered by the
62
- most-answered model}, best accuracy (sort="accuracy") or score (sort="score") first. S: the mean
64
+ "left_out": [(model, questions answered)], "low_score": [(model, score %) left out below MIN_SCORE],
65
+ "no_answers": [model], "most": questions answered by the most-answered model}, best accuracy (sort="accuracy") or score (sort="score") first. S: the mean
63
66
  score (partial credit) in %. models: the ones to compare (default: every model in rows
64
- with enough answers; models named here are compared whatever their count). memory: memory_gb()."""
67
+ with enough answers and a score of at least min_score, 0 for any; models named here are compared
68
+ whatever their count and score, unless score_models: then min_score applies to them too, as when
69
+ a pack picks the models that answered all of it). memory: memory_gb()."""
65
70
  no_answers = sorted({r["model"] for r in rows} - {r["model"] for r in rows if not r.get("error")})
66
71
  rows = [r for r in rows if not r.get("error")] # a server or connection error isn't an answer
67
72
  tests = compare.per_question(rows)
@@ -70,47 +75,70 @@ score (partial credit) in %. models: the ones to compare (default: every model i
70
75
  for m in t["cells"]:
71
76
  counts[m] = counts.get(m, 0) + 1
72
77
  most = max(counts.values(), default=0)
78
+ picked = models
73
79
  if models:
74
80
  no_answers = [m for m in no_answers if m in models]
75
81
  models, left_out = sorted(m for m in models if m in counts), []
76
82
  else:
77
83
  models = sorted(m for m in counts if counts[m] >= MIN_SHARE * most)
78
84
  left_out = sorted(((m, n) for m, n in counts.items() if m not in models), key=lambda x: (-x[1], x[0]))
79
- shared = [t for t in tests if models and all(m in t["cells"] for m in models)]
80
- out = []
81
- for m in models:
82
- cells = [t["cells"][m] for t in shared]
83
- answers = sum(c["n"] for c in cells)
84
- out.append({"model": m, "tokens": sum(c["tokens"] or 0 for c in cells),
85
- "total_s": sum(c["secs"] or 0 for c in cells),
86
- "passed": sum(c["passed"] for c in cells), "answers": answers,
87
- "A": 100 * sum(c["passed"] for c in cells) / answers if answers else None,
88
- "S": 100 * sum(c["score"] * c["n"] for c in cells) / answers if answers else None,
89
- # failed only because max_tokens ran out (overthinking, not wrong yet)
90
- "cut": sum(c["truncated"] for c in cells),
91
- "cut_pct": 100 * sum(c["truncated"] for c in cells) / answers if answers else None,
92
- # ran past the max_tokens sent: the provider didn't stop it, so it had more room than asked
93
- "over": sum(c.get("over", 0) for c in cells),
94
- # generation speed and time to first token over the same answers (medians)
95
- "tps": compare.median(r.get("gen_tps") for c in cells for r in c["rows"]),
96
- "ttft": compare.median(r.get("ttft") for c in cells for r in c["rows"]),
97
- "memory_gb": (memory or {}).get(m),
98
- "repeats": (min(c["n"] for c in cells), max(c["n"] for c in cells)) if cells else None,
99
- # answers that ran while other models were served shared the machine's speed
100
- "alongside": any(r.get("alongside") for c in cells for r in c["rows"])})
101
- fastest = min((x["total_s"] for x in out if x["total_s"] > 0), default=None)
102
- fewest = min((x["tokens"] for x in out if x["tokens"] > 0), default=None)
103
- for x in out:
104
- x["P"], x["T"] = score(x["tokens"], fewest), score(x["total_s"], fastest)
105
- # shown on the bars: how many times the leanest / fastest model's total (1.0 = the best)
106
- x["tokens_x"] = x["tokens"] / fewest if fewest and x["tokens"] else None
107
- x["time_x"] = x["total_s"] / fastest if fastest and x["total_s"] else None
108
- x["fewest"] = bool(fewest) and x["tokens"] == fewest
109
- x["fastest"] = bool(fastest) and x["total_s"] == fastest
85
+
86
+ def compare_on(models):
87
+ shared = [t for t in tests if models and all(m in t["cells"] for m in models)]
88
+ out = []
89
+ for m in models:
90
+ cells = [t["cells"][m] for t in shared]
91
+ answers = sum(c["n"] for c in cells)
92
+ out.append({"model": m, "tokens": sum(c["tokens"] or 0 for c in cells),
93
+ "total_s": sum(c["secs"] or 0 for c in cells),
94
+ "passed": sum(c["passed"] for c in cells), "answers": answers,
95
+ "A": 100 * sum(c["passed"] for c in cells) / answers if answers else None,
96
+ "S": 100 * sum(c["score"] * c["n"] for c in cells) / answers if answers else None,
97
+ # failed only because max_tokens ran out (overthinking, not wrong yet)
98
+ "cut": sum(c["truncated"] for c in cells),
99
+ "cut_pct": 100 * sum(c["truncated"] for c in cells) / answers if answers else None,
100
+ # ran past the max_tokens sent: the provider didn't stop it, so it had more room than asked
101
+ "over": sum(c.get("over", 0) for c in cells),
102
+ # generation speed and time to first token over the same answers (medians)
103
+ "tps": compare.median(r.get("gen_tps") for c in cells for r in c["rows"]),
104
+ "ttft": compare.median(r.get("ttft") for c in cells for r in c["rows"]),
105
+ "memory_gb": (memory or {}).get(m),
106
+ "repeats": (min(c["n"] for c in cells), max(c["n"] for c in cells)) if cells else None,
107
+ # answers that ran while other models were served shared the machine's speed
108
+ "alongside": any(r.get("alongside") for c in cells for r in c["rows"])})
109
+ fastest = min((x["total_s"] for x in out if x["total_s"] > 0), default=None)
110
+ fewest = min((x["tokens"] for x in out if x["tokens"] > 0), default=None)
111
+ for x in out:
112
+ x["P"], x["T"] = score(x["tokens"], fewest), score(x["total_s"], fastest)
113
+ # shown on the bars: how many times the leanest / fastest model's total (1.0 = the best)
114
+ x["tokens_x"] = x["tokens"] / fewest if fewest and x["tokens"] else None
115
+ x["time_x"] = x["total_s"] / fastest if fastest and x["total_s"] else None
116
+ x["fewest"] = bool(fewest) and x["tokens"] == fewest
117
+ x["fastest"] = bool(fastest) and x["total_s"] == fastest
118
+ return shared, out
119
+
120
+ shared, out = compare_on(models)
121
+ low_score = []
122
+ if (not picked or score_models) and min_score:
123
+ # by default, models scoring below min_score are left out too (unless every model is), and the rest
124
+ # compared again: without them the shared questions can grow, and scores move, so until none is below
125
+ while True:
126
+ low = [x for x in out if _score(x) < min_score]
127
+ if not low or len(low) == len(out):
128
+ break
129
+ low_score += [(x["model"], _score(x)) for x in low]
130
+ models = [m for m in models if m not in {x["model"] for x in low}]
131
+ shared, out = compare_on(models)
132
+ low_score.sort(key=lambda x: (-x[1], x[0]))
110
133
  first, then = ("S", "A") if sort == "score" else ("A", "S")
111
134
  out.sort(key=lambda x: (-(x[first] or 0), -(x[then] or 0), -(x["T"] or 0), x["model"]))
112
- return {"questions": len(shared), "models": out, "left_out": left_out, "no_answers": no_answers,
113
- "most": most}
135
+ return {"questions": len(shared), "models": out, "left_out": left_out, "low_score": low_score,
136
+ "min_score": min_score, "no_answers": no_answers, "most": most}
137
+
138
+
139
+ def _score(x):
140
+ """A model's score (partial credit, %), or its accuracy when there's none."""
141
+ return x["S"] if x.get("S") is not None else (x["A"] or 0)
114
142
 
115
143
 
116
144
  # (letter, name, which way is better, what the bar measures, the number beside it, colour). P and T bars
@@ -200,13 +228,17 @@ def bars(result, width=20, markup=True, click=None):
200
228
 
201
229
 
202
230
  def left_out_lines(result):
203
- """Plain sentences on the models not compared (too few answers, or only server errors) and on
231
+ """Plain sentences on the models not compared (too few answers, a low score, or only server errors) and on
204
232
  answers that shared the machine with other models."""
205
233
  out = []
206
234
  if result["left_out"]:
207
235
  out.append("Left out (fewer than half as many answers as the most-answered model; pick them under "
208
236
  "Models or --only to include them): "
209
237
  + ", ".join(f"{m} ({n} of {result['most']})" for m, n in result["left_out"]))
238
+ if result.get("low_score"):
239
+ out.append(f"Left out (scored below {result.get('min_score', MIN_SCORE):g}%; lower the minimum score, or pick "
240
+ "them under Models or --only, to include them): "
241
+ + ", ".join(f"{m} ({compare.pct(v / 100)})" for m, v in result["low_score"]))
210
242
  if result["no_answers"]:
211
243
  out.append("No answers, only server errors: " + ", ".join(result["no_answers"]))
212
244
  shared = [x["model"] for x in result["models"] if x["alongside"]]
@@ -271,14 +303,14 @@ def scope_note(result, models):
271
303
  if any(x.get("over") for x in result["models"]) else ""))
272
304
 
273
305
 
274
- def for_engine(e, labels=None, packs=None, results_dir=None, sort="accuracy"):
306
+ def for_engine(e, labels=None, packs=None, results_dir=None, sort="accuracy", min_score=MIN_SCORE):
275
307
  """(result, models) from a workspace's finished results (results on their way out excluded)."""
276
308
  paths = [p for p in compare.default_paths(results_dir or e.results_dir) if not e.superseded(p)]
277
309
  rows, infos = compare.load(paths) if paths else ([], [])
278
310
  if packs:
279
311
  rows = [r for r in rows if r["suite"] in packs]
280
312
  models = sorted({r["model"] for r in rows} & set(labels) if labels else {r["model"] for r in rows})
281
- return index(rows, models if labels else None, memory_gb(infos), sort), models
313
+ return index(rows, models if labels else None, memory_gb(infos), sort, min_score), models
282
314
 
283
315
 
284
316
  def markdown(result, models):
tuieval/run_evals.py CHANGED
@@ -405,6 +405,9 @@ def cmd_pta(argv):
405
405
  p.add_argument("--width", type=int, default=20, help="bar width in characters (default 20)")
406
406
  p.add_argument("--sort", choices=("accuracy", "score"), default="accuracy",
407
407
  help="order models by answers right (default) or by score (partial credit)")
408
+ p.add_argument("--min-score", type=float, default=None,
409
+ help="leave out models scoring below this %% (default 85; 0 shows every model; "
410
+ "models named with --only are always shown)")
408
411
  p.add_argument("--models")
409
412
  p.add_argument("--results-dir")
410
413
  a = p.parse_args(argv)
@@ -413,7 +416,8 @@ def cmd_pta(argv):
413
416
  e = engine.Engine(models_path=a.models, results_dir=a.results_dir)
414
417
  labels = [x.strip() for x in a.only.split(",")] if a.only else None
415
418
  packs = [x.strip() for x in a.packs.split(",")] if a.packs else None
416
- result, models = pta.for_engine(e, labels, packs, sort=a.sort)
419
+ 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)
417
421
  out = Console(highlight=False)
418
422
  if not models:
419
423
  sys.exit("no finished results to compare" + (" for those models or packs" if labels or packs else ""))
tuieval/tui.py CHANGED
@@ -2934,6 +2934,7 @@ class ResultsScreen(Screen):
2934
2934
  self.smoke_dir = smoke_dir
2935
2935
 
2936
2936
  def compose(self) -> ComposeResult:
2937
+ from . import pta
2937
2938
  yield Header()
2938
2939
  with Horizontal(id="results-top"):
2939
2940
  yield Static(id="results-info")
@@ -2945,6 +2946,9 @@ class ResultsScreen(Screen):
2945
2946
  yield Select([("All packs", "")], id="pta-pack", allow_blank=False, value="")
2946
2947
  yield Select([("By accuracy", "accuracy"), ("By score", "score")], id="pta-sort",
2947
2948
  allow_blank=False, value="accuracy")
2949
+ yield Select([("Any score", 0)] + [(f"Score ≥ {n}%", n) for n in pta.MIN_SCORES if n],
2950
+ id="pta-min-score", allow_blank=False,
2951
+ value=getattr(self.app, "pta_min_score", pta.MIN_SCORE))
2948
2952
  yield Button("Models: all", id="pta-models")
2949
2953
  yield Static("[dim]P parsimony (tokens): tokens used, reasoning and answer. T time: total time. "
2950
2954
  "A accuracy: answers right. Verdicts and critical failures are in Production "
@@ -3275,6 +3279,13 @@ class ResultsScreen(Screen):
3275
3279
  out = insights.panels(rows, models, e.packs, ref, bases, by, engine=e if main else None)
3276
3280
  body.update("\n\n".join(insights.render(p, i) for i, p in enumerate(out, 1)))
3277
3281
 
3282
+ @on(Select.Changed, "#pta-min-score")
3283
+ def pta_min_score_changed(self, event):
3284
+ """The minimum score: models below it are left out of the PTA index unless picked (kept for the session)."""
3285
+ self.app.pta_min_score = event.value
3286
+ if getattr(self, "rows", None) is not None:
3287
+ self.fill_pta()
3288
+
3278
3289
  @on(Select.Changed, "#pta-sort")
3279
3290
  def pta_sort_changed(self):
3280
3291
  """The Sort dropdown orders the bars and the table, taking over from a column sorted by a click."""
@@ -3351,9 +3362,13 @@ class ResultsScreen(Screen):
3351
3362
  self.query_one("#pta-bars", Static).update("")
3352
3363
  self.query_one("#pta-left-out", Static).update("")
3353
3364
  return
3354
- # none picked: every model with enough answers (pta.index leaves out the rest, and says so)
3365
+ # none picked: every model with enough answers and score (pta.index leaves out the rest, and says so).
3366
+ # The models a pack picked (all that answered it) aren't a pick by hand: the minimum score applies to them
3367
+ pick = self.app.pack_pick
3368
+ by_pack = bool(chosen) and bool(pick) and chosen == {m for m in pick["models"] if m in present}
3355
3369
  result = pta.index(rows, sorted(chosen) or None, pta.memory_gb(self.infos),
3356
- self.query_one("#pta-sort", Select).value or "accuracy")
3370
+ self.query_one("#pta-sort", Select).value or "accuracy",
3371
+ self.query_one("#pta-min-score", Select).value or 0, score_models=by_pack)
3357
3372
  self.query_one("#pta-note", Static).update(pta.scope_note(result, sorted(present)))
3358
3373
  self.pta_result = result
3359
3374
  removed = [m for m in self.pta_removed_now() if m in present]
@@ -3700,6 +3715,7 @@ class EvalsApp(App):
3700
3715
  #ins-body { height: 1fr; }
3701
3716
  #pta-controls Select { width: 28; margin-right: 1; }
3702
3717
  #pta-controls #pta-sort { width: 18; }
3718
+ #pta-controls #pta-min-score { width: 18; }
3703
3719
  #pta-bars { height: auto; padding: 1 0 0 0; }
3704
3720
  #pta { width: 1fr; height: auto; margin-top: 1; }
3705
3721
  #pta-left-out { height: auto; padding: 1 0 0 0; }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tuieval
3
- Version: 0.2.0.dev141
3
+ Version: 0.2.0.dev145
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
@@ -1,6 +1,6 @@
1
1
  tuieval/__init__.py,sha256=myVXVX7htbwezW6k3x_FuKgn1RSZ2WcTaDEMByGn6Wg,312
2
2
  tuieval/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
3
- tuieval/_version.py,sha256=hblvtlR57DxIru0_AjQM2oyKuiy7Y_m-LE0jLFYkWiU,537
3
+ tuieval/_version.py,sha256=GuyqddQoZPkFHR2O26P5PKQWp-kBn_BjaBoPNtiEbB8,537
4
4
  tuieval/agents.py,sha256=XmY4d4PAnC7BQcs_6KO9WTuIdpnwYVAdyhqItybWdAM,15408
5
5
  tuieval/builtin.toml,sha256=QLQP1nh577RW6x0Z38JKNES-MPTSmlZAcxD5Javbk4Q,4768
6
6
  tuieval/cli.py,sha256=mr0o_ud6NctZeU4WIrh17x_uzEK0vTeCynGP0wrCeBY,4812
@@ -16,12 +16,12 @@ tuieval/machines.py,sha256=t9tu6CZeXZON4EtOVnEwP4VtaynpVLf9Cz8TNjf7jtY,20124
16
16
  tuieval/onboard.py,sha256=IYETVDWCCo9vF0Dtj4_rr9VanYeCky8PwP3-2g5A_l0,6215
17
17
  tuieval/packs.py,sha256=KOj0BkwsB2124aslGyauZonyyGqtSrCJ-WAozEntmqE,17466
18
18
  tuieval/profiles.py,sha256=soeLxjdB-l-OxSY8jZ4yjwfdSnsBV-QICcwKxRJS7nQ,3663
19
- tuieval/pta.py,sha256=K8KE_PUcOgoZGaJHCWkPYfVHbPvd243uG0QPuxnVKto,16949
19
+ tuieval/pta.py,sha256=v8gVQZJO4XUuIDUSLUrNUKoCHUS1n5truaTLRxrPwUE,18983
20
20
  tuieval/remove.py,sha256=Vwh43nm9lVb9U9aN-h6CMYbkTwdR3UWfZObwweF72n0,5157
21
- tuieval/run_evals.py,sha256=LfCls5d5foL0A7eoZvKVvwlYXCjElmj53wNlAstXMiA,51085
21
+ tuieval/run_evals.py,sha256=ok5RvX9IFJwLT_QygIV2bYDtA7LJpVj68CtO4ow7A8U,51416
22
22
  tuieval/scaffold.py,sha256=YBOqniJpf_GtKKAFF3_OHxxMGbmTWdFjcClGcOnrrKE,12130
23
23
  tuieval/selftest.py,sha256=cIGSDCrCK-QISAXjKSJDB4sD-WwS32bn3Gn4Y0oGoF8,11502
24
- tuieval/tui.py,sha256=wVD9IYt43Pg7yC5waspzj63xkydWb1fKBDPKyh-YgcQ,207390
24
+ tuieval/tui.py,sha256=hWKDUxfsh1I7XiEhhK4-wyPNpKgQy16i-x1RGn02gvM,208430
25
25
  tuieval/tune.py,sha256=izz1Qs-d9PrWAqEZpyrLxfrlhlaouif9uFQSeJveL0k,41294
26
26
  tuieval/verdict.py,sha256=3SM8qrVdWNIFDENagaR5ZPBYEnjsBtkYB9WS5TDVssU,20517
27
27
  tuieval/watch_proxy.py,sha256=bnDO1i6n6yUs1hODoUWcMppJMGPavoQqs6aNYrIxpT8,11416
@@ -50,8 +50,8 @@ tuieval/templates/packs/tool_call/pack.toml,sha256=n4bx0lGJHSmW41uVqhfIXJ2BWZpmT
50
50
  tuieval/templates/packs/tool_call/system.txt,sha256=mKxu-lB-0YjLHXdgeFJa8x2C180OvcNz5cHv2N5Bg3U,254
51
51
  tuieval/templates/packs/tool_call/tests.yaml,sha256=Nv7c4syrzJ9cU8EBKSK_1ZSFx9V02aCjW4-2TBCPT7s,1859
52
52
  tuieval/templates/packs/tool_call/tools.yaml,sha256=HgxCkh0On2VwbHSsjAGM8tNCK7ZtKLGrs7lMCn3Fprs,1048
53
- tuieval-0.2.0.dev141.dist-info/METADATA,sha256=xusjnkxk9oZoDRs40rVSXE_ln2tAfKhgxlNuwVQNYI4,15105
54
- tuieval-0.2.0.dev141.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
55
- tuieval-0.2.0.dev141.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
56
- tuieval-0.2.0.dev141.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
57
- tuieval-0.2.0.dev141.dist-info/RECORD,,
53
+ tuieval-0.2.0.dev145.dist-info/METADATA,sha256=Lv8WNg8B1HqLCCqO85DTiqXE2dSAgc9do5plYjG2-os,15105
54
+ tuieval-0.2.0.dev145.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
55
+ tuieval-0.2.0.dev145.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
56
+ tuieval-0.2.0.dev145.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
57
+ tuieval-0.2.0.dev145.dist-info/RECORD,,