tuieval 0.2.0.dev96__py3-none-any.whl → 0.2.0.dev99__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.dev96'
22
- __version_tuple__ = version_tuple = (0, 2, 0, 'dev96')
21
+ __version__ = version = '0.2.0.dev99'
22
+ __version_tuple__ = version_tuple = (0, 2, 0, 'dev99')
23
23
 
24
24
  __commit_id__ = commit_id = None
tuieval/pta.py CHANGED
@@ -122,7 +122,7 @@ def bars(result, width=20, markup=True):
122
122
  are proportional to tokens and time (the longest is the model that used most; shorter is better),
123
123
  with how many times the leanest / fastest model's beside them; the A bar is the share of answers
124
124
  right (longer is better, full only when every answer passed), then the share cut off at max_tokens in
125
- orange (▓ in plain text) and "✂ n%" beside it. markup=False gives plain text."""
125
+ orange (▓ in plain text) and "(n% truncated)" beside it. markup=False gives plain text."""
126
126
  if not result["models"]:
127
127
  return []
128
128
  name_w = max(len(x["model"]) for x in result["models"])
@@ -145,7 +145,7 @@ def bars(result, width=20, markup=True):
145
145
  cut = x.get("cut_pct") or 0
146
146
  part = min(width - full, max(1, round(width * cut / 100))) if cut else 0
147
147
  if cut: # after the accuracy, which stays aligned with the other rows'
148
- num = f"{num:>6} ✂ {compare.pct(cut / 100)}"
148
+ num = f"{num:>6} ({compare.pct(cut / 100)} truncated)"
149
149
  else:
150
150
  full = _blocks(width, x.get(measure), most[measure])
151
151
  num = times(x.get(shown))
@@ -178,7 +178,7 @@ def left_out_lines(result):
178
178
  def table(result):
179
179
  """(header, rows) for a plain table of the index."""
180
180
  n = result["questions"] or 1
181
- header = ["model", "tokens/answer", "time/answer", "answers right", "cut off", "tok/s", "TTFT s", "memory GB"]
181
+ header = ["model", "tokens/answer", "time/answer", "answers right", "truncated", "tok/s", "TTFT s", "memory GB"]
182
182
  rows = [[x["model"], f"{round(x['tokens'] / n):,}" + (" ★" if x.get("fewest") else ""),
183
183
  fmt_secs(x["total_s"] / n) + (" ★" if x.get("fastest") else ""),
184
184
  f"{x['passed']}/{x['answers']}", f"{x.get('cut') or 0}/{x['answers']}",
@@ -216,8 +216,8 @@ def scope_note(result, models):
216
216
  "P parsimony (tokens) and T time: bars as long as the tokens / time used (shorter is better), "
217
217
  "and how many times the leanest / fastest model's (1.0×, ★ in the table). A accuracy: answers right "
218
218
  "(longer is better)"
219
- + ("; orange ✂: answers cut off at max_tokens, out of tokens rather than wrong (they count as wrong)."
220
- if any(x.get("cut") for x in result["models"]) else "."))
219
+ + ("; orange, (n% truncated): answers cut off at max_tokens. They count as wrong, but the model ran "
220
+ "out of tokens rather than answering wrong." if any(x.get("cut") for x in result["models"]) else "."))
221
221
 
222
222
 
223
223
  def for_engine(e, labels=None, packs=None, results_dir=None):
tuieval/tui.py CHANGED
@@ -355,6 +355,38 @@ def rich_escape(text):
355
355
  return text.replace("[", r"\[")
356
356
 
357
357
 
358
+ def mid_trim(text, width, head=None):
359
+ """text cut to width cells with … in the middle, so both ends of a model name show (its family and
360
+ its server suffix, e.g. -llama / -vllm). head: how many leading characters to keep (default: half)."""
361
+ if cell_len(text) <= width or width < 5:
362
+ return text
363
+ head = width - 1 - width // 2 if head is None else min(head, width - 2)
364
+ return text[:head] + "…" + text[head - width + 1:]
365
+
366
+
367
+ def trim_names(names, width):
368
+ """names cut to width (mid_trim), still telling them apart: when cutting the middle would make two
369
+ alike, the cut moves into the start they all share; if that's not enough either, names stay whole."""
370
+ trimmed = [mid_trim(n, width) for n in names]
371
+ if len(set(trimmed)) == len(set(names)):
372
+ return trimmed
373
+ shared = len(os.path.commonprefix(list(names)))
374
+ head = width - 1 - max(len(n) - shared for n in names) # keep every name's end from where they differ
375
+ if head < 1:
376
+ return list(names)
377
+ trimmed = [mid_trim(n, width, head=head) for n in names]
378
+ return trimmed if len(set(trimmed)) == len(set(names)) else list(names)
379
+
380
+
381
+ def fit_first_column(header, rows, room, floor=24):
382
+ """rows with the first cell trimmed in the middle (mid_trim) so a table of these columns fits room
383
+ cells across, but never below floor cells. Cells are Rich markup; each column adds 2 cells of padding."""
384
+ rest = sum(2 + max(cell_len(h), *(Text.from_markup(r[i]).cell_len for r in rows))
385
+ for i, h in enumerate(header) if i)
386
+ names = trim_names([r[0] for r in rows], max(floor, room - rest - 2))
387
+ return [[n] + r[1:] for n, r in zip(names, rows)]
388
+
389
+
358
390
  class BlockDumper(yaml.SafeDumper):
359
391
  """Multi-line strings (reference code, expected text) as readable | blocks, not escaped \\n."""
360
392
 
@@ -2981,6 +3013,9 @@ class ResultsScreen(Screen):
2981
3013
  self.query_one("#pta-left-out", Static).update(
2982
3014
  "\n".join(f"[dim]{rich_escape(line)}[/dim]" for line in pta.left_out_lines(result)))
2983
3015
  header, table = pta.table(result)
3016
+ self.pta_shown = bool(table) # to refit on resize
3017
+ if table:
3018
+ table = fit_first_column(header, table, (self.size.width or self.app.size.width) - 3)
2984
3019
  for i, h in enumerate(header): # sized to the contents: added before the rows, a column keeps its header's width
2985
3020
  t.add_column(h, width=max(len(h), *(len(r[i]) for r in table)) if table else None)
2986
3021
  t.add_rows(table)
@@ -3065,6 +3100,14 @@ class ResultsScreen(Screen):
3065
3100
  f"{os.path.basename(os.path.dirname(p))} · {os.path.basename(p)[:-5]}" for p in sorted(self.superseded))
3066
3101
  + ". Only the new run's answers (◐) are shown for these.[/yellow]" if self.superseded else ""))
3067
3102
 
3103
+ def on_resize(self, event):
3104
+ """Refit the tables whose model names are trimmed to the window's width."""
3105
+ if getattr(self, "pq_summary_args", None):
3106
+ self.fill_pq_summary(*self.pq_summary_args)
3107
+ self.sort_table(self.query_one("#pq-summary", DataTable))
3108
+ if getattr(self, "pta_shown", False):
3109
+ self.fill_pta()
3110
+
3068
3111
  def fill_pq_summary(self, tests, models):
3069
3112
  """One row per shown model over the questions they ALL answered, so totals compare fairly;
3070
3113
  with two models, a head-to-head line."""
@@ -3081,9 +3124,11 @@ class ResultsScreen(Screen):
3081
3124
  title.update("[yellow]These models have no question in common (with the filters above).[/yellow]")
3082
3125
  table.display = False
3083
3126
  return
3127
+ self.pq_summary_args = (tests, models) # to refit on resize
3084
3128
  rows = compare.compare_models(shared, models)
3085
- table.add_columns("Model", "Total time", "Passed", "Median tokens", "Total tokens", "Tokens per ✓", "Median s",
3086
- "Avg prompt tok/s", "Avg gen tok/s", "Fewest tokens", "Fastest", "Cut off")
3129
+ # short headings so every column fits; the line above the table says what each one is
3130
+ header = ("Model", "Time", "Passed", "Med tok", "Tokens", "Tok/✓", "Med s", "Prompt t/s", "Gen t/s",
3131
+ "Fewest", "Fastest", "Cut off")
3087
3132
  best = {k: max((r[k] for r in rows if r[k] is not None), default=None)
3088
3133
  for k in ("passed", "fewest", "fastest", "avg_pp_tps", "avg_gen_tps")}
3089
3134
  low = {k: min(r[k] for r in rows if r[k] is not None) if any(r[k] is not None for r in rows) else None
@@ -3092,9 +3137,10 @@ class ResultsScreen(Screen):
3092
3137
  def hi(v, text, key, good):
3093
3138
  ref = best.get(key) if good == "max" else low.get(key)
3094
3139
  return f"[bold green]{text}[/bold green]" if v is not None and v == ref and len(rows) > 1 else text
3140
+ cells = []
3095
3141
  for r in rows:
3096
3142
  tt = r["total_secs"]
3097
- table.add_row(r["model"],
3143
+ cells.append([r["model"],
3098
3144
  hi(tt, ("-" if not tt else f"{tt:.1f}s" if tt < 60 else fmt_secs(tt)), "total_secs", "min"),
3099
3145
  hi(r["passed"], f"{r['passed']}/{r['n']}", "passed", "max"),
3100
3146
  hi(r["med_tokens"], f"{r['med_tokens']:,.0f}" if r["med_tokens"] else "-", "med_tokens", "min"),
@@ -3107,7 +3153,9 @@ class ResultsScreen(Screen):
3107
3153
  "max"),
3108
3154
  hi(r["fewest"], str(r["fewest"]), "fewest", "max"),
3109
3155
  hi(r["fastest"], str(r["fastest"]), "fastest", "max"),
3110
- f"[red]{r['cut']}[/red]" if r["cut"] else "0")
3156
+ f"[red]{r['cut']}[/red]" if r["cut"] else "0"])
3157
+ table.add_columns(*header)
3158
+ table.add_rows(fit_first_column(header, cells, (self.size.width or self.app.size.width) - 3))
3111
3159
  line = f"[b]Comparison[/b] over the {len(shared)} questions all {len(models)} answered"
3112
3160
  if len(models) == 2:
3113
3161
  h = compare.head_to_head(shared, *models)
@@ -3121,9 +3169,10 @@ class ResultsScreen(Screen):
3121
3169
  if shared_speed:
3122
3170
  line += (f"\n[yellow]Some answers of {', '.join(shared_speed)} ran alongside other models, which "
3123
3171
  "shared the machine's speed: compare their times with care.[/yellow]")
3124
- title.update(line + " [dim]Fewest tokens / Fastest = questions won; ties count for both. Total tokens / "
3125
- "Total time add up each question's median. Avg tok/s = all tokens over all the time they took "
3126
- "(cached prompts left out).[/dim]")
3172
+ title.update(line + " [dim]Time / Tokens: each question's median, added up. Med tok / Med s: median "
3173
+ "per answer. Tok/✓: tokens per answer right. Prompt t/s / Gen t/s: all tokens over all the time "
3174
+ "they took (cached prompts left out). Fewest / Fastest: questions won; ties count for both. "
3175
+ "Cut off: answers that hit max_tokens.[/dim]")
3127
3176
 
3128
3177
  @staticmethod
3129
3178
  def pq_cell(c, best, here):
@@ -3277,7 +3326,7 @@ class EvalsApp(App):
3277
3326
  #pq-controls Select { width: 22; margin-right: 1; }
3278
3327
  #pq-models { margin-right: 1; min-width: 20; }
3279
3328
  #pq-compare-title { padding: 0 1; height: auto; }
3280
- #pq-summary { height: auto; max-height: 10; }
3329
+ #pq-summary { height: auto; } /* every picked model, no scrolling: the tab scrolls instead */
3281
3330
  #pq-legend { padding: 0 1; height: auto; }
3282
3331
  /* Tabs must read as tabs, not as a line of text: each tab is a button-like chip on its own band,
3283
3332
  the active one filled with the accent colour. (Textual's default: dimmed words on the background.) */
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tuieval
3
- Version: 0.2.0.dev96
3
+ Version: 0.2.0.dev99
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=vq8xfmWFF-z2N4IfHoIiukOF66_VgRgLRvVKdboXuLA,535
3
+ tuieval/_version.py,sha256=EnjLNHE3-O1-hviWXp7HEQ3pbBMWrRtAx08ValpcMyA,535
4
4
  tuieval/builtin.toml,sha256=Nwu7O0qFzcrDAxXO_VZtDPvjVwxZ29OtYOW0BPihZGs,4410
5
5
  tuieval/cli.py,sha256=mr0o_ud6NctZeU4WIrh17x_uzEK0vTeCynGP0wrCeBY,4812
6
6
  tuieval/client.py,sha256=wtACBVsngtWopWWhIc4bB6mEUEi31dvvDePN-PjmXbM,11122
@@ -14,12 +14,12 @@ tuieval/machines.py,sha256=t9tu6CZeXZON4EtOVnEwP4VtaynpVLf9Cz8TNjf7jtY,20124
14
14
  tuieval/onboard.py,sha256=IYETVDWCCo9vF0Dtj4_rr9VanYeCky8PwP3-2g5A_l0,6215
15
15
  tuieval/packs.py,sha256=ZgaZ1m2ePYvDjmddSc3nafnMEn7kTq9WcDpCaJSZleQ,12026
16
16
  tuieval/profiles.py,sha256=soeLxjdB-l-OxSY8jZ4yjwfdSnsBV-QICcwKxRJS7nQ,3663
17
- tuieval/pta.py,sha256=_e6coSXYSzEagWJItyhz-DqIud5ywoVVa7BXbS7kUnY,13183
17
+ tuieval/pta.py,sha256=lvcPZ-taIEu2RHo-IiWb31OYtmkoCrsdulrF4-T7Csk,13243
18
18
  tuieval/remove.py,sha256=Vwh43nm9lVb9U9aN-h6CMYbkTwdR3UWfZObwweF72n0,5157
19
19
  tuieval/run_evals.py,sha256=DN6FhC8Zj08N5pwlrCmlkbkTxA2vmT-G5sWJnp-S-AI,50114
20
20
  tuieval/scaffold.py,sha256=YBOqniJpf_GtKKAFF3_OHxxMGbmTWdFjcClGcOnrrKE,12130
21
21
  tuieval/selftest.py,sha256=nExkrOidgymlmvkxImEBfrQG5iTUN5WuRMIKtqusCCs,9835
22
- tuieval/tui.py,sha256=1JpAtIpq4zJAmiPyg5NYlQQm8lYuhoP1DiRM4-exHsw,181966
22
+ tuieval/tui.py,sha256=yO69K_LfK5pfUZkQgxA7UqFbXK7BtDr6Y6A8JZCBA9E,184628
23
23
  tuieval/tune.py,sha256=azxxthgJeag8JyoQUgaRxq6oI1XvEgzb9vkszjJZH7w,39645
24
24
  tuieval/verdict.py,sha256=3SM8qrVdWNIFDENagaR5ZPBYEnjsBtkYB9WS5TDVssU,20517
25
25
  tuieval/watch_proxy.py,sha256=bnDO1i6n6yUs1hODoUWcMppJMGPavoQqs6aNYrIxpT8,11416
@@ -48,8 +48,8 @@ tuieval/templates/packs/tool_call/pack.toml,sha256=n4bx0lGJHSmW41uVqhfIXJ2BWZpmT
48
48
  tuieval/templates/packs/tool_call/system.txt,sha256=mKxu-lB-0YjLHXdgeFJa8x2C180OvcNz5cHv2N5Bg3U,254
49
49
  tuieval/templates/packs/tool_call/tests.yaml,sha256=Nv7c4syrzJ9cU8EBKSK_1ZSFx9V02aCjW4-2TBCPT7s,1859
50
50
  tuieval/templates/packs/tool_call/tools.yaml,sha256=HgxCkh0On2VwbHSsjAGM8tNCK7ZtKLGrs7lMCn3Fprs,1048
51
- tuieval-0.2.0.dev96.dist-info/METADATA,sha256=tWhbY2NNalpYs0drNts9Vs1vsPHZ-Muy9Nw-34gftRw,14580
52
- tuieval-0.2.0.dev96.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
53
- tuieval-0.2.0.dev96.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
54
- tuieval-0.2.0.dev96.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
55
- tuieval-0.2.0.dev96.dist-info/RECORD,,
51
+ tuieval-0.2.0.dev99.dist-info/METADATA,sha256=ulrRF0F1nVj2zmY3ds6cF6VpvOBOG3rOOjbZeyNxIT0,14580
52
+ tuieval-0.2.0.dev99.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
53
+ tuieval-0.2.0.dev99.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
54
+ tuieval-0.2.0.dev99.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
55
+ tuieval-0.2.0.dev99.dist-info/RECORD,,