tuieval 0.2.0.dev154__py3-none-any.whl → 0.2.0.dev158__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 +2 -2
- tuieval/ctxbench.py +46 -13
- tuieval/run_evals.py +3 -0
- {tuieval-0.2.0.dev154.dist-info → tuieval-0.2.0.dev158.dist-info}/METADATA +1 -1
- {tuieval-0.2.0.dev154.dist-info → tuieval-0.2.0.dev158.dist-info}/RECORD +8 -8
- {tuieval-0.2.0.dev154.dist-info → tuieval-0.2.0.dev158.dist-info}/WHEEL +0 -0
- {tuieval-0.2.0.dev154.dist-info → tuieval-0.2.0.dev158.dist-info}/entry_points.txt +0 -0
- {tuieval-0.2.0.dev154.dist-info → tuieval-0.2.0.dev158.dist-info}/licenses/LICENSE +0 -0
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.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2, 0, '
|
|
21
|
+
__version__ = version = '0.2.0.dev158'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 0, 'dev158')
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
tuieval/ctxbench.py
CHANGED
|
@@ -22,7 +22,9 @@ the measurement replaces those. Memory grows about linearly with the context, so
|
|
|
22
22
|
passed predict the largest context that fits under the machine's limit; no probe goes above that
|
|
23
23
|
prediction, and a failed probe is bisected against the largest that passed. A probe is stopped at
|
|
24
24
|
once, while the server loads or works, when memory pressure rises, the machine starts swapping,
|
|
25
|
-
or memory runs out.
|
|
25
|
+
or memory runs out. (A server that reaches the warning level at the smallest context, with nothing
|
|
26
|
+
swapped, fills memory to a budget of its own: for it only critical pressure counts, besides
|
|
27
|
+
swapping and memory running out.) The next probe waits until the machine has recovered (pressure back to normal,
|
|
26
28
|
the memory given back), so one probe's pressure can't fail the next. Typically 3 to 5 server starts.
|
|
27
29
|
|
|
28
30
|
Memory is read off the machine, not the server's processes: available memory before the server
|
|
@@ -52,6 +54,7 @@ APART = 0.8 # memory per token is read off two probes at least th
|
|
|
52
54
|
MAX_STARTS = 8
|
|
53
55
|
REQUEST_LIMIT_S = 3600 # reading a few hundred thousand tokens takes a while ([tune] ctx_request_timeout_s)
|
|
54
56
|
PRESSURE_WARNING = 2 # macOS memory pressure level that stops a probe (1 is normal)
|
|
57
|
+
PRESSURE_CRITICAL = 4 # the level that stops one for a server whose normal state is the warning level
|
|
55
58
|
SWAP_STOP_MB = 512 # swapped out while a probe ran: stop it
|
|
56
59
|
AVAILABLE_STOP_GB = 1.0 # memory available under this stops a probe
|
|
57
60
|
SETTLE_S = 120 # how long the machine may take to recover after a probe before the next one
|
|
@@ -79,6 +82,8 @@ class Probe:
|
|
|
79
82
|
total_s: float | None = None
|
|
80
83
|
load_s: float | None = None
|
|
81
84
|
filled: bool = False # the server's token count confirms the context was full
|
|
85
|
+
pressure: int | None = None # highest macOS memory pressure level while it ran
|
|
86
|
+
stopped_for: str = "" # "pressure" when memory pressure alone stopped it (nothing was swapped)
|
|
82
87
|
|
|
83
88
|
def summary(self):
|
|
84
89
|
if not self.ok:
|
|
@@ -139,8 +144,9 @@ class Guard:
|
|
|
139
144
|
"""Watches the machine while a probe's server loads and works. When it gets unhealthy, the
|
|
140
145
|
server is stopped: a load is abandoned and a request is cut off."""
|
|
141
146
|
|
|
142
|
-
def __init__(self, eng, every_s=2.0):
|
|
143
|
-
self.eng, self.every_s, self.reason = eng, every_s, ""
|
|
147
|
+
def __init__(self, eng, every_s=2.0, stop_level=PRESSURE_WARNING):
|
|
148
|
+
self.eng, self.every_s, self.reason, self.stop_level = eng, every_s, "", stop_level
|
|
149
|
+
self.pressure_only = False # stopped for memory pressure, with nothing swapped out
|
|
144
150
|
self.pressure, self._stop = machines.memory_pressure_level(), threading.Event()
|
|
145
151
|
self._swap0 = machines.swapped_out_bytes()
|
|
146
152
|
self._own_memory = eng.machine().discrete # VRAM: the machine's memory isn't what runs out
|
|
@@ -155,7 +161,9 @@ class Guard:
|
|
|
155
161
|
lvl = machines.memory_pressure_level()
|
|
156
162
|
if lvl is not None:
|
|
157
163
|
self.pressure = max(self.pressure or 0, lvl)
|
|
158
|
-
if lvl >=
|
|
164
|
+
if lvl >= self.stop_level:
|
|
165
|
+
swap = machines.swapped_out_bytes()
|
|
166
|
+
self.pressure_only = None in (swap, self._swap0) or swap - self._swap0 < 2**20
|
|
159
167
|
return f"macOS memory pressure rose to level {lvl}"
|
|
160
168
|
swap = machines.swapped_out_bytes()
|
|
161
169
|
if None not in (swap, self._swap0) and (swap - self._swap0) / 2**20 > SWAP_STOP_MB:
|
|
@@ -191,8 +199,9 @@ class Guard:
|
|
|
191
199
|
self.eng._stall = None
|
|
192
200
|
|
|
193
201
|
|
|
194
|
-
def probe(eng, m, ctx, emit=lambda *a, **k: None, limit=REQUEST_LIMIT_S):
|
|
195
|
-
"""Serve the model with this context, fill it and ask for the fact. Returns a Probe.
|
|
202
|
+
def probe(eng, m, ctx, emit=lambda *a, **k: None, limit=REQUEST_LIMIT_S, stop_level=PRESSURE_WARNING):
|
|
203
|
+
"""Serve the model with this context, fill it and ask for the fact. Returns a Probe.
|
|
204
|
+
stop_level: the macOS memory pressure level that stops it."""
|
|
196
205
|
from . import client
|
|
197
206
|
out = Probe(ctx)
|
|
198
207
|
reserve = ANSWER_TOKENS + max(256, ctx // 50)
|
|
@@ -200,7 +209,7 @@ def probe(eng, m, ctx, emit=lambda *a, **k: None, limit=REQUEST_LIMIT_S):
|
|
|
200
209
|
if target < 1024:
|
|
201
210
|
out.error = f"a context of {ctx:,} is too small to test"
|
|
202
211
|
return out
|
|
203
|
-
guard = Guard(eng)
|
|
212
|
+
guard = Guard(eng, stop_level=stop_level)
|
|
204
213
|
try:
|
|
205
214
|
with guard, eng.serve(m, log_name=f"{m['label']}.ctx", ctx=ctx) as (url, info):
|
|
206
215
|
out.load_s = round(info["load_s"], 1) if info.get("load_s") else None
|
|
@@ -215,8 +224,8 @@ def probe(eng, m, ctx, emit=lambda *a, **k: None, limit=REQUEST_LIMIT_S):
|
|
|
215
224
|
met = client.metrics(res) if not res.get("error") else {}
|
|
216
225
|
out.prompt_tokens, out.pp_tps, out.tg_tps = met.get("prompt_tokens"), met.get("prompt_tps"), met.get("gen_tps")
|
|
217
226
|
out.total_s = round(res["total_s"], 1) if res.get("total_s") else None
|
|
218
|
-
guard.check()
|
|
219
|
-
out.mem_gb = memory_gb(eng, m, info, guard)
|
|
227
|
+
guard.reason = guard.reason or guard.check() # with the server still up: a short probe may end
|
|
228
|
+
out.mem_gb = memory_gb(eng, m, info, guard) # between the guard's own readings
|
|
220
229
|
text = (res.get("answer") or "") + (res.get("reasoning") or "")
|
|
221
230
|
if res.get("error"):
|
|
222
231
|
out.error = res["error"]
|
|
@@ -234,8 +243,10 @@ def probe(eng, m, ctx, emit=lambda *a, **k: None, limit=REQUEST_LIMIT_S):
|
|
|
234
243
|
out.error = str(e).splitlines()[0]
|
|
235
244
|
if not guard.reason and any(w in out.error for w in NOT_ABOUT_CONTEXT):
|
|
236
245
|
raise # a smaller context wouldn't help
|
|
246
|
+
out.pressure = guard.pressure
|
|
237
247
|
if guard.reason: # the machine got unhealthy: that is why, whatever the server said as it was stopped
|
|
238
248
|
out.ok, out.error = False, guard.reason
|
|
249
|
+
out.stopped_for = "pressure" if guard.pressure_only else ""
|
|
239
250
|
return out
|
|
240
251
|
|
|
241
252
|
|
|
@@ -424,10 +435,16 @@ def bench(eng, label, emit=lambda *a, **k: None, max_ctx=None, start=None, step=
|
|
|
424
435
|
room, refuse = room_gb(eng)
|
|
425
436
|
if refuse:
|
|
426
437
|
raise engine_mod.ModelFailed(refuse)
|
|
427
|
-
|
|
428
|
-
|
|
438
|
+
# A model that could be held in memory whole needs that much free before the first load (another
|
|
439
|
+
# model may be loaded). One larger than the machine's memory can't be: its server reads it from
|
|
440
|
+
# disk as needed, so its size says nothing about what it takes, and the probes' guard decides.
|
|
441
|
+
size, whole = model_gb(m), sv.machine.gpu_limit_gb if sv.machine.discrete else sv.machine.ram_gb
|
|
442
|
+
if room is not None and size is not None and room < size <= whole:
|
|
429
443
|
raise engine_mod.ModelFailed(f"the model is {size:.1f} GB and {room:.1f} GB is free for it now: another "
|
|
430
444
|
"model or app is holding memory")
|
|
445
|
+
if size is not None and size > whole:
|
|
446
|
+
emit("tune_step", message=f"the model is {size:.0f} GB on disk, more than this machine's memory: its server "
|
|
447
|
+
"reads it from disk as needed, so its size isn't checked against free memory")
|
|
431
448
|
# Half of what it runs with now, so the second probe is a context expected to work and the two
|
|
432
449
|
# give the memory per token before anything larger is tried.
|
|
433
450
|
usual = sv.ctx if sv.fits and sv.ctx else None
|
|
@@ -437,10 +454,24 @@ def bench(eng, label, emit=lambda *a, **k: None, max_ctx=None, start=None, step=
|
|
|
437
454
|
|
|
438
455
|
baseline = None if sv.machine.discrete else machines.available_memory_gb()
|
|
439
456
|
|
|
457
|
+
rule = {"level": PRESSURE_WARNING, "passed": False}
|
|
458
|
+
|
|
440
459
|
def try_ctx(ctx):
|
|
441
460
|
eng._check()
|
|
442
461
|
settle(eng, baseline, emit)
|
|
443
|
-
|
|
462
|
+
r = probe(eng, m, ctx, emit, limit_s, rule["level"])
|
|
463
|
+
if r.stopped_for == "pressure" and not rule["passed"] and rule["level"] < PRESSURE_CRITICAL:
|
|
464
|
+
# Before anything has passed, at the smallest contexts: this isn't the context being too
|
|
465
|
+
# large. The server fills memory to a budget of its own and runs at the warning level.
|
|
466
|
+
rule["level"] = PRESSURE_CRITICAL
|
|
467
|
+
emit("tune_result", message=" " + r.summary())
|
|
468
|
+
emit("tune_step", message=f" memory pressure reaches the warning level at {ctx:,} already, with nothing "
|
|
469
|
+
"swapped: that is how this server runs. From here a try is stopped for swapping, "
|
|
470
|
+
"memory running out or critical pressure only; trying this context again")
|
|
471
|
+
settle(eng, baseline, emit)
|
|
472
|
+
r = probe(eng, m, ctx, emit, limit_s, rule["level"])
|
|
473
|
+
rule["passed"] = rule["passed"] or r.ok
|
|
474
|
+
return r
|
|
444
475
|
|
|
445
476
|
tried, why = search(try_ctx, first, upper, room, step, min(FLOOR, first), max_starts, emit)
|
|
446
477
|
passed = [p for p in tried if p.ok]
|
|
@@ -459,7 +490,9 @@ def bench(eng, label, emit=lambda *a, **k: None, max_ctx=None, start=None, step=
|
|
|
459
490
|
"meta": {"date": profiles.now(), "machine": sv.machine.summary, "server_version": eng.server_version(m),
|
|
460
491
|
"model_file": os.path.basename(str(m.get("model", ""))), "model_bytes": sv.identity.get("model_bytes"),
|
|
461
492
|
"kv_type": sv.kv_type, "upper_bound": upper, "upper_bound_from": source,
|
|
462
|
-
"fill_confirmed": best.filled, "server_starts": len(tried)
|
|
493
|
+
"fill_confirmed": best.filled, "server_starts": len(tried),
|
|
494
|
+
"stops_at_pressure": "critical" if rule["level"] >= PRESSURE_CRITICAL else "warning",
|
|
495
|
+
"pressure_seen": max((p.pressure or 0 for p in passed), default=0) or None},
|
|
463
496
|
}
|
|
464
497
|
path = profiles.save_context(sv.machine.id, label, measured, eng.tuning_dir)
|
|
465
498
|
eng._serving.clear()
|
tuieval/run_evals.py
CHANGED
|
@@ -650,6 +650,9 @@ def context_report(e, label, got):
|
|
|
650
650
|
per = f", {at['gb_per_1k_tokens']} GB per 1,000 tokens" if at.get("gb_per_1k_tokens") else ""
|
|
651
651
|
say(f"{label}: largest context {got['max_ctx']:,}{mem}{per}", GREEN)
|
|
652
652
|
say(f"{label}: stopped there because: {at['stopped']}")
|
|
653
|
+
if got["meta"].get("stops_at_pressure") == "critical":
|
|
654
|
+
say(f"{label}: this server runs with memory pressure at the warning level, so tries were judged by swapping, "
|
|
655
|
+
"memory running out and critical pressure", YELLOW)
|
|
653
656
|
if not got["meta"].get("fill_confirmed"):
|
|
654
657
|
say(f"{label}: the server reports no token counts, so how full the context was isn't confirmed", YELLOW)
|
|
655
658
|
if sv.ctx_source == "measured":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: tuieval
|
|
3
|
-
Version: 0.2.0.
|
|
3
|
+
Version: 0.2.0.dev158
|
|
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,12 +1,12 @@
|
|
|
1
1
|
tuieval/__init__.py,sha256=myVXVX7htbwezW6k3x_FuKgn1RSZ2WcTaDEMByGn6Wg,312
|
|
2
2
|
tuieval/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
|
|
3
|
-
tuieval/_version.py,sha256=
|
|
3
|
+
tuieval/_version.py,sha256=fDKT-fqtUr9K6z3Mb0pFLVcYHLCx_zjwXd_-sC7Qd0Q,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=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=
|
|
9
|
+
tuieval/ctxbench.py,sha256=li2l_eAS-63Sj4Qq6htLgdGnRSqeyxAg1LU1Za-Z5ms,26903
|
|
10
10
|
tuieval/dates.py,sha256=CVazlwNjCRhD__D12zXLdeqF2ySt15X3xLUQeE-o6PY,6293
|
|
11
11
|
tuieval/doctor.py,sha256=j2MdDORstsAGPnRmpsnxau1_fR6sTc_oEFGM5zugTJU,7246
|
|
12
12
|
tuieval/engine.py,sha256=OfAQx4s9A7PfaPJDr5U_MBp69kS3-tI99aPnrCYZ8mU,141469
|
|
@@ -19,7 +19,7 @@ tuieval/packs.py,sha256=KOj0BkwsB2124aslGyauZonyyGqtSrCJ-WAozEntmqE,17466
|
|
|
19
19
|
tuieval/profiles.py,sha256=3GribubCOCRTi_rClLxVynBeX2SBYTig0XObAlS8lzg,5300
|
|
20
20
|
tuieval/pta.py,sha256=MBn2EkDysayv8XOqiTKp5zomuUmZnZTuQ5jGBR2-Z4s,19281
|
|
21
21
|
tuieval/remove.py,sha256=ckep4iZUkuWE2JTcZFovCy7snNd_WLkJ6b602eGKZws,5339
|
|
22
|
-
tuieval/run_evals.py,sha256=
|
|
22
|
+
tuieval/run_evals.py,sha256=OwS4HGkCOlU0cGcToqJKxFpL8GQdMFW5PB6SitSAfrE,56337
|
|
23
23
|
tuieval/scaffold.py,sha256=YBOqniJpf_GtKKAFF3_OHxxMGbmTWdFjcClGcOnrrKE,12130
|
|
24
24
|
tuieval/selftest.py,sha256=cIGSDCrCK-QISAXjKSJDB4sD-WwS32bn3Gn4Y0oGoF8,11502
|
|
25
25
|
tuieval/tui.py,sha256=5BtqHoEtqBHRCrh0qPn2Vmg-4hSjjtlfPQ5qoysHlb0,211349
|
|
@@ -51,8 +51,8 @@ tuieval/templates/packs/tool_call/pack.toml,sha256=n4bx0lGJHSmW41uVqhfIXJ2BWZpmT
|
|
|
51
51
|
tuieval/templates/packs/tool_call/system.txt,sha256=mKxu-lB-0YjLHXdgeFJa8x2C180OvcNz5cHv2N5Bg3U,254
|
|
52
52
|
tuieval/templates/packs/tool_call/tests.yaml,sha256=Nv7c4syrzJ9cU8EBKSK_1ZSFx9V02aCjW4-2TBCPT7s,1859
|
|
53
53
|
tuieval/templates/packs/tool_call/tools.yaml,sha256=HgxCkh0On2VwbHSsjAGM8tNCK7ZtKLGrs7lMCn3Fprs,1048
|
|
54
|
-
tuieval-0.2.0.
|
|
55
|
-
tuieval-0.2.0.
|
|
56
|
-
tuieval-0.2.0.
|
|
57
|
-
tuieval-0.2.0.
|
|
58
|
-
tuieval-0.2.0.
|
|
54
|
+
tuieval-0.2.0.dev158.dist-info/METADATA,sha256=2W7y-2ulqEgP62OuDUuVeXE9ffTDHn2mBbHAYeTXL_M,15306
|
|
55
|
+
tuieval-0.2.0.dev158.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
56
|
+
tuieval-0.2.0.dev158.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
|
|
57
|
+
tuieval-0.2.0.dev158.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
|
|
58
|
+
tuieval-0.2.0.dev158.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|