tuieval 0.2.0.dev147__py3-none-any.whl → 0.2.0.dev152__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.dev147'
22
- __version_tuple__ = version_tuple = (0, 2, 0, 'dev147')
21
+ __version__ = version = '0.2.0.dev152'
22
+ __version_tuple__ = version_tuple = (0, 2, 0, 'dev152')
23
23
 
24
24
  __commit_id__ = commit_id = None
tuieval/cli.py CHANGED
@@ -29,6 +29,7 @@ Advanced
29
29
  tuieval scan list GGUFs in model_dirs that aren't in models.toml yet
30
30
  tuieval machines this machine, other recorded machines, and fit and tuning per model
31
31
  tuieval tune MODEL find the fastest speed-only server flags for a model on this machine
32
+ tuieval tune MODEL --ctx measure the largest context the model can be served with on this machine
32
33
  tuieval export pi MODEL serve a model in the pi coding agent with its tuned flags
33
34
  tuieval watch a proxy that shows the reasoning of any app using your server
34
35
  tuieval help · --version
tuieval/ctxbench.py ADDED
@@ -0,0 +1,424 @@
1
+ """Find the largest context a model can be served with on this machine, by trying it, and save it
2
+ in tuning/<machine-id>/<label>.ctx.toml. Runs then use it in place of the fit check's estimate.
3
+
4
+ tuieval tune MODEL --ctx [--max N] [--start N] [--step N] [--max-starts N]
5
+
6
+ It works the same for every server tuieval starts, because it only uses what they all have:
7
+
8
+ the context set through {ctx} in the server's cmd, or its ctx_flag
9
+ the API one chat request per try, and the token counts the server reports
10
+ the machine the memory the server takes (how much less is available while it runs; VRAM on
11
+ discrete GPUs), macOS memory pressure and swapping
12
+
13
+ One try ("probe") at a context: start the server with it, send a document that fills it (sized
14
+ from the server's own token counts, so any tokenizer works) with one fact near the start, and ask
15
+ for that fact. The probe passes when the answer is right, the server read the whole document (a
16
+ server that cuts long prompts short reports fewer tokens, or loses the fact), and the machine
17
+ stayed healthy. Filling matters: some servers only take memory as the context fills.
18
+
19
+ The search starts at half the context the model runs with now and doubles, up to the model's own
20
+ limit: what models.toml caps the context at (max_ctx, ctx, a context flag) doesn't bound it, since
21
+ the measurement replaces those. Memory grows about linearly with the context, so two probes that
22
+ passed predict the largest context that fits under the machine's limit; no probe goes above that
23
+ prediction, and a failed probe is bisected against the largest that passed. A probe is stopped at
24
+ once, while the server loads or works, when memory pressure rises, the machine starts swapping,
25
+ or memory runs out. Typically 3 to 5 server starts.
26
+
27
+ Memory is read off the machine, not the server's processes: available memory before the server
28
+ starts less the lowest it falls to. Resident memory would count files a server maps and reads on
29
+ demand, which the system can drop again, and that reading is what is compared with the memory
30
+ available, so both are in the same terms.
31
+
32
+ A server tuieval doesn't start, or can't set the context of, is only verified at the context its
33
+ model declares (max_context): one probe, nothing saved.
34
+ """
35
+ import dataclasses
36
+ import os
37
+ import threading
38
+
39
+ from . import engine as engine_mod
40
+ from . import machines
41
+ from . import profiles
42
+ from . import tune
43
+
44
+ ANSWER_TOKENS = 1024 # room for the answer (and any thinking) in a probe
45
+ STEP = 8192 # how close to the true maximum the search gets
46
+ FLOOR = machines.MIN_CTX # the smallest context tried
47
+ FIRST = 32768 # the first context tried for a model whose usual context isn't known
48
+ APART = 0.8 # memory per token is read off two probes at least this far apart (the lower one
49
+ # at most this share of the higher): closer ones differ by less than the noise
50
+ MAX_STARTS = 8
51
+ REQUEST_LIMIT_S = 3600 # reading a few hundred thousand tokens takes a while ([tune] ctx_request_timeout_s)
52
+ PRESSURE_WARNING = 2 # macOS memory pressure level that stops a probe (1 is normal)
53
+ SWAP_STOP_MB = 512 # swapped out while a probe ran: stop it
54
+ AVAILABLE_STOP_GB = 1.0 # memory available under this stops a probe
55
+ TOO_LITTLE = 0.5 # a reading under this share of the model's size on disk can't be right for a server
56
+ # that holds the model in memory: its resident memory is used instead
57
+ SAMPLE_CHARS = 12000 # the request that measures the server's characters per token
58
+ UNKNOWN_CHARS_PER_TOKEN = 3.0 # for a server that reports no token counts: short of full rather than over
59
+ NOT_ABOUT_CONTEXT = ("already in use", "isn't installed", "not found", "is not set", "skipped by user")
60
+ CODE = 481739 # six digits: no section number or step count in the document can equal it
61
+ WORDS = ("river", "station", "ledger", "orchard", "signal", "harbour", "copper", "meadow", "lantern",
62
+ "quarry", "window", "valley", "engine", "garden", "bridge", "tower")
63
+
64
+
65
+ @dataclasses.dataclass
66
+ class Probe:
67
+ ctx: int
68
+ ok: bool = False
69
+ error: str = ""
70
+ mem_gb: float | None = None # the server's peak memory with the context full
71
+ prompt_tokens: int | None = None # as the server counted them
72
+ pp_tps: float | None = None
73
+ tg_tps: float | None = None
74
+ total_s: float | None = None
75
+ load_s: float | None = None
76
+ filled: bool = False # the server's token count confirms the context was full
77
+
78
+ def summary(self):
79
+ if not self.ok:
80
+ return f"failed: {self.error}"
81
+ parts = ["ok"]
82
+ if self.mem_gb is not None:
83
+ parts.append(f"{self.mem_gb:.1f} GB")
84
+ if self.prompt_tokens:
85
+ parts.append(f"{self.prompt_tokens:,} prompt tokens" + ("" if self.filled else " (fill not confirmed)"))
86
+ if self.pp_tps:
87
+ parts.append(f"prompt {self.pp_tps:.0f} tok/s")
88
+ if self.tg_tps:
89
+ parts.append(f"gen {self.tg_tps:.1f} tok/s")
90
+ return ", ".join(parts)
91
+
92
+
93
+ # ------------------------------------------------------------------ the document
94
+ def document(chars):
95
+ """A ~chars-long synthetic document with one fact near its start and the question at its end
96
+ (the same text every time). A server that drops the start of a long prompt loses the fact."""
97
+ paras, size, i = [], 0, 0
98
+ while size < chars:
99
+ w = [WORDS[(i * 7 + k * 3) % len(WORDS)] for k in range(12)]
100
+ p = (f"Section {i + 1}. The {w[0]} near the {w[1]} kept a {w[2]} of every {w[3]}, and the {w[4]} by the "
101
+ f"{w[5]} was painted {w[6]} after the {w[7]} flooded. Visitors to the {w[8]} counted "
102
+ f"{(i * 37) % 900 + 100} steps to the {w[9]}, past a {w[10]} facing the {w[11]}.")
103
+ paras.append(p)
104
+ size += len(p) + 2
105
+ i += 1
106
+ paras.insert(max(1, len(paras) // 20), f"Note: the archive room code is {CODE}.")
107
+ return "\n\n".join(paras) + "\n\nWhat is the archive room code? Answer with the number only."
108
+
109
+
110
+ def _ask(eng, m, base_url, chars, max_tokens, name, emit, limit):
111
+ sampling = engine_mod.effective_sampling(eng.cfg, m)
112
+ request = eng.cfg["servers"][m["server"]].get("request", {})
113
+ body = tune._body(m, sampling, [{"role": "user", "content": document(chars)}], max_tokens, request)
114
+ body.pop("ignore_eos", None) # the answer should end where the model ends it
115
+ return tune._stream_request(eng, base_url, body, name, emit, limit)
116
+
117
+
118
+ def chars_per_token(eng, m, base_url, emit, limit):
119
+ """Characters of the document per token, by this server's count (None if it reports none)."""
120
+ from . import client
121
+ res = _ask(eng, m, base_url, SAMPLE_CHARS, 8, "sizing", emit, limit)
122
+ if res.get("error"):
123
+ raise engine_mod.ModelFailed(f"sizing request: {res['error']}")
124
+ tokens = client.metrics(res)["prompt_tokens"]
125
+ return SAMPLE_CHARS / tokens if tokens else None
126
+
127
+
128
+ def too_long(error):
129
+ e = (error or "").lower()
130
+ return "http 4" in e and any(w in e for w in ("context", "too long", "too large", "exceed", "maximum"))
131
+
132
+
133
+ class Guard:
134
+ """Watches the machine while a probe's server loads and works. When it gets unhealthy, the
135
+ server is stopped: a load is abandoned and a request is cut off."""
136
+
137
+ def __init__(self, eng, every_s=2.0):
138
+ self.eng, self.every_s, self.reason = eng, every_s, ""
139
+ self.pressure, self._stop = machines.memory_pressure_level(), threading.Event()
140
+ self._swap0 = machines.swapped_out_bytes()
141
+ self._own_memory = eng.machine().discrete # VRAM: the machine's memory isn't what runs out
142
+ self.available0 = self.lowest = None if self._own_memory else machines.available_memory_gb()
143
+
144
+ def __enter__(self):
145
+ self._thread = threading.Thread(target=self._run, daemon=True)
146
+ self._thread.start()
147
+ return self
148
+
149
+ def check(self):
150
+ lvl = machines.memory_pressure_level()
151
+ if lvl is not None:
152
+ self.pressure = max(self.pressure or 0, lvl)
153
+ if lvl >= PRESSURE_WARNING:
154
+ return f"macOS memory pressure rose to level {lvl}"
155
+ swap = machines.swapped_out_bytes()
156
+ if None not in (swap, self._swap0) and (swap - self._swap0) / 2**20 > SWAP_STOP_MB:
157
+ return f"the machine swapped out {(swap - self._swap0) / 2**20:.0f} MB"
158
+ if not self._own_memory:
159
+ free = machines.available_memory_gb()
160
+ if free is not None:
161
+ self.lowest = free if self.lowest is None else min(self.lowest, free)
162
+ if free < AVAILABLE_STOP_GB:
163
+ return f"only {free:.1f} GB of memory was left"
164
+ return ""
165
+
166
+ def taken_gb(self):
167
+ """Memory the machine lost while the block ran (None where it can't be read)."""
168
+ if None in (self.available0, self.lowest):
169
+ return None
170
+ return max(self.available0 - self.lowest, 0.0)
171
+
172
+ def _run(self):
173
+ while not self._stop.wait(self.every_s):
174
+ self.reason = self.reason or self.check()
175
+ if self.reason:
176
+ self.eng._stall = self.reason # ends the wait for a server that is still loading
177
+ stream = getattr(self.eng, "_stream", None)
178
+ if stream is not None:
179
+ stream.close()
180
+ return
181
+
182
+ def __exit__(self, *exc):
183
+ self._stop.set()
184
+ self._thread.join(self.every_s + 1)
185
+ self.reason = self.reason or self.check()
186
+ self.eng._stall = None
187
+
188
+
189
+ def probe(eng, m, ctx, emit=lambda *a, **k: None, limit=REQUEST_LIMIT_S):
190
+ """Serve the model with this context, fill it and ask for the fact. Returns a Probe."""
191
+ from . import client
192
+ out = Probe(ctx)
193
+ reserve = ANSWER_TOKENS + max(256, ctx // 50)
194
+ target = ctx - reserve
195
+ if target < 1024:
196
+ out.error = f"a context of {ctx:,} is too small to test"
197
+ return out
198
+ guard = Guard(eng)
199
+ try:
200
+ with guard, eng.serve(m, log_name=f"{m['label']}.ctx", ctx=ctx) as (url, info):
201
+ out.load_s = round(info["load_s"], 1) if info.get("load_s") else None
202
+ ratio = chars_per_token(eng, m, url, emit, limit)
203
+ chars = int(target * (ratio or UNKNOWN_CHARS_PER_TOKEN) * 0.98)
204
+ emit("tune_progress", message=f" filling the context: ~{target:,} tokens, {chars:,} characters"
205
+ + ("" if ratio else " (the server reports no token counts)"))
206
+ res = _ask(eng, m, url, chars, ANSWER_TOKENS, "fill", emit, limit)
207
+ if too_long(res.get("error")) and not guard.reason:
208
+ emit("tune_progress", message=" the server found that too long; trying 7% shorter")
209
+ res = _ask(eng, m, url, int(chars * 0.93), ANSWER_TOKENS, "fill", emit, limit)
210
+ met = client.metrics(res) if not res.get("error") else {}
211
+ out.prompt_tokens, out.pp_tps, out.tg_tps = met.get("prompt_tokens"), met.get("prompt_tps"), met.get("gen_tps")
212
+ out.total_s = round(res["total_s"], 1) if res.get("total_s") else None
213
+ guard.check()
214
+ out.mem_gb = memory_gb(eng, m, info, guard)
215
+ text = (res.get("answer") or "") + (res.get("reasoning") or "")
216
+ if res.get("error"):
217
+ out.error = res["error"]
218
+ elif not info["alive"]():
219
+ out.error = "the server stopped"
220
+ elif str(CODE) not in text:
221
+ out.error = "it didn't find a fact near the start of the document (the context isn't all used)"
222
+ elif out.prompt_tokens and out.prompt_tokens < 0.85 * target:
223
+ out.error = (f"the server read {out.prompt_tokens:,} of ~{target:,} tokens "
224
+ "(it cuts long prompts short)")
225
+ else:
226
+ out.ok = True
227
+ out.filled = bool(ratio and out.prompt_tokens and out.prompt_tokens >= 0.85 * target)
228
+ except engine_mod.ModelFailed as e:
229
+ out.error = str(e).splitlines()[0]
230
+ if not guard.reason and any(w in out.error for w in NOT_ABOUT_CONTEXT):
231
+ raise # a smaller context wouldn't help
232
+ if guard.reason: # the machine got unhealthy: that is why, whatever the server said as it was stopped
233
+ out.ok, out.error = False, guard.reason
234
+ return out
235
+
236
+
237
+ # ------------------------------------------------------------------ the search
238
+ def memory_gb(eng, m, info, guard):
239
+ """What the server took with its context full: VRAM on a discrete GPU, else how much less memory
240
+ the machine had available, else (where that can't be read, or reads implausibly low for a model
241
+ of this size) the resident memory of the server's processes."""
242
+ if eng.machine().discrete:
243
+ return round(info["vram_peak_gb"], 2) if info.get("vram_peak_gb") else None
244
+ taken, size = guard.taken_gb(), model_gb(m)
245
+ resident = (info["peak_mb"]() or 0) / 1024 if info.get("peak_mb") else 0
246
+ if not taken or (size and taken < TOO_LITTLE * size <= resident):
247
+ taken = resident
248
+ return round(taken, 2) if taken else None
249
+
250
+
251
+ def predict(passed, limit_gb):
252
+ """(base_gb, gb_per_token, largest context predicted to fit) from the largest context that
253
+ passed with a memory reading and the nearest one well below it (APART). The third is None when
254
+ memory doesn't grow with the context (nothing to predict) or there aren't two such readings."""
255
+ pts = sorted((p.ctx, p.mem_gb) for p in passed if p.mem_gb)
256
+ if len(pts) < 2:
257
+ return None, None, None
258
+ c2, g2 = pts[-1]
259
+ c1, g1 = next(((c, g) for c, g in reversed(pts[:-1]) if c <= APART * c2), pts[0])
260
+ per = (g2 - g1) / (c2 - c1)
261
+ base = g2 - per * c2
262
+ if per <= 0 or limit_gb is None:
263
+ return base, max(per, 0.0), None
264
+ return base, per, int((limit_gb - base) / per)
265
+
266
+
267
+ def _grid(n):
268
+ return int(n) // 1024 * 1024
269
+
270
+
271
+ def search(try_ctx, start, upper, limit_gb=None, step=STEP, floor=FLOOR, max_starts=MAX_STARTS,
272
+ emit=lambda *a, **k: None):
273
+ """Probe contexts until the largest that works is known to within `step`. try_ctx(ctx) -> Probe.
274
+ Returns (probes in the order tried, why it stopped)."""
275
+ tried, lo, hi, c = [], None, None, min(start, upper)
276
+ why = f"{max_starts} server starts used"
277
+ while len(tried) < max_starts:
278
+ emit("tune_step", message=f"[{len(tried) + 1}] context {c:,}", start=len(tried) + 1, max_starts=max_starts)
279
+ r = try_ctx(c)
280
+ tried.append(r)
281
+ emit("tune_result", message=" " + r.summary(), result=r)
282
+ if r.ok:
283
+ lo = max(lo or 0, c)
284
+ else:
285
+ hi = min(hi or c, c)
286
+ if lo is None: # nothing has worked yet: halve
287
+ c = _grid(hi // 2)
288
+ if c < floor:
289
+ why = f"nothing from {floor:,} up worked"
290
+ break
291
+ continue
292
+ if lo >= upper:
293
+ why = f"reached the upper bound ({upper:,})"
294
+ break
295
+ if hi is not None and hi - lo <= step:
296
+ why = f"{hi:,} failed: {next(p.error for p in tried if p.ctx == hi)}"
297
+ break
298
+ _, per, fit = predict([p for p in tried if p.ok], limit_gb)
299
+ nxt = min(upper, lo * 2) if hi is None else lo + _grid((hi - lo) / 2)
300
+ if fit is not None and fit < nxt:
301
+ if _grid(fit) - lo < min(step, upper - lo):
302
+ at = min(upper, lo + step)
303
+ why = (f"memory: {at:,} is predicted to need more than the {limit_gb:.1f} GB this machine has "
304
+ f"for it ({per * 1000:.3f} GB per 1,000 tokens)")
305
+ break
306
+ nxt = _grid(fit)
307
+ if nxt <= lo:
308
+ why = f"{hi:,} failed: {next(p.error for p in tried if p.ctx == hi)}" if hi else why
309
+ break
310
+ c = nxt
311
+ return tried, why
312
+
313
+
314
+ # ------------------------------------------------------------------ driver
315
+ def model_gb(m):
316
+ """The model's size on disk (a file with its other shards beside it, or a folder), or None."""
317
+ path = engine_mod.expand(str(m.get("model", "")))
318
+ try:
319
+ if os.path.isfile(path):
320
+ return os.path.getsize(path) / machines.GB
321
+ if os.path.isdir(path):
322
+ return sum(os.path.getsize(os.path.join(d, f)) for d, _, fs in os.walk(path) for f in fs) / machines.GB
323
+ except OSError:
324
+ pass
325
+ return None
326
+
327
+
328
+ def room_gb(eng):
329
+ """(memory this machine has for a model now, a reason not to load one at all or "")."""
330
+ mc = eng.machine()
331
+ headroom = eng.headroom_gb(mc)
332
+ if mc.discrete:
333
+ used = machines.vram_used_gb()
334
+ return mc.gpu_limit_gb - (used or 0) - headroom, ""
335
+ level = machines.memory_pressure_level()
336
+ if level is not None and level > 1:
337
+ return None, f"macOS memory pressure is already elevated (level {level}); close other apps or models first"
338
+ free = machines.available_memory_gb()
339
+ limit = mc.gpu_limit_gb - headroom
340
+ return (limit if free is None else min(limit, free - headroom)), ""
341
+
342
+
343
+ def upper_bound(m, asked=None):
344
+ """(the largest context worth trying, where that number comes from): the model's own limit.
345
+ What models.toml caps the context at (max_ctx, ctx, a context flag) isn't one: the measurement
346
+ replaces those."""
347
+ if asked:
348
+ return asked, "--max"
349
+ path = engine_mod.expand(str(m.get("model", "")))
350
+ if os.path.isfile(path):
351
+ try:
352
+ n = machines.read_gguf(path).get("context_length")
353
+ if n:
354
+ return n, "the model file"
355
+ except (OSError, ValueError):
356
+ pass
357
+ if m.get("max_context"):
358
+ return m["max_context"], "the model's max_context"
359
+ raise engine_mod.ModelFailed("the model's own context limit isn't known: pass --max N")
360
+
361
+
362
+ def bench(eng, label, emit=lambda *a, **k: None, max_ctx=None, start=None, step=STEP, max_starts=MAX_STARTS):
363
+ """Measure the largest context one model can be served with here and save it. Returns the saved
364
+ measurement, or {"verified": bool, ...} for a server whose context tuieval can't set."""
365
+ m = eng.model(label)
366
+ server = eng.cfg["servers"][m["server"]]
367
+ if eng.hosted(m):
368
+ raise engine_mod.ModelFailed("it's a hosted model: its context doesn't depend on this machine")
369
+ how = engine_mod.takes_context(server)
370
+ limit_s = eng.cfg.get("tune", {}).get("ctx_request_timeout_s", REQUEST_LIMIT_S)
371
+ sv = eng.serving(m)
372
+ if not how:
373
+ ctx = m.get("max_context") or sv.ctx
374
+ if not ctx:
375
+ raise engine_mod.ModelFailed("tuieval can't set this server's context ({ctx} in its cmd, or ctx_flag), and "
376
+ "the model has no max_context to verify")
377
+ emit("tune_step", message=f"tuieval can't set this server's context: checking the {ctx:,} it declares")
378
+ r = probe(eng, m, ctx, emit, limit_s)
379
+ emit("tune_result", message=" " + r.summary(), result=r)
380
+ return {"verified": r.ok, "ctx": ctx, "probe": r}
381
+ upper, source = upper_bound(m, max_ctx)
382
+ upper = max(upper, FLOOR)
383
+ room, refuse = room_gb(eng)
384
+ if refuse:
385
+ raise engine_mod.ModelFailed(refuse)
386
+ size = model_gb(m)
387
+ if room is not None and size is not None and size > room:
388
+ raise engine_mod.ModelFailed(f"the model is {size:.1f} GB and {room:.1f} GB is free for it now: another "
389
+ "model or app is holding memory")
390
+ # Half of what it runs with now, so the second probe is a context expected to work and the two
391
+ # give the memory per token before anything larger is tried.
392
+ usual = sv.ctx if sv.fits and sv.ctx else None
393
+ first = min(upper, max(FLOOR, _grid(start or (usual // 2 if usual else FIRST))))
394
+ emit("tune_step", message=f"largest context up to {upper:,} ({source})"
395
+ + (f"; {room:.1f} GB of memory to work with" if room is not None else ""))
396
+
397
+ def try_ctx(ctx):
398
+ eng._check()
399
+ return probe(eng, m, ctx, emit, limit_s)
400
+
401
+ tried, why = search(try_ctx, first, upper, room, step, min(FLOOR, first), max_starts, emit)
402
+ passed = [p for p in tried if p.ok]
403
+ if not passed:
404
+ raise engine_mod.ModelFailed(f"no context worked ({why}); the last try: {tried[-1].error}")
405
+ best = max(passed, key=lambda p: p.ctx)
406
+ base, per, _ = predict(passed, room)
407
+ measured = {
408
+ "max_ctx": best.ctx,
409
+ "measured": {"memory_gb": best.mem_gb, "base_gb": round(base, 2) if base is not None else None,
410
+ "gb_per_1k_tokens": round(per * 1000, 4) if per is not None else None,
411
+ "prompt_tokens": best.prompt_tokens, "prompt_tps": best.pp_tps, "gen_tps": best.tg_tps,
412
+ "fill_s": best.total_s, "load_s": best.load_s, "limit_gb": round(room, 1) if room is not None else None,
413
+ "stopped": why},
414
+ "probes": {str(p.ctx): p.summary() for p in tried},
415
+ "meta": {"date": profiles.now(), "machine": sv.machine.summary, "server_version": eng.server_version(m),
416
+ "model_file": os.path.basename(str(m.get("model", ""))), "model_bytes": sv.identity.get("model_bytes"),
417
+ "kv_type": sv.kv_type, "upper_bound": upper, "upper_bound_from": source,
418
+ "fill_confirmed": best.filled, "server_starts": len(tried)},
419
+ }
420
+ path = profiles.save_context(sv.machine.id, label, measured, eng.tuning_dir)
421
+ eng._serving.clear()
422
+ shown = os.path.relpath(path, eng.root) if path.startswith(eng.root) else path
423
+ emit("tune_done", message=f"saved {shown}", profile=measured, path=path)
424
+ return measured
tuieval/engine.py CHANGED
@@ -162,6 +162,43 @@ def effective_sampling(cfg, m):
162
162
  CONTEXT_FLAGS = {"--max-context", "--max-context-tokens", "--ctx-size", "-c", "--context-length", "--max-model-len"}
163
163
 
164
164
 
165
+ def read_context(args, flag):
166
+ """The context a command line sets with the server's context flag ("--flag N" or "--flag=N"), or None."""
167
+ args = [str(a) for a in args]
168
+ for i, a in enumerate(args):
169
+ value = args[i + 1] if a == flag and i + 1 < len(args) else a[len(flag) + 1:] if a.startswith(flag + "=") else ""
170
+ if value.isdigit():
171
+ return int(value)
172
+ return None
173
+
174
+
175
+ def set_context(args, flag, ctx):
176
+ """The command line with the server's context flag set to ctx: its value replaced where the flag
177
+ is there ("--flag N" or "--flag=N"), the flag added where it isn't."""
178
+ out, i, done = [], 0, False
179
+ while i < len(args):
180
+ a = str(args[i])
181
+ if a == flag and i + 1 < len(args):
182
+ out += [a, str(ctx)]
183
+ i, done = i + 2, True
184
+ continue
185
+ if a.startswith(flag + "="):
186
+ a, done = f"{flag}={ctx}", True
187
+ out.append(a)
188
+ i += 1
189
+ return out if done else out + [flag, str(ctx)]
190
+
191
+
192
+ def takes_context(server):
193
+ """How tuieval can set this server's context: "placeholder" ({ctx} in its cmd), "flag" (its
194
+ ctx_flag), or "" when it can't (a server it doesn't start, or one with neither)."""
195
+ if not server.get("cmd"):
196
+ return ""
197
+ if any("{ctx}" in str(a) for a in server["cmd"]):
198
+ return "placeholder"
199
+ return "flag" if server.get("ctx_flag") else ""
200
+
201
+
165
202
  def strip_context(args):
166
203
  """A command line without its context-size flags (and their values)."""
167
204
  out, skip = [], False
@@ -254,6 +291,9 @@ class Serving:
254
291
  profile: dict | None = None
255
292
  mtp_layers: int = 0
256
293
  need_gb: float | None = None # estimated GPU memory at ctx (from the fit check); None when unknown
294
+ ctx_source: str = "" # "measured" when ctx comes from tuieval tune --ctx on this machine
295
+ ctx_measured: dict | None = None # that measurement (profiles.load_context), also when it's out of date
296
+ ctx_note: str = "" # why a measurement isn't used
257
297
 
258
298
 
259
299
  def infer_server(cfg, model):
@@ -1420,33 +1460,46 @@ class Engine:
1420
1460
  ctx, fits, note, need = f.max_ctx, f.fits, f.note, f.need_gb
1421
1461
  except (OSError, ValueError) as e:
1422
1462
  note = f"couldn't read the GGUF header ({e}); context not checked"
1423
- profile, perf, source = None, [], "n/a"
1463
+ profile, perf, perf_source = None, [], "n/a"
1424
1464
  if server.get("cmd") and (server.get("perf") or server.get("tune")):
1425
1465
  perf = list(server.get("perf", []))
1426
1466
  profile = profiles.load(mc.id, m["label"], self.tuning_dir)
1427
1467
  if profile:
1428
1468
  perf += list(profile["args"])
1429
1469
  why = profiles.stale(profile, self.server_version(m), size)
1430
- source = f"outdated: {why}" if why else \
1470
+ perf_source = f"outdated: {why}" if why else \
1431
1471
  ("seeded" if profile.get("meta", {}).get("method") == "seeded" else "tuned")
1432
1472
  else:
1433
1473
  perf += self.default_knob_args(server, mc)
1434
- source = "untuned"
1474
+ perf_source = "untuned"
1435
1475
  flag = server.get("ctx_flag") # e.g. --max-context-tokens, when the server takes one
1436
1476
  if flag and ctx is None:
1437
- args = list(m.get("server_args", [])) + perf
1438
- if flag in args[:-1]:
1439
- try:
1440
- ctx = int(args[args.index(flag) + 1])
1441
- except ValueError:
1442
- pass
1477
+ ctx = read_context(list(m.get("server_args", [])) + perf, flag)
1478
+ # The largest context measured here (tuieval tune --ctx) is the context: it replaces the estimate
1479
+ # and whatever models.toml caps it at (max_ctx, ctx, max_context, a context flag), which were
1480
+ # written without knowing it.
1481
+ how, source, ctx_note = takes_context(server), "", ""
1482
+ measured = profiles.load_context(mc.id, m["label"], self.tuning_dir) if how else None
1483
+ if measured:
1484
+ meta = measured.get("meta", {})
1485
+ if meta.get("model_bytes") and size and meta["model_bytes"] != size:
1486
+ ctx_note = "the model file changed since its context was measured; run tuieval tune --ctx again"
1487
+ elif meta.get("kv_type") and kv and meta["kv_type"] != kv:
1488
+ ctx_note = f"its context was measured with {meta['kv_type']} KV, not {kv}; run tuieval tune --ctx again"
1489
+ else:
1490
+ ctx, fits, source = measured["max_ctx"], True, "measured"
1491
+ note = f"measured on {mc.id}: up to {measured['max_ctx'] // 1024}k context"
1492
+ at = measured.get("measured", {})
1493
+ if at.get("base_gb") is not None and at.get("gb_per_1k_tokens") is not None:
1494
+ need = round(at["base_gb"] + at["gb_per_1k_tokens"] * ctx / 1000, 1)
1443
1495
  identity = self._identity(m, server, kv, size)
1444
1496
  if server.get("outputs_depend_on_machine"):
1445
1497
  # Answers depend on the machine and on its memory settings (e.g. which experts stay
1446
1498
  # resident), so both are part of what a result is valid for.
1447
1499
  identity["machine"] = mc.id
1448
1500
  identity["perf"] = perf
1449
- sv = Serving(mc, ctx, kv, fits, note, perf, source, identity, profile, mtp, need)
1501
+ sv = Serving(mc, ctx, kv, fits, note, perf, perf_source, identity, profile, mtp, need,
1502
+ ctx_source=source, ctx_measured=measured, ctx_note=ctx_note)
1450
1503
  self._serving[key] = sv
1451
1504
  return sv
1452
1505
 
@@ -1477,22 +1530,26 @@ class Engine:
1477
1530
  out["agent"] = agents.identity(self.cfg, pack)
1478
1531
  return out
1479
1532
 
1480
- def server_command(self, m, perf_args=None, port=None):
1533
+ def server_command(self, m, perf_args=None, port=None, ctx=None):
1481
1534
  """(cmd or None, cwd, base_url) for a model. cmd is None for an already-running server.
1482
- perf_args replaces the speed flags (the tuner uses this); port overrides the server's."""
1535
+ perf_args replaces the speed flags (the tuner uses this); port overrides the server's; ctx
1536
+ the context (tuieval tune --ctx tries several)."""
1483
1537
  server = self.cfg["servers"][m["server"]]
1484
1538
  if not server.get("cmd"):
1485
1539
  return None, None, server["url"].rstrip("/").removesuffix("/v1")
1486
1540
  sv = self.serving(m)
1487
1541
  port = port or server["port"]
1488
1542
  values = {"model": expand(m["model"]), "served_name": m["served_name"], "port": port,
1489
- "mmproj": expand(m.get("mmproj", "")), "ctx": sv.ctx or "", "kv_type": sv.kv_type or "",
1543
+ "mmproj": expand(m.get("mmproj", "")), "ctx": ctx or sv.ctx or "", "kv_type": sv.kv_type or "",
1490
1544
  "root": self.root, **self.knob_values(sv.machine)}
1491
1545
  cmd = [expand(a, **values) for a in server["cmd"]]
1492
1546
  cmd += [expand(a, **values) for a in (sv.perf_args if perf_args is None else perf_args)]
1493
1547
  if m.get("mmproj"):
1494
1548
  cmd += [expand(a, **values) for a in server.get("vision_args", [])]
1495
1549
  cmd += [expand(a, **values) for a in m.get("server_args", [])]
1550
+ use = ctx or (sv.ctx if sv.ctx_source == "measured" else None)
1551
+ if use and takes_context(server) == "flag":
1552
+ cmd = set_context(cmd, server["ctx_flag"], use)
1496
1553
  cmd, env = split_env(cmd)
1497
1554
  env = [f"{k}={expand(str(v), **values)}" for k, v in server.get("env", {}).items()] + env
1498
1555
  if env: # env(1) keeps the command one copy-pasteable line and one process group
@@ -1970,12 +2027,13 @@ class Engine:
1970
2027
  return free
1971
2028
 
1972
2029
  @contextlib.contextmanager
1973
- def serve(self, m, perf_args=None, port=None, log_name=None):
2030
+ def serve(self, m, perf_args=None, port=None, log_name=None, ctx=None):
1974
2031
  """Start a model's server (or use the running one), wait until it serves the expected name,
1975
- yield (base_url, info), and stop it afterwards. info: load_s, command, alive(), peak_mb()."""
2032
+ yield (base_url, info), and stop it afterwards. info: load_s, command, alive(), peak_mb().
2033
+ ctx: serve with this context instead of the model's usual one."""
1976
2034
  defaults = self.cfg["defaults"]
1977
2035
  server = self.cfg["servers"][m["server"]]
1978
- cmd, cwd, base_url = self.server_command(m, perf_args=perf_args, port=port)
2036
+ cmd, cwd, base_url = self.server_command(m, perf_args=perf_args, port=port, ctx=ctx)
1979
2037
  port = port or server.get("port")
1980
2038
  srv, stop, peak = None, threading.Event(), [0.0]
1981
2039
  info = {"load_s": None, "command": cmd, "alive": lambda: srv is None or srv.poll() is None,
tuieval/machines.py CHANGED
@@ -356,6 +356,39 @@ def swapped_out_bytes():
356
356
  return int(page.group(1)) * int(swaps.group(1)) if page and swaps else None
357
357
 
358
358
 
359
+ def vm_stat_available_gb(text, ram_bytes):
360
+ """Memory available on a Mac from vm_stat's page counts: RAM less what is held and can't be
361
+ given back (anonymous pages, wired pages, the compressor's own pages). File cache and
362
+ memory-mapped files the system can drop count as available. None if the counts aren't there."""
363
+ page = re.search(r"page size of (\d+)", text)
364
+ held = [re.search(name + r":\s+(\d+)", text) for name in
365
+ ("Anonymous pages", "Pages wired down", "Pages occupied by compressor")]
366
+ if not page or not all(held) or not ram_bytes:
367
+ return None
368
+ return (ram_bytes - int(page.group(1)) * sum(int(h.group(1)) for h in held)) / GB
369
+
370
+
371
+ def available_memory_gb():
372
+ """Memory a new process could take now without pushing anything to swap: free plus what the
373
+ system gives back on demand (file cache). macOS: from vm_stat's page counts (`memory_pressure`'s
374
+ free percentage, which is rounded to 1% of RAM and reads higher, only if they are missing);
375
+ Linux: MemAvailable. None where unknown."""
376
+ try:
377
+ if platform.system() == "Darwin":
378
+ ram = int(_sysctl("hw.memsize") or 0)
379
+ got = vm_stat_available_gb(subprocess.run(["vm_stat"], capture_output=True, text=True, timeout=5).stdout, ram)
380
+ if got is not None:
381
+ return got
382
+ out = subprocess.run(["memory_pressure"], capture_output=True, text=True, timeout=10).stdout
383
+ pct = re.search(r"free percentage:\s*(\d+)%", out)
384
+ return int(pct.group(1)) / 100 * ram / GB if pct and ram else None
385
+ with open("/proc/meminfo") as f:
386
+ kb = re.search(r"MemAvailable:\s+(\d+) kB", f.read())
387
+ return int(kb.group(1)) * 1024 / GB if kb else None
388
+ except (OSError, subprocess.TimeoutExpired, ValueError):
389
+ return None
390
+
391
+
359
392
  # ---------------------------------------------------------------- GPU residency
360
393
  # On Apple Silicon Macs, once the system's GPU allocations exceed about half of RAM, the GPU driver evicts and re-maps memory on every command submission (70-95% of the
361
394
  # server's CPU in the kernel, GPU idle), whatever iogpu.wired_limit_mb says. Servers that submit
tuieval/profiles.py CHANGED
@@ -65,6 +65,43 @@ def now():
65
65
  return datetime.datetime.now().isoformat(timespec="seconds")
66
66
 
67
67
 
68
+ # ---------------------------------------------------------------- measured context
69
+ def context_path(machine_id, label, root=None):
70
+ return os.path.join(root or workspace.path("tuning"), machine_id, f"{label}.ctx.toml")
71
+
72
+
73
+ def load_context(machine_id, label, root=None):
74
+ """The largest context measured for a model on a machine (tuieval tune --ctx), or None."""
75
+ p = context_path(machine_id, label, root)
76
+ if not os.path.isfile(p):
77
+ return None
78
+ try:
79
+ with open(p, "rb") as f:
80
+ d = tomllib.load(f)
81
+ except (OSError, tomllib.TOMLDecodeError):
82
+ return None
83
+ ok = isinstance(d.get("max_ctx"), int) and not isinstance(d.get("max_ctx"), bool) and d["max_ctx"] > 0
84
+ return d if ok else None
85
+
86
+
87
+ def save_context(machine_id, label, measured, root=None):
88
+ """Write a measurement: {"max_ctx": n, "measured": {...}, "probes": {...}, "meta": {...}}."""
89
+ p = context_path(machine_id, label, root)
90
+ os.makedirs(os.path.dirname(p), exist_ok=True)
91
+ lines = [f"# Largest context measured for {label} on {machine_id}. Written by tuieval tune --ctx; runs use it",
92
+ "# in place of the estimate. Delete this file to go back to the estimate.",
93
+ f"max_ctx = {int(measured['max_ctx'])}", ""]
94
+ for section in ("measured", "probes", "meta"):
95
+ lines.append(f"[{section}]")
96
+ for k, v in measured.get(section, {}).items():
97
+ if v is not None:
98
+ lines.append(f"{json.dumps(str(k)) if section == 'probes' else k} = {_toml_value(v)}")
99
+ lines.append("")
100
+ with open(p, "w") as f:
101
+ f.write("\n".join(lines))
102
+ return p
103
+
104
+
68
105
  # ---------------------------------------------------------------- known machines
69
106
  def save_machine(machine, root=None):
70
107
  """Record a machine's facts (tuning/<id>/machine.toml) so the others can check fit for it."""
tuieval/remove.py CHANGED
@@ -78,6 +78,9 @@ def plan(eng, label):
78
78
  f = profiles.path(machine, label, eng.tuning_dir)
79
79
  if os.path.isfile(f):
80
80
  p.moves.append((f, os.path.join("tuning", machine, label + ".toml")))
81
+ f = profiles.context_path(machine, label, eng.tuning_dir)
82
+ if os.path.isfile(f):
83
+ p.moves.append((f, os.path.join("tuning", machine, label + ".ctx.toml")))
81
84
  with open(eng.models_path) as f:
82
85
  old = f.read()
83
86
  new = without_block(old, label)
tuieval/run_evals.py CHANGED
@@ -616,21 +616,47 @@ def cmd_machines(argv):
616
616
  f"~{e.gpu_residency_gb(mc):.0f} GB resident{RESET}")
617
617
  for m in e.cfg["models"]:
618
618
  sv = e.serving(m, mc)
619
- if sv.perf_source == "n/a":
619
+ if sv.perf_source == "n/a" and sv.ctx_source != "measured":
620
620
  print(f" {m['label']:24s} {DIM}{m['server']} picks its own context and speed settings{RESET}")
621
+ if sv.ctx_note:
622
+ print(f" {'':24s} {DIM}{sv.ctx_note}{RESET}")
621
623
  continue
622
624
  fit = f"{RED}doesn't fit{RESET}" if not sv.fits else (f"ctx {sv.ctx // 1024}k" if sv.ctx else "ctx default")
623
- src = {"tuned": GREEN + "tuned" + RESET, "seeded": "seeded (hand-tuned flags)"}.get(
624
- sv.perf_source, f"{DIM}{sv.perf_source}{RESET}")
625
+ if sv.fits and sv.ctx_source == "measured":
626
+ fit += " measured"
627
+ src = {"tuned": GREEN + "tuned" + RESET, "seeded": "seeded (hand-tuned flags)",
628
+ "n/a": f"{DIM}no speed flags to tune{RESET}"}.get(sv.perf_source, f"{DIM}{sv.perf_source}{RESET}")
625
629
  speed = (sv.profile or {}).get("measured", {})
626
630
  sp = f" gen {speed['tg_tps']} tok/s, prompt {speed['pp_tps']} tok/s" if speed.get("tg_tps") else ""
627
631
  print(f" {m['label']:24s} {fit:12s} {src}{sp}")
628
632
  if not sv.fits:
629
633
  print(f" {'':24s} {DIM}{sv.fit_note}{RESET}")
634
+ if sv.ctx_note:
635
+ print(f" {'':24s} {DIM}{sv.ctx_note}{RESET}")
630
636
  print(f"\n{DIM}Machines appear here after tuieval has run on them once (tuning/<id>/machine.toml; sync the"
631
637
  f" workspace to share it). Set EVALS_MACHINE to rename this one.{RESET}")
632
638
 
633
639
 
640
+ def context_report(e, label, got):
641
+ """Print what tuieval tune --ctx found for a model. False if a declared context didn't hold."""
642
+ if "verified" in got:
643
+ if got["verified"]:
644
+ say(f"{label}: the {got['ctx']:,} context it declares works ({got['probe'].summary()})", GREEN)
645
+ else:
646
+ say(f"{label}: the {got['ctx']:,} context it declares doesn't work: {got['probe'].error}", RED)
647
+ return got["verified"]
648
+ at, sv = got["measured"], e.serving(e.model(label))
649
+ mem = f", {at['memory_gb']:.1f} GB with it full" if at.get("memory_gb") else ""
650
+ per = f", {at['gb_per_1k_tokens']} GB per 1,000 tokens" if at.get("gb_per_1k_tokens") else ""
651
+ say(f"{label}: largest context {got['max_ctx']:,}{mem}{per}", GREEN)
652
+ say(f"{label}: stopped there because: {at['stopped']}")
653
+ if not got["meta"].get("fill_confirmed"):
654
+ say(f"{label}: the server reports no token counts, so how full the context was isn't confirmed", YELLOW)
655
+ if sv.ctx_source == "measured":
656
+ say(f"{label}: runs use {sv.ctx:,} from now on, whatever models.toml caps it at")
657
+ return True
658
+
659
+
634
660
  class TunePrinter:
635
661
  """Everything the tuner does, as it happens: server start and its log, each request's
636
662
  progress, each candidate's result."""
@@ -665,17 +691,29 @@ def cmd_tune(argv):
665
691
  "same architecture is already tuned here (its flags are the starting point).")
666
692
  p.add_argument("labels", nargs="*", help="models to tune")
667
693
  p.add_argument("--untuned", action="store_true", help="every local model without a current profile here")
668
- p.add_argument("--max-starts", type=int, default=16, help="server starts per model (default 16)")
694
+ p.add_argument("--max-starts", type=int, default=None, help="server starts per model (default 16; 8 with --ctx)")
669
695
  p.add_argument("--no-bench", action="store_true", help="skip llama-bench even if it is installed")
670
696
  p.add_argument("--export-pi", action="store_true",
671
697
  help="after tuning, export each model's serving settings to the pi coding agent (asks first)")
672
698
  p.add_argument("--cold", action="store_true",
673
699
  help="tune every knob from the defaults, even if a model of the same architecture is tuned here")
700
+ p.add_argument("--ctx", action="store_true",
701
+ help="instead of speed flags, measure the largest context each model can be served with on this "
702
+ "machine (ctxbench.py): a few server starts, each filling the context it tries. Runs then "
703
+ "use it in place of the estimate")
704
+ p.add_argument("--max", type=int, default=None, metavar="N",
705
+ help="with --ctx: the largest context to try (default: the model's own limit)")
706
+ p.add_argument("--start", type=int, default=None, metavar="N",
707
+ help="with --ctx: the first context to try (default: half of what the model runs with now)")
708
+ p.add_argument("--step", type=int, default=None, metavar="N",
709
+ help="with --ctx: how close to the true maximum to get (default 8192)")
674
710
  p.add_argument("--models", default=None, help="default: the workspace's models.toml")
675
711
  a = p.parse_args(argv)
676
- from . import tune
712
+ from . import ctxbench, tune
677
713
  e = engine.Engine(TunePrinter(), models_path=a.models)
678
714
  labels = a.labels
715
+ if a.ctx and a.untuned:
716
+ sys.exit("--ctx needs the models named")
679
717
  if a.untuned:
680
718
  labels += [m["label"] for m in e.cfg["models"] if m["label"] not in labels
681
719
  and e.cfg["servers"][m["server"]].get("cmd") and e.serving(m).perf_source not in ("tuned",)]
@@ -683,10 +721,10 @@ def cmd_tune(argv):
683
721
  if bad or not labels:
684
722
  sys.exit(f"unknown model(s) {bad}; see tuieval list" if bad else "name models to tune, or --untuned")
685
723
  signal.signal(signal.SIGINT, lambda *_: (say("stopping…", RED), e.cancel()))
686
- say(f"tuning on {e.machine().id}: {e.machine().summary}")
724
+ say(f"{'measuring context' if a.ctx else 'tuning'} on {e.machine().id}: {e.machine().summary}")
687
725
  failed = 0
688
726
  try:
689
- lock = e.machine_lock(f"tune: {', '.join(labels)}")
727
+ lock = e.machine_lock(f"{'context' if a.ctx else 'tune'}: {', '.join(labels)}")
690
728
  lock.__enter__() # held until this process exits
691
729
  except engine.Cancelled:
692
730
  sys.exit(1)
@@ -696,7 +734,12 @@ def cmd_tune(argv):
696
734
 
697
735
  def work(label=label, result=result):
698
736
  try:
699
- result["profile"] = tune.tune(e, label, e.on_event, max_starts=a.max_starts, use_bench=not a.no_bench,
737
+ if a.ctx:
738
+ result["context"] = ctxbench.bench(
739
+ e, label, e.on_event, max_ctx=a.max, start=a.start, step=a.step or ctxbench.STEP,
740
+ max_starts=a.max_starts or ctxbench.MAX_STARTS)
741
+ return
742
+ result["profile"] = tune.tune(e, label, e.on_event, max_starts=a.max_starts or 16, use_bench=not a.no_bench,
700
743
  warm=not a.cold)
701
744
  except (engine.ModelFailed, engine.Cancelled) as ex:
702
745
  result["error"] = str(ex) or "cancelled"
@@ -706,10 +749,13 @@ def cmd_tune(argv):
706
749
  t.join(0.5)
707
750
  if "error" in result:
708
751
  failed += 1
709
- say(f"{label}: not tuned: {result['error']}", RED)
752
+ say(f"{label}: not {'measured' if a.ctx else 'tuned'}: {result['error']}", RED)
710
753
  if e._cancel.is_set():
711
754
  break
712
755
  continue
756
+ if a.ctx:
757
+ failed += not context_report(e, label, result["context"])
758
+ continue
713
759
  pr = result["profile"]
714
760
  ms = pr["measured"]
715
761
  gain = ", " + tune.gain_text(ms) if tune.gain_text(ms) else ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tuieval
3
- Version: 0.2.0.dev147
3
+ Version: 0.2.0.dev152
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
@@ -173,6 +173,7 @@ tuieval regrade # re-score stored answers after ch
173
173
  tuieval regrade --only <model> --packs X # just one model's results (and packs)
174
174
  tuieval machines # this machine and others, fit and tuning per model
175
175
  tuieval tune <model> # fastest speed flags for a model on this machine
176
+ tuieval tune <model> --ctx # largest context it can be served with on this machine, measured
176
177
  tuieval export pi <model> # serve it in the pi coding agent with those flags
177
178
  tuieval watch --upstream http://localhost:8080 # show the reasoning of any app using your server
178
179
  tuieval help
@@ -1,24 +1,25 @@
1
1
  tuieval/__init__.py,sha256=myVXVX7htbwezW6k3x_FuKgn1RSZ2WcTaDEMByGn6Wg,312
2
2
  tuieval/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
3
- tuieval/_version.py,sha256=pGsHeZhHmx4lJ9rUAnveYCQ8EbSPgXujZj90cJfNO5Q,537
3
+ tuieval/_version.py,sha256=SBk0ZLvvAsL0b3FMt7eym0iNTparGaT68nwzhJvZqA4,537
4
4
  tuieval/agents.py,sha256=XmY4d4PAnC7BQcs_6KO9WTuIdpnwYVAdyhqItybWdAM,15408
5
5
  tuieval/builtin.toml,sha256=QLQP1nh577RW6x0Z38JKNES-MPTSmlZAcxD5Javbk4Q,4768
6
- tuieval/cli.py,sha256=mr0o_ud6NctZeU4WIrh17x_uzEK0vTeCynGP0wrCeBY,4812
6
+ tuieval/cli.py,sha256=Q9-b9sg6LSAfNq6o-c3J3hiOIoINgvH_Fe_U1x-0W4U,4915
7
7
  tuieval/client.py,sha256=O77uftaxqgQ8b8rMnpR5822kmYFfr574w1pZlaSOFEE,14304
8
8
  tuieval/compare.py,sha256=T5MDIkNzPGTFUvYr1EzxVGGlCdvTlO1v5De3gN0Eocw,39654
9
+ tuieval/ctxbench.py,sha256=5JKm6QOpHN2hK3bmexC6aqyEBunOzw-hyI95msMS_yg,21634
9
10
  tuieval/dates.py,sha256=CVazlwNjCRhD__D12zXLdeqF2ySt15X3xLUQeE-o6PY,6293
10
11
  tuieval/doctor.py,sha256=j2MdDORstsAGPnRmpsnxau1_fR6sTc_oEFGM5zugTJU,7246
11
- tuieval/engine.py,sha256=AaYJvMQxqUjoMoJaIsq4D6rcVuQMn2N2Lh1IA25p-UU,138227
12
+ tuieval/engine.py,sha256=OfAQx4s9A7PfaPJDr5U_MBp69kS3-tI99aPnrCYZ8mU,141469
12
13
  tuieval/export.py,sha256=dbHQgL_ubWtIPM1sLzAew_gETnrDJyd0zgqVA5vkpXM,9657
13
14
  tuieval/insights.py,sha256=hIJp1n0eZeoo9QCyS5-OChv70ItSqV8jSsInoh4Stm0,29591
14
15
  tuieval/logs.py,sha256=01gZK6tf53dIThaIrs1bEsz9eqKYVlcxpyaLnSPTVxo,8127
15
- tuieval/machines.py,sha256=t9tu6CZeXZON4EtOVnEwP4VtaynpVLf9Cz8TNjf7jtY,20124
16
+ tuieval/machines.py,sha256=KEZ7tJWdGdlIjNDfd8sgXMyV-GclcdQLoubNimz5tbs,21956
16
17
  tuieval/onboard.py,sha256=IYETVDWCCo9vF0Dtj4_rr9VanYeCky8PwP3-2g5A_l0,6215
17
18
  tuieval/packs.py,sha256=KOj0BkwsB2124aslGyauZonyyGqtSrCJ-WAozEntmqE,17466
18
- tuieval/profiles.py,sha256=soeLxjdB-l-OxSY8jZ4yjwfdSnsBV-QICcwKxRJS7nQ,3663
19
+ tuieval/profiles.py,sha256=3GribubCOCRTi_rClLxVynBeX2SBYTig0XObAlS8lzg,5300
19
20
  tuieval/pta.py,sha256=MBn2EkDysayv8XOqiTKp5zomuUmZnZTuQ5jGBR2-Z4s,19281
20
- tuieval/remove.py,sha256=Vwh43nm9lVb9U9aN-h6CMYbkTwdR3UWfZObwweF72n0,5157
21
- tuieval/run_evals.py,sha256=7KegJ06WpEoH1XPFMbS84sqYXN6GMF5aDK8SkB3L_w8,53169
21
+ tuieval/remove.py,sha256=ckep4iZUkuWE2JTcZFovCy7snNd_WLkJ6b602eGKZws,5339
22
+ tuieval/run_evals.py,sha256=kLnQDZB_XoqdBFDk3paPYGvl0u_IXfSDuZS0Sp69Rgc,56095
22
23
  tuieval/scaffold.py,sha256=YBOqniJpf_GtKKAFF3_OHxxMGbmTWdFjcClGcOnrrKE,12130
23
24
  tuieval/selftest.py,sha256=cIGSDCrCK-QISAXjKSJDB4sD-WwS32bn3Gn4Y0oGoF8,11502
24
25
  tuieval/tui.py,sha256=5BtqHoEtqBHRCrh0qPn2Vmg-4hSjjtlfPQ5qoysHlb0,211349
@@ -50,8 +51,8 @@ tuieval/templates/packs/tool_call/pack.toml,sha256=n4bx0lGJHSmW41uVqhfIXJ2BWZpmT
50
51
  tuieval/templates/packs/tool_call/system.txt,sha256=mKxu-lB-0YjLHXdgeFJa8x2C180OvcNz5cHv2N5Bg3U,254
51
52
  tuieval/templates/packs/tool_call/tests.yaml,sha256=Nv7c4syrzJ9cU8EBKSK_1ZSFx9V02aCjW4-2TBCPT7s,1859
52
53
  tuieval/templates/packs/tool_call/tools.yaml,sha256=HgxCkh0On2VwbHSsjAGM8tNCK7ZtKLGrs7lMCn3Fprs,1048
53
- tuieval-0.2.0.dev147.dist-info/METADATA,sha256=ZvyjlHNJ4-jA--ciWK70YtuuG9IoLvT1Drs-KZSTPU4,15194
54
- tuieval-0.2.0.dev147.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
55
- tuieval-0.2.0.dev147.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
56
- tuieval-0.2.0.dev147.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
57
- tuieval-0.2.0.dev147.dist-info/RECORD,,
54
+ tuieval-0.2.0.dev152.dist-info/METADATA,sha256=3D1IrWsNYPAEKTdD9PbTs1vFgPGIhvrGGIzD1YyxoSU,15306
55
+ tuieval-0.2.0.dev152.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
56
+ tuieval-0.2.0.dev152.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
57
+ tuieval-0.2.0.dev152.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
58
+ tuieval-0.2.0.dev152.dist-info/RECORD,,