tuieval 0.2.0.dev68__py3-none-any.whl → 0.2.0.dev72__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.dev68'
22
- __version_tuple__ = version_tuple = (0, 2, 0, 'dev68')
21
+ __version__ = version = '0.2.0.dev72'
22
+ __version_tuple__ = version_tuple = (0, 2, 0, 'dev72')
23
23
 
24
24
  __commit_id__ = commit_id = None
tuieval/cli.py CHANGED
@@ -18,6 +18,7 @@ Day to day
18
18
  tuieval report the verdicts with their evidence, as a markdown file
19
19
  tuieval history every verdict change, newest first
20
20
  tuieval items tests that don't separate models or look broken
21
+ tuieval logs follow the server log of the model running now (live: its answers)
21
22
  tuieval capture LOG --pack turn a real failure (logs/live/*.txt) into a new test
22
23
  tuieval regrade re-score stored answers after changing a grader (--only, --packs)
23
24
  tuieval list the models tuieval knows, hidden ones separately (--packs: the packs)
@@ -85,6 +86,9 @@ def main(argv=None):
85
86
  if cmd == "watch":
86
87
  from . import watch_proxy
87
88
  return watch_proxy.main(rest)
89
+ if cmd == "logs":
90
+ from . import logs
91
+ return logs.main(rest)
88
92
  from . import run_evals
89
93
  if cmd in run_evals.COMMANDS:
90
94
  return run_evals.COMMANDS[cmd](rest)
tuieval/logs.py ADDED
@@ -0,0 +1,220 @@
1
+ """tuieval logs: follow the server log of the model running now, without naming it.
2
+
3
+ tuieval logs the newest server log, then every log that grows (a header says
4
+ which model each part is from), so it moves on with the run
5
+ tuieval logs live each answer (reasoning and answer, from logs/live/) as it finishes
6
+ tuieval logs --list every model's server log, newest first
7
+ tuieval logs MODEL one model's log (any unambiguous part of its label)
8
+
9
+ Read-only: it never touches servers or results. Only servers tuieval starts write a log here;
10
+ OpenRouter and servers that were already running don't.
11
+ """
12
+ import argparse
13
+ import datetime
14
+ import os
15
+ import re
16
+ import sys
17
+ import time
18
+
19
+ from . import workspace
20
+
21
+ POLL_S = 0.5
22
+
23
+
24
+ def server_dir():
25
+ return workspace.path("logs", "server")
26
+
27
+
28
+ def live_dir():
29
+ return workspace.path("logs", "live")
30
+
31
+
32
+ def _files(d, ext):
33
+ """{path: (size, mtime)} for the files in d with this extension (none if d doesn't exist)."""
34
+ out = {}
35
+ try:
36
+ names = os.listdir(d)
37
+ except OSError:
38
+ return out
39
+ for n in names:
40
+ if n.endswith(ext):
41
+ p = os.path.join(d, n)
42
+ try:
43
+ st = os.stat(p)
44
+ except OSError:
45
+ continue
46
+ out[p] = (st.st_size, st.st_mtime)
47
+ return out
48
+
49
+
50
+ def _label(path):
51
+ return os.path.basename(path)[:-len(".log")]
52
+
53
+
54
+ def _tail_offset(path, lines):
55
+ """Where the last `lines` lines of a file start."""
56
+ with open(path, "rb") as f:
57
+ f.seek(0, os.SEEK_END)
58
+ end = pos = f.tell()
59
+ found, chunk = 0, 8192
60
+ while pos > 0 and found <= lines:
61
+ pos = max(0, pos - chunk)
62
+ f.seek(pos)
63
+ found = f.read(end - pos).count(b"\n")
64
+ if pos == 0 and found <= lines:
65
+ return 0
66
+ f.seek(pos)
67
+ data = f.read(end - pos)
68
+ cut = len(data)
69
+ for _ in range(lines + 1):
70
+ cut = data.rfind(b"\n", 0, cut)
71
+ return pos + cut + 1
72
+
73
+
74
+ class Follower:
75
+ """Follows server logs. `poll()` returns the text written since the last poll, with a
76
+ `── label ──` header whenever it comes from another log than the text before it.
77
+ only: follow just this log. Otherwise every log in the folder, including new ones."""
78
+
79
+ def __init__(self, folder, lines=40, only=None):
80
+ self.folder, self.only = folder, only
81
+ self.offsets = {p: size for p, (size, _) in _files(folder, ".log").items()}
82
+ self.last = None # the log the previous text came from
83
+ self.held = {} # path -> size at the last poll, for a line still being written
84
+ start = only or max(self.offsets, key=lambda p: os.path.getmtime(p), default=None)
85
+ if start and start in self.offsets:
86
+ self.offsets[start] = _tail_offset(start, lines)
87
+
88
+ def poll(self):
89
+ out = []
90
+ files = _files(self.folder, ".log")
91
+ if self.only:
92
+ files = {p: v for p, v in files.items() if p == self.only}
93
+ for path, (size, _) in sorted(files.items(), key=lambda kv: kv[1][1]): # oldest change first
94
+ off = self.offsets.setdefault(path, 0)
95
+ if size < off: # truncated or replaced: read it from the start
96
+ off = 0
97
+ if size == off:
98
+ continue
99
+ with open(path, "rb") as f:
100
+ f.seek(off)
101
+ data = f.read(size - off)
102
+ cut = data.rfind(b"\n") + 1
103
+ if not cut: # no complete line yet: wait one poll for the rest of it
104
+ if self.held.get(path) != size:
105
+ self.held[path] = size
106
+ continue
107
+ cut = len(data)
108
+ self.held.pop(path, None)
109
+ self.offsets[path] = off + cut
110
+ if path != self.last:
111
+ out.append(f"── {_label(path)} ──\n")
112
+ self.last = path
113
+ out.append(data[:cut].decode("utf-8", "replace"))
114
+ return "".join(out)
115
+
116
+
117
+ FOOTER = re.compile(r"^=== .*finish=.* ===$", re.M)
118
+
119
+
120
+ class LiveFollower:
121
+ """New answers in logs/live/ as they're written: each one from its reasoning on (the prompt is
122
+ in the file), under a header with the file name."""
123
+
124
+ def __init__(self, folder, last=1):
125
+ self.folder = folder
126
+ files = sorted(_files(folder, ".txt").items(), key=lambda kv: kv[1][1])
127
+ self.seen = {p for p, _ in files[:max(0, len(files) - last)]}
128
+
129
+ def poll(self):
130
+ out = []
131
+ for path, (_, mtime) in sorted(_files(self.folder, ".txt").items(), key=lambda kv: kv[1][1]):
132
+ if path in self.seen:
133
+ continue
134
+ try:
135
+ with open(path, errors="replace") as f:
136
+ text = f.read()
137
+ except OSError:
138
+ continue
139
+ if not FOOTER.search(text) and time.time() - mtime < 2: # still being written
140
+ continue
141
+ self.seen.add(path)
142
+ i = text.find("=== REASONING ===")
143
+ out.append(f"── {os.path.basename(path)[:-4]} ──\n{text[i:] if i >= 0 else text}\n")
144
+ return "".join(out)
145
+
146
+
147
+ def _ago(mtime):
148
+ s = max(0, int(time.time() - mtime))
149
+ if s < 60:
150
+ return f"{s}s ago"
151
+ if s < 3600:
152
+ return f"{s // 60} min ago"
153
+ if s < 86400:
154
+ return f"{s // 3600} h ago"
155
+ return datetime.datetime.fromtimestamp(mtime).strftime("%Y-%m-%d %H:%M")
156
+
157
+
158
+ def _size(n):
159
+ for unit in ("B", "KB", "MB", "GB"):
160
+ if n < 1024 or unit == "GB":
161
+ return f"{n:.0f} {unit}" if unit == "B" else f"{n:.1f} {unit}"
162
+ n /= 1024
163
+
164
+
165
+ def list_logs(folder):
166
+ files = sorted(_files(folder, ".log").items(), key=lambda kv: -kv[1][1])
167
+ if not files:
168
+ return f"No server logs yet in {os.path.relpath(folder)}/."
169
+ w = max(len(_label(p)) for p, _ in files)
170
+ return "\n".join(f"{_label(p):<{w}} {_size(size):>9} {_ago(mtime)}" for p, (size, mtime) in files)
171
+
172
+
173
+ def find_log(folder, name):
174
+ """The log whose label is `name`, or the only one containing it. Raises SystemExit otherwise."""
175
+ labels = {_label(p): p for p in _files(folder, ".log")}
176
+ if name in labels:
177
+ return labels[name]
178
+ hits = sorted(l for l in labels if name.lower() in l.lower())
179
+ if len(hits) == 1:
180
+ return labels[hits[0]]
181
+ if not hits:
182
+ sys.exit(f"No server log matches {name!r}; tuieval logs --list shows them.")
183
+ sys.exit(f"{name!r} matches {len(hits)} logs; say which:\n " + "\n ".join(hits))
184
+
185
+
186
+ def follow(follower, waiting):
187
+ """Print what the follower finds until ctrl-c."""
188
+ said = False
189
+ try:
190
+ while True:
191
+ text = follower.poll()
192
+ if text:
193
+ sys.stdout.write(text)
194
+ sys.stdout.flush()
195
+ said = True
196
+ elif not said:
197
+ print(waiting, flush=True)
198
+ said = True
199
+ time.sleep(POLL_S)
200
+ except KeyboardInterrupt:
201
+ return 0
202
+
203
+
204
+ def main(argv):
205
+ p = argparse.ArgumentParser(prog="tuieval logs", description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter,
206
+ epilog="ctrl-c stops following (a run going on isn't affected).")
207
+ p.add_argument("what", nargs="?", help="'live' for answers, or a model (any unambiguous part of its label)")
208
+ p.add_argument("--list", action="store_true", help="every model's server log, newest first")
209
+ p.add_argument("-n", "--lines", type=int, default=40, help="lines shown before following (default 40)")
210
+ a = p.parse_args(argv)
211
+ if a.list:
212
+ print(list_logs(server_dir()))
213
+ return 0
214
+ if a.what == "live":
215
+ return follow(LiveFollower(live_dir()),
216
+ f"Waiting for answers in {os.path.relpath(live_dir())}/ (ctrl-c stops)")
217
+ only = find_log(server_dir(), a.what) if a.what else None
218
+ return follow(Follower(server_dir(), a.lines, only),
219
+ f"Waiting for {'that model' if only else 'a server'} to log in "
220
+ f"{os.path.relpath(server_dir())}/ (ctrl-c stops)")
tuieval/run_evals.py CHANGED
@@ -11,6 +11,7 @@
11
11
  tuieval run --only my-model --packs my-pack,other-pack
12
12
  tuieval run --tags moe --packs my-pack # models tagged "moe"
13
13
  tuieval run --packs my-pack --tests a,b # only these tests of a pack (or --tests my-pack:a,other:b)
14
+ tuieval run --only my-model --packs my-pack --tests a --retest # ask a question again
14
15
  tuieval run --preset nightly # a selection saved in the TUI (presets.toml)
15
16
  tuieval run --tier smoke --only my-model # 3 tests per pack, 1 repeat: check paths and flags
16
17
  tuieval run --tier smoke --only openrouter:qwen/qwen3-32b # any OpenRouter model, no models.toml edit
@@ -742,7 +743,8 @@ def main(argv=None):
742
743
  p.add_argument("--packs", help="comma-separated packs (default: all)")
743
744
  p.add_argument("--tests", help="comma-separated test ids to run instead of the tier's sample: id with one "
744
745
  "pack in --packs, else pack:id (and --packs defaults to those packs)")
745
- p.add_argument("--force", action="store_true", help="rerun packs (or the --tests) that already have current results")
746
+ p.add_argument("--retest", "--force", action="store_true", dest="force",
747
+ help="ask again even if already answered: the packs, or just the --tests (earlier answers go to history/)")
746
748
  p.add_argument("--repeat", type=int, help="times each question is asked, any tier (default: 1 for smoke and "
747
749
  "screen, the pack's certification count for certify)")
748
750
  p.add_argument("--tier", choices=engine.TIERS, default="screen",
tuieval/tui.py CHANGED
@@ -385,6 +385,9 @@ HELP = {
385
385
  [b]Models at a time[/b]: how many of the ticked models run side by side (blank: this machine's
386
386
  parallel_models in models.toml, default 1). Answers note the models they ran alongside.
387
387
 
388
+ [b]Retest[/b]: ask the ticked questions again even if they're already answered (only the tests
389
+ picked with e, if any). Without it, answered questions are skipped. Replaced answers go to history/.
390
+
388
391
  [b]Keys[/b]
389
392
  s start (with a run going: add to it, or queue it) r results
390
393
  a add a model (a GGUF, a model id, openrouter:<id>) m scan model folders for new GGUFs
@@ -646,7 +649,7 @@ class SetupScreen(Screen):
646
649
  yield Input("", id="repeat", type="integer", max_length=2, placeholder="1")
647
650
  yield Label("Models at a time")
648
651
  yield Input("", id="parallel", type="integer", max_length=1, placeholder="1")
649
- yield Checkbox("Rerun existing results", id="force")
652
+ yield Checkbox("Retest (ask again, even if already answered)", id="force")
650
653
  yield Static(id="estimate")
651
654
  with Horizontal(id="buttons"):
652
655
  yield Button("Start [s]", id="start", variant="success")
@@ -958,7 +961,7 @@ class SetupScreen(Screen):
958
961
  if not run:
959
962
  text += "\n[yellow]Nothing selected can run (see skipping).[/yellow]"
960
963
  elif rerun:
961
- text += "\n[yellow]Everything selected has results; Start runs it again.[/yellow]"
964
+ text += "\n[yellow]Everything selected has results; Start retests it.[/yellow]"
962
965
  resumed = [j for j in run if "done earlier" in j.note]
963
966
  if resumed:
964
967
  text += f" [yellow]{len(resumed)} pack(s) continue from earlier results[/yellow]"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tuieval
3
- Version: 0.2.0.dev68
3
+ Version: 0.2.0.dev72
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
@@ -162,6 +162,8 @@ tuieval history # every verdict change over time
162
162
  tuieval compare --speed --pairwise --failures # scorecards
163
163
  tuieval selftest # check every test's reference and wrong answers
164
164
  tuieval items # tests that don't separate models or look broken
165
+ tuieval logs # follow the server log of the model running now
166
+ tuieval logs live # each answer as it finishes (--list: every log)
165
167
  tuieval capture logs/live/<file> --pack X # turn a real failure into a new test
166
168
  tuieval regrade # re-score stored answers after changing a grader
167
169
  tuieval regrade --only <model> --packs X # just one model's results (and packs)
@@ -1,23 +1,24 @@
1
1
  tuieval/__init__.py,sha256=myVXVX7htbwezW6k3x_FuKgn1RSZ2WcTaDEMByGn6Wg,312
2
2
  tuieval/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
3
- tuieval/_version.py,sha256=-5RoY-3h38Zwg0fzKJuoa3DtBDQFu5H5pzCM1Lh0aFE,535
3
+ tuieval/_version.py,sha256=5bSTQoJyfnoC1UimCugL5jEW1WKsn9kwuboOZkyp3xk,535
4
4
  tuieval/builtin.toml,sha256=Kxw22RZCJhURUyu5Wz8tj5Y1nM85A8hFVRbA4ocoPUg,4293
5
- tuieval/cli.py,sha256=fn6z0cupM-aW3fY5fFgnS-HmOQmMzlDg-U76Y6LgL3o,4510
5
+ tuieval/cli.py,sha256=JGtN4J6d4cr9G7OfBxDiNtxvVEew9MgUhJBlYKYPhJ4,4687
6
6
  tuieval/client.py,sha256=kpsyLEZKfxCsvIGBHBbBy83TpI97CvnGCDq-4AbJS4Y,9986
7
7
  tuieval/compare.py,sha256=T6a_PC7z-jHEvw09KEceo2dxoLMi-9cHYPQs4L6Ctig,26997
8
8
  tuieval/doctor.py,sha256=j2MdDORstsAGPnRmpsnxau1_fR6sTc_oEFGM5zugTJU,7246
9
9
  tuieval/engine.py,sha256=SsXqR1ydn827qBX8NoawyT2roNuelmrZB-hOuyGSesY,116514
10
10
  tuieval/export.py,sha256=dbHQgL_ubWtIPM1sLzAew_gETnrDJyd0zgqVA5vkpXM,9657
11
+ tuieval/logs.py,sha256=01gZK6tf53dIThaIrs1bEsz9eqKYVlcxpyaLnSPTVxo,8127
11
12
  tuieval/machines.py,sha256=t9tu6CZeXZON4EtOVnEwP4VtaynpVLf9Cz8TNjf7jtY,20124
12
13
  tuieval/onboard.py,sha256=IYETVDWCCo9vF0Dtj4_rr9VanYeCky8PwP3-2g5A_l0,6215
13
14
  tuieval/packs.py,sha256=tiLmxsrX_M5EUMuR4Yvb7pLBLEI15wamHSjflD6wjoY,11299
14
15
  tuieval/profiles.py,sha256=soeLxjdB-l-OxSY8jZ4yjwfdSnsBV-QICcwKxRJS7nQ,3663
15
16
  tuieval/pta.py,sha256=i5oPj-Pz3N9u7bzzuZwsQvMGdxWdAncww2nR15K6PHY,12108
16
17
  tuieval/remove.py,sha256=Vwh43nm9lVb9U9aN-h6CMYbkTwdR3UWfZObwweF72n0,5157
17
- tuieval/run_evals.py,sha256=1zNkCdFt744cqpebqiyj-sZrbOI22c6IYBcXk9koz20,46538
18
+ tuieval/run_evals.py,sha256=WVrGU418Fv4oP5ddKNd5k2_0QjNz4ZEiJHQhKrNDR4w,46712
18
19
  tuieval/scaffold.py,sha256=YBOqniJpf_GtKKAFF3_OHxxMGbmTWdFjcClGcOnrrKE,12130
19
20
  tuieval/selftest.py,sha256=nExkrOidgymlmvkxImEBfrQG5iTUN5WuRMIKtqusCCs,9835
20
- tuieval/tui.py,sha256=CkK7e3aJ3kli--u0cJrpaQKEoGAucs3grg3xt6x5v2c,166041
21
+ tuieval/tui.py,sha256=q-ufpI9YdYPJhrmomDOZJME8sBw1u94_P3t4VMzEIpo,166257
21
22
  tuieval/tune.py,sha256=azxxthgJeag8JyoQUgaRxq6oI1XvEgzb9vkszjJZH7w,39645
22
23
  tuieval/verdict.py,sha256=VB-0LTxR9y8bJHT9RicxtE9K7cUHBdCu40hOCrsbmA4,19150
23
24
  tuieval/watch_proxy.py,sha256=bnDO1i6n6yUs1hODoUWcMppJMGPavoQqs6aNYrIxpT8,11416
@@ -46,8 +47,8 @@ tuieval/templates/packs/tool_call/pack.toml,sha256=n4bx0lGJHSmW41uVqhfIXJ2BWZpmT
46
47
  tuieval/templates/packs/tool_call/system.txt,sha256=mKxu-lB-0YjLHXdgeFJa8x2C180OvcNz5cHv2N5Bg3U,254
47
48
  tuieval/templates/packs/tool_call/tests.yaml,sha256=Nv7c4syrzJ9cU8EBKSK_1ZSFx9V02aCjW4-2TBCPT7s,1859
48
49
  tuieval/templates/packs/tool_call/tools.yaml,sha256=HgxCkh0On2VwbHSsjAGM8tNCK7ZtKLGrs7lMCn3Fprs,1048
49
- tuieval-0.2.0.dev68.dist-info/METADATA,sha256=GpjUswFVv-sJbkVrDXX4-rloDzF8Mngap9YKtG3yrZs,14025
50
- tuieval-0.2.0.dev68.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
51
- tuieval-0.2.0.dev68.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
52
- tuieval-0.2.0.dev68.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
53
- tuieval-0.2.0.dev68.dist-info/RECORD,,
50
+ tuieval-0.2.0.dev72.dist-info/METADATA,sha256=MbPZAuXA-J7aRQAolpHk2QRyyt97Y3Sua4RjKuER1bM,14215
51
+ tuieval-0.2.0.dev72.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
52
+ tuieval-0.2.0.dev72.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
53
+ tuieval-0.2.0.dev72.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
54
+ tuieval-0.2.0.dev72.dist-info/RECORD,,