tuieval 0.2.0.dev152__py3-none-any.whl → 0.2.0.dev156__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 +54 -4
- {tuieval-0.2.0.dev152.dist-info → tuieval-0.2.0.dev156.dist-info}/METADATA +1 -1
- {tuieval-0.2.0.dev152.dist-info → tuieval-0.2.0.dev156.dist-info}/RECORD +7 -7
- {tuieval-0.2.0.dev152.dist-info → tuieval-0.2.0.dev156.dist-info}/WHEEL +0 -0
- {tuieval-0.2.0.dev152.dist-info → tuieval-0.2.0.dev156.dist-info}/entry_points.txt +0 -0
- {tuieval-0.2.0.dev152.dist-info → tuieval-0.2.0.dev156.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.dev156'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 0, 'dev156')
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
tuieval/ctxbench.py
CHANGED
|
@@ -22,7 +22,8 @@ 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. The next probe waits until the machine has recovered (pressure back to normal,
|
|
26
|
+
the memory given back), so one probe's pressure can't fail the next. Typically 3 to 5 server starts.
|
|
26
27
|
|
|
27
28
|
Memory is read off the machine, not the server's processes: available memory before the server
|
|
28
29
|
starts less the lowest it falls to. Resident memory would count files a server maps and reads on
|
|
@@ -35,6 +36,7 @@ model declares (max_context): one probe, nothing saved.
|
|
|
35
36
|
import dataclasses
|
|
36
37
|
import os
|
|
37
38
|
import threading
|
|
39
|
+
import time
|
|
38
40
|
|
|
39
41
|
from . import engine as engine_mod
|
|
40
42
|
from . import machines
|
|
@@ -52,6 +54,9 @@ REQUEST_LIMIT_S = 3600 # reading a few hundred thousand tokens takes a while
|
|
|
52
54
|
PRESSURE_WARNING = 2 # macOS memory pressure level that stops a probe (1 is normal)
|
|
53
55
|
SWAP_STOP_MB = 512 # swapped out while a probe ran: stop it
|
|
54
56
|
AVAILABLE_STOP_GB = 1.0 # memory available under this stops a probe
|
|
57
|
+
SETTLE_S = 120 # how long the machine may take to recover after a probe before the next one
|
|
58
|
+
SETTLE_POLL_S = 1.0
|
|
59
|
+
SETTLE_GB = 2.0 # recovered: available memory back within this of what it was before the first probe
|
|
55
60
|
TOO_LITTLE = 0.5 # a reading under this share of the model's size on disk can't be right for a server
|
|
56
61
|
# that holds the model in memory: its resident memory is used instead
|
|
57
62
|
SAMPLE_CHARS = 12000 # the request that measures the server's characters per token
|
|
@@ -234,6 +239,37 @@ def probe(eng, m, ctx, emit=lambda *a, **k: None, limit=REQUEST_LIMIT_S):
|
|
|
234
239
|
return out
|
|
235
240
|
|
|
236
241
|
|
|
242
|
+
class Halt(Exception):
|
|
243
|
+
"""The search can't go on (the machine didn't recover); what passed so far stands."""
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def settle(eng, baseline_gb=None, emit=lambda *a, **k: None, limit_s=None):
|
|
247
|
+
"""Wait until the machine has recovered from the last probe: memory pressure back to normal,
|
|
248
|
+
and the memory its server held given back. Without this, pressure a stopped server left behind
|
|
249
|
+
would fail the next probe within seconds, at a context that may well work. Raises Halt if
|
|
250
|
+
pressure stays elevated; memory that stays taken (another app grew) is only noted."""
|
|
251
|
+
limit_s = SETTLE_S if limit_s is None else limit_s
|
|
252
|
+
end, told = time.time() + limit_s, False
|
|
253
|
+
while True:
|
|
254
|
+
eng._check()
|
|
255
|
+
level = machines.memory_pressure_level()
|
|
256
|
+
free = None if baseline_gb is None or eng.machine().discrete else machines.available_memory_gb()
|
|
257
|
+
calm = level is None or level < PRESSURE_WARNING
|
|
258
|
+
back = free is None or free >= baseline_gb - SETTLE_GB
|
|
259
|
+
if calm and back:
|
|
260
|
+
return
|
|
261
|
+
if time.time() >= end:
|
|
262
|
+
if not calm:
|
|
263
|
+
raise Halt(f"macOS memory pressure stayed at level {level} for {limit_s:.0f}s after the last try")
|
|
264
|
+
emit("tune_progress", message=f" {baseline_gb - free:.1f} GB less memory is available than at the start "
|
|
265
|
+
"(another app grew?); going on")
|
|
266
|
+
return
|
|
267
|
+
if not told:
|
|
268
|
+
told = True
|
|
269
|
+
emit("tune_progress", message=" waiting for the machine to recover from the last try…")
|
|
270
|
+
time.sleep(SETTLE_POLL_S)
|
|
271
|
+
|
|
272
|
+
|
|
237
273
|
# ------------------------------------------------------------------ the search
|
|
238
274
|
def memory_gb(eng, m, info, guard):
|
|
239
275
|
"""What the server took with its context full: VRAM on a discrete GPU, else how much less memory
|
|
@@ -276,7 +312,12 @@ def search(try_ctx, start, upper, limit_gb=None, step=STEP, floor=FLOOR, max_sta
|
|
|
276
312
|
why = f"{max_starts} server starts used"
|
|
277
313
|
while len(tried) < max_starts:
|
|
278
314
|
emit("tune_step", message=f"[{len(tried) + 1}] context {c:,}", start=len(tried) + 1, max_starts=max_starts)
|
|
279
|
-
|
|
315
|
+
try:
|
|
316
|
+
r = try_ctx(c)
|
|
317
|
+
except Halt as e:
|
|
318
|
+
why = str(e)
|
|
319
|
+
emit("tune_result", message=f" not tried: {why}")
|
|
320
|
+
break
|
|
280
321
|
tried.append(r)
|
|
281
322
|
emit("tune_result", message=" " + r.summary(), result=r)
|
|
282
323
|
if r.ok:
|
|
@@ -383,10 +424,16 @@ def bench(eng, label, emit=lambda *a, **k: None, max_ctx=None, start=None, step=
|
|
|
383
424
|
room, refuse = room_gb(eng)
|
|
384
425
|
if refuse:
|
|
385
426
|
raise engine_mod.ModelFailed(refuse)
|
|
386
|
-
|
|
387
|
-
|
|
427
|
+
# A model that could be held in memory whole needs that much free before the first load (another
|
|
428
|
+
# model may be loaded). One larger than the machine's memory can't be: its server reads it from
|
|
429
|
+
# disk as needed, so its size says nothing about what it takes, and the probes' guard decides.
|
|
430
|
+
size, whole = model_gb(m), sv.machine.gpu_limit_gb if sv.machine.discrete else sv.machine.ram_gb
|
|
431
|
+
if room is not None and size is not None and room < size <= whole:
|
|
388
432
|
raise engine_mod.ModelFailed(f"the model is {size:.1f} GB and {room:.1f} GB is free for it now: another "
|
|
389
433
|
"model or app is holding memory")
|
|
434
|
+
if size is not None and size > whole:
|
|
435
|
+
emit("tune_step", message=f"the model is {size:.0f} GB on disk, more than this machine's memory: its server "
|
|
436
|
+
"reads it from disk as needed, so its size isn't checked against free memory")
|
|
390
437
|
# Half of what it runs with now, so the second probe is a context expected to work and the two
|
|
391
438
|
# give the memory per token before anything larger is tried.
|
|
392
439
|
usual = sv.ctx if sv.fits and sv.ctx else None
|
|
@@ -394,8 +441,11 @@ def bench(eng, label, emit=lambda *a, **k: None, max_ctx=None, start=None, step=
|
|
|
394
441
|
emit("tune_step", message=f"largest context up to {upper:,} ({source})"
|
|
395
442
|
+ (f"; {room:.1f} GB of memory to work with" if room is not None else ""))
|
|
396
443
|
|
|
444
|
+
baseline = None if sv.machine.discrete else machines.available_memory_gb()
|
|
445
|
+
|
|
397
446
|
def try_ctx(ctx):
|
|
398
447
|
eng._check()
|
|
448
|
+
settle(eng, baseline, emit)
|
|
399
449
|
return probe(eng, m, ctx, emit, limit_s)
|
|
400
450
|
|
|
401
451
|
tried, why = search(try_ctx, first, upper, room, step, min(FLOOR, first), max_starts, emit)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: tuieval
|
|
3
|
-
Version: 0.2.0.
|
|
3
|
+
Version: 0.2.0.dev156
|
|
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=y45X0y1Jrw6Tah9v8mPLL9xNWKJ_NMzYfhNsb-PN7l8,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=wlk5e1q0Y4eW2kf5oJMjx1-vA6lofmo9RV4A37JhDfI,24556
|
|
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
|
|
@@ -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.dev156.dist-info/METADATA,sha256=Cr189zzy2uMdrWFnzq35KZ-rP1_eiQSimvd9EaSsCcs,15306
|
|
55
|
+
tuieval-0.2.0.dev156.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
56
|
+
tuieval-0.2.0.dev156.dist-info/entry_points.txt,sha256=7eIhi1GpFxBP2OLJV02Nn8LwsNuO512eKOGt1IBbj04,45
|
|
57
|
+
tuieval-0.2.0.dev156.dist-info/licenses/LICENSE,sha256=7wfRgGtBGH1aXhZkIn47oUznqKC18kEPMvUVgol7Ffc,1077
|
|
58
|
+
tuieval-0.2.0.dev156.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|