@simplexai/localmodels-win32-x64 0.1.0-dev.71 → 0.1.0-dev.71.1
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.
- package/bootstrap.identity +1 -1
- package/bootstrap.sha256 +20 -20
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/app.py +35 -7
- package/modules/localmodels/engine_adapters/suite_plan.py +4 -2
- package/modules/localmodels/stack_capacity.py +37 -1
- package/modules/localmodels/stack_cli.py +1 -0
- package/modules/localmodels/stack_hardware.py +18 -16
- package/modules/localmodels/stack_plan.py +21 -0
- package/modules/localmodels/stack_progress.py +15 -0
- package/modules/localmodels/stack_run.py +25 -2
- package/modules/localmodels/stack_suite.py +54 -12
- package/modules/localmodels/suite.py +10 -1
- package/modules/{simplex_localmodels-0.1.0.dev71.dist-info → simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev71.dist-info → simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info}/RECORD +17 -17
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/{simplex_localmodels-0.1.0.dev71.dist-info → simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev71.dist-info → simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev71.dist-info → simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev71.dist-info → simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
package/bootstrap.identity
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
win32-x64
|
|
1
|
+
win32-x64 7e86994030a758ecc9b8808f863eed198ec12240 0.1.0.dev71+hotfix.1 python/python.exe modules
|
package/bootstrap.sha256
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
847f38ce6c40e2a4d088e2b2f519995779749ed3f1e05325b8740dceb9bb2b2c bootstrap.identity
|
|
2
2
|
15f49306ae54bb208f5a65763f59522a9193d5b01b31279c9bab116bba7ffe5c kit.py
|
|
3
3
|
821556e6336796450ab852d375117b48a4887e71d255794fd6318d99982a5ab6 modules/localmodels/HERMES-LICENSE
|
|
4
|
-
|
|
4
|
+
ed2ab1d1bb67773a1cbf78ccc8d80af48225e0fab1bb28a972348261c215b1f7 modules/localmodels/__init__.py
|
|
5
5
|
f30f1699b88743ff573f0808dda1349a72d3727112fda4dfeff6592ce09a9798 modules/localmodels/__main__.py
|
|
6
|
-
|
|
6
|
+
64f260c9e60950e607bcf17342c9d30148480c5e4e6bbcd8f050ed1058f42637 modules/localmodels/app.py
|
|
7
7
|
57a4799a2a94ce5af4d8834e1d35b599ab5de8ab1ab168c38ffcc3662e76f9db modules/localmodels/apple_sensors.py
|
|
8
8
|
e44db2b6aded3230c57c3b16b0b36dce83ac5e8c11335b09798942a032ef1f41 modules/localmodels/approval.py
|
|
9
9
|
53cbc910a97afb9080574b7bf5967067302b0678178a3948d7303fbe657b79a0 modules/localmodels/asr_audio.py
|
|
@@ -52,7 +52,7 @@ dd13deb64712d7e741f01e77c5ffb49abb14c093db7d36a01331300db65d811d modules/localm
|
|
|
52
52
|
e8ffe3b5f3f43ebdbdd2929bca04efc9bd2ad76ca93126ce4626a539fc054fea modules/localmodels/engine_adapters/base.py
|
|
53
53
|
9bd5ff65fc068d7cff951a567c621538f43a5687ad1ceb0c54b030b93877e831 modules/localmodels/engine_adapters/llama_cpp.py
|
|
54
54
|
3224c2fd59b79bc96bdf70d365da5a3c10eb7fb88dce4c22abc6be66c0e7df2e modules/localmodels/engine_adapters/strata_poly.py
|
|
55
|
-
|
|
55
|
+
077dd6454f6803f4ee41aa932f9ab789f4599494c87ba1ec287bce1df1119165 modules/localmodels/engine_adapters/suite_plan.py
|
|
56
56
|
aeb8effc1fa087752aee4b71be5133fc999cb3b15a0b11429fa5a24f61e5a9b3 modules/localmodels/engines-b11583.json
|
|
57
57
|
86452ddba54584c9bc7ea88fdf591afb0057fa069879ea9a7870a0e35d2acbe4 modules/localmodels/engines-b12588-mix-c0c3de8.json
|
|
58
58
|
c231f74b276785186e45836d019e59b20d5db4caa71857f523e160d1bca0f130 modules/localmodels/engines-b12757-mix-ef2df21.json
|
|
@@ -213,10 +213,10 @@ bd5e01ab0828816c38a43050058b8f3df888bed4443142f50550bcca542ad72a modules/localm
|
|
|
213
213
|
3058412438b4e3f07df134bb7b803de263e27aff17bbcb2b24812249a11e6e37 modules/localmodels/stack_auto.py
|
|
214
214
|
a154319139d3ef936b847783c623cbc11d6d2bc2e293d063253ca0e36905a1d3 modules/localmodels/stack_aux_gpu.py
|
|
215
215
|
d708f26410747223d2ee5e0df6f68d920f5febed5826bdfcf451c2d7a8779b49 modules/localmodels/stack_binding.py
|
|
216
|
-
|
|
216
|
+
36e436f01417589d415ac68005c61b9269203ca35c36328beab057cb960b2d89 modules/localmodels/stack_capacity.py
|
|
217
217
|
47ad4323533efe7120cdb53e713623d42b811cdafd04e8cff2fc40f08406b90b modules/localmodels/stack_card.py
|
|
218
218
|
43e1bc67e4742b043d277279dfa0bef5606689905798fe05e4fda716d8eef215 modules/localmodels/stack_cleanup.py
|
|
219
|
-
|
|
219
|
+
fc557cfeb740a7a2ab22cc222f0094d8fa4c6bb134f3e3354ce360137588c3df modules/localmodels/stack_cli.py
|
|
220
220
|
1dc0def3acd360605b7e9f602d81bf585fc3c9d3de20f9da28b63bf3bac2151f modules/localmodels/stack_client_settings.py
|
|
221
221
|
afe5be91f53507a6b66956fe402c59cb55e1e72dfd28c86154d8e5488be1f96e modules/localmodels/stack_clients.py
|
|
222
222
|
eb2e9fd9dd3bc661c66bbe09d720977e684ea5357b339d507a6885fce0f76e70 modules/localmodels/stack_compose.py
|
|
@@ -227,7 +227,7 @@ b64ae100a0adc411c36aca52c659d7c1033707dbea9fefec87a100345027a24f modules/localm
|
|
|
227
227
|
33707cbdb1662ad323675fa2af56694c8910accf92fe1ac2921706eace9236ec modules/localmodels/stack_down.py
|
|
228
228
|
7b6a50acc845cf750943bff19dbb4eeb41518d1859f427209d83f79294545519 modules/localmodels/stack_events.py
|
|
229
229
|
559fa61918b3c49f9e141ffb69b9d6cca2f3568acbecfa6935e7f6a7f6369c06 modules/localmodels/stack_gpu_memory.py
|
|
230
|
-
|
|
230
|
+
d8c97f5968ff5e83eaf78372e2d949d788b5751236c15fc606e1cdc1d9240d18 modules/localmodels/stack_hardware.py
|
|
231
231
|
0826b2c52d5e5c8f17862df79e598794db5ecfb8f73ef2e2757abf6f782854e4 modules/localmodels/stack_hardware_text.py
|
|
232
232
|
8e1c51ca353f4544ea52b7719290b3533d372308edb74adfdba956b5c4e2755d modules/localmodels/stack_journal.py
|
|
233
233
|
ea63d55aaa1fd132c269a0c6d0b8690a59f3834e47b5348865f45ae4012d620d modules/localmodels/stack_ledger.py
|
|
@@ -236,10 +236,10 @@ ea63d55aaa1fd132c269a0c6d0b8690a59f3834e47b5348865f45ae4012d620d modules/localm
|
|
|
236
236
|
1b4d718a9a18f2248ee0a49a7e5287e3d45264056f92ea01763c9d19c1c32c5b modules/localmodels/stack_memory.py
|
|
237
237
|
0cd25bf8f69628b1611acebe8500939e27191232a82d2f6216a40cd657aa1744 modules/localmodels/stack_mlx.py
|
|
238
238
|
0fe08a97489f2f482afd7d433bcb569bc7c03b8c2ec228a2b91f4478569578a0 modules/localmodels/stack_picks.py
|
|
239
|
-
|
|
239
|
+
92240a7ef63fd71f353d0dbab652b97c0534afa458e1e729a5fde04730f39ee2 modules/localmodels/stack_plan.py
|
|
240
240
|
2ccd68453a131e0014d85698ef6f5001a9266ef53e9c98902b67509dab6533e2 modules/localmodels/stack_ports.py
|
|
241
241
|
48336be2a5d10f091eb84b735ac02d886fe15c60ec0dce9acea2ac1518e49c6d modules/localmodels/stack_preflight.py
|
|
242
|
-
|
|
242
|
+
463fa643b43441a1a8b067e4480473b2dd2e7740129cec399e052dd89750d28a modules/localmodels/stack_progress.py
|
|
243
243
|
5c63381a7b23562e451716d30e6fd3dc85bdbe3a2cf827459187059da3be4e97 modules/localmodels/stack_remove.py
|
|
244
244
|
c6f7548a090b4b508b11460ab61d1665ba5be1595b44ba47c32ad46b0f4ac200 modules/localmodels/stack_research.py
|
|
245
245
|
4be035bd46217a6efadd9968ce5202eaef1ffe301862077cb3a41f4803e5b6b6 modules/localmodels/stack_research_demo.py
|
|
@@ -247,8 +247,8 @@ eb776cbdf6ec5ba36954c35f9b41725bb4cf6b63af4a362621cde6210b864b74 modules/localm
|
|
|
247
247
|
45f5ad7e5096ee5db5bf7169c0ab8e0fa064383044ac4979db540aff350f8b58 modules/localmodels/stack_review.py
|
|
248
248
|
0a7725d3f0f151aca198d3e20c32f3d16d1c90f4e3776fdedaf253d21dd53896 modules/localmodels/stack_rollback.py
|
|
249
249
|
c754c4e2b3d69111e1b317df085e47205163fe1ee2993e2ae98990a49a5ae82c modules/localmodels/stack_route.py
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
e92ac5c1411282a9c255b8cbfb68cb617ce35771162dbc41c6281cc32c7f8634 modules/localmodels/stack_run.py
|
|
251
|
+
87cfbe2f803f53072a86eb71ec6291e186689a1427eb6684f261d94eaac8f60a modules/localmodels/stack_suite.py
|
|
252
252
|
f10a73bac131018d76fc1957ccca2c437c424595071560c4b337a8541717b367 modules/localmodels/stack_summary.py
|
|
253
253
|
20bb45734c8d6801714126844b8b0a3018d2b68bd951e9cfa0e3c7da8de7e11e modules/localmodels/stack_try.py
|
|
254
254
|
42deb0e0495b35165b73319fcf6d744994a68bd67f9e33409913fd3dd9dcab25 modules/localmodels/stack_try_client.py
|
|
@@ -283,7 +283,7 @@ aa2496ee31f531000907de70ff117909d24c07d989b7315d429a648350a97eba modules/localm
|
|
|
283
283
|
94158929dcf13d1e189b8e552ae3f646fc484767e4d47eecf2c37cbf47130816 modules/localmodels/strata-poly-serve-0.2.20-poly.1.txt
|
|
284
284
|
6786a3355e2c7ec870e2169091a0fb0173f55d049d0defe3e7479dacf5e5c5b4 modules/localmodels/strata-poly-serve-0.2.20-poly.7.txt
|
|
285
285
|
c9a84cfa4e4dfad81510fc6f111c7db76929d566cd96c49fafdc5f8e5447f5b1 modules/localmodels/strata_poly_server.py
|
|
286
|
-
|
|
286
|
+
8b83f99fec612eba5ec1b34a6610652c5c1e1c5f95338e59fed4c182d3159723 modules/localmodels/suite.py
|
|
287
287
|
02a53037a7010566090c87c603b703bca439ed85c1700717103eaaaea995e00f modules/localmodels/telemetry_math.py
|
|
288
288
|
22be2d2d6303c7714503bbe72d5d4788eb070b9939f6ec81ebd947eb45f53f8b modules/localmodels/tool_archive.py
|
|
289
289
|
3fc53d0e9ae000e7b8e81b4a14a1e3627c366517ebd39da22aedaa81dfbafd25 modules/localmodels/tools.json
|
|
@@ -315,13 +315,13 @@ e6356d972d86a3f3fee7b31714021e50670d2be9327f1c6d1a26529fdec048a1 modules/localm
|
|
|
315
315
|
5b301ed9ff864d51669e133a1175eb4d5661db47eb857eccb2497fbc0d7f79bf modules/localmodels/web/view/view.js
|
|
316
316
|
84535ea1c54aeb68bfbfbe357b7f19e7a2d69b9ce9ff2f4f7e8b6a668f76eb3f modules/localmodels/win_probe.py
|
|
317
317
|
d3be4542d9b3f32a61bc65cc4264a74301b0eab6f302a30f43e878e9e9b228d6 modules/localmodels/windows_job.py
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
d5d0ff1a812a108c50ed59eb504c60763fde1316386f85207d1d2206518a55a7 modules/simplex_localmodels-0.1.0.dev71.dist-info/WHEEL
|
|
321
|
-
3a3059212ac60178113110eaaeafa6dbafe72c598d64d3616cbb498ae9c881f7 modules/simplex_localmodels-0.1.0.dev71.dist-info/entry_points.txt
|
|
322
|
-
1ac9562326e7b0a3a152f0eb670d82abd1038ea971a0574453682c68a5ee5b8e modules/simplex_localmodels-0.1.0.dev71.dist-info/licenses/NOTICE
|
|
323
|
-
821556e6336796450ab852d375117b48a4887e71d255794fd6318d99982a5ab6 modules/simplex_localmodels-0.1.0.dev71.dist-info/licenses/localmodels/HERMES-LICENSE
|
|
324
|
-
|
|
318
|
+
0e0144ed4c5958f1c05a43fb9452bbf6b28182eafef307621e8dc60b6a0efdbd modules/simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info/METADATA
|
|
319
|
+
529f0d66f29b878c9fa316a09b17899866a8e67936372cf4947625ed00761973 modules/simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info/RECORD
|
|
320
|
+
d5d0ff1a812a108c50ed59eb504c60763fde1316386f85207d1d2206518a55a7 modules/simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info/WHEEL
|
|
321
|
+
3a3059212ac60178113110eaaeafa6dbafe72c598d64d3616cbb498ae9c881f7 modules/simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info/entry_points.txt
|
|
322
|
+
1ac9562326e7b0a3a152f0eb670d82abd1038ea971a0574453682c68a5ee5b8e modules/simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info/licenses/NOTICE
|
|
323
|
+
821556e6336796450ab852d375117b48a4887e71d255794fd6318d99982a5ab6 modules/simplex_localmodels-0.1.0.dev71+hotfix.1.dist-info/licenses/localmodels/HERMES-LICENSE
|
|
324
|
+
6f9226fd02e17b864cf6acd80eec58795cae846257309b282dbdc0e1edb08fa4 package.json
|
|
325
325
|
6c3570716921fd402c441c3ad8fab159f80c60fc55dd31ebb273e18d0764b2ff python/DLLs/_asyncio.pyd
|
|
326
326
|
4ce0888c64c92806abfa067ddd0a3fffa0cb0be230c2d5a6054094af343c64a7 python/DLLs/_bz2.pyd
|
|
327
327
|
0abcfe23e653e2bc6da07265dcdbe7c1f381bc97183e251db484ea4e33abfcbe python/DLLs/_ctypes.pyd
|
|
@@ -3456,4 +3456,4 @@ a039bdd83885e1256724486b16e2c25ace6927a708e446fd7dcb20af11c500de python/tcl/tk8
|
|
|
3456
3456
|
06f679a910ccf05f9daa329654bd5e27a2791f5374a19b14706c9780c1d3aa24 python/tcl/tkstub86.lib
|
|
3457
3457
|
d5e4d9a3e835fa679450145d6a7d94e36573a509317111904d9b3712c30d9066 python/vcruntime140.dll
|
|
3458
3458
|
1f2d41c4aa5db0bc33ebf7b66d72943a817d7ce6cbe880502a9403823633093f python/vcruntime140_1.dll
|
|
3459
|
-
|
|
3459
|
+
35ef222d26a4cd99422dd3ca30325fc54980dcdd171c7342223a83967f3384f6 tool.json
|
|
@@ -44,6 +44,7 @@ from localmodels.records import (
|
|
|
44
44
|
PlanResponse,
|
|
45
45
|
ProgressEvent,
|
|
46
46
|
)
|
|
47
|
+
from localmodels.stack_plan import StackError
|
|
47
48
|
|
|
48
49
|
WEB_DIR = Path(__file__).with_name("web")
|
|
49
50
|
_PLANS: dict[str, tuple[str, Plan, deploy.PlanOptions]] = {}
|
|
@@ -233,6 +234,23 @@ def deploy_approved(
|
|
|
233
234
|
return run_deploy(dev_id, approved, on_event=on_event)
|
|
234
235
|
|
|
235
236
|
|
|
237
|
+
def _stop_reason(exc: BaseException) -> str:
|
|
238
|
+
"""Why a deployment stopped before its start step, without native output: a guard's fixed
|
|
239
|
+
public sentence, this tool's own StackError text (the free and needed VRAM of
|
|
240
|
+
STACK_VRAM_INSUFFICIENT among them), an OS error's description without its path, or the
|
|
241
|
+
exception type."""
|
|
242
|
+
if isinstance(exc, KeyboardInterrupt):
|
|
243
|
+
return "interrupted"
|
|
244
|
+
public = getattr(exc, "public_message", "")
|
|
245
|
+
if getattr(exc, "cause_code", None) != "STACK_VRAM_INSUFFICIENT" and public:
|
|
246
|
+
return str(public)
|
|
247
|
+
if isinstance(exc, StackError):
|
|
248
|
+
return str(exc)
|
|
249
|
+
if isinstance(exc, OSError) and exc.strerror:
|
|
250
|
+
return f"{type(exc).__name__}: {exc.strerror}"
|
|
251
|
+
return type(exc).__name__
|
|
252
|
+
|
|
253
|
+
|
|
236
254
|
def run_deploy(
|
|
237
255
|
dev_id: str,
|
|
238
256
|
built: Plan,
|
|
@@ -258,7 +276,13 @@ def run_deploy(
|
|
|
258
276
|
else:
|
|
259
277
|
job["events"].append({"step": step, **event})
|
|
260
278
|
|
|
261
|
-
|
|
279
|
+
starting: list[bool] = []
|
|
280
|
+
|
|
281
|
+
def gate() -> None:
|
|
282
|
+
if before_start is not None:
|
|
283
|
+
before_start()
|
|
284
|
+
starting.append(True) # from here on the start step may run
|
|
285
|
+
|
|
262
286
|
started: list[FinishedRecord] = []
|
|
263
287
|
try:
|
|
264
288
|
record = deploy.execute(
|
|
@@ -267,15 +291,19 @@ def run_deploy(
|
|
|
267
291
|
api_key=api_key,
|
|
268
292
|
on_event=record_event,
|
|
269
293
|
on_start=started.append,
|
|
270
|
-
|
|
294
|
+
before_start=gate,
|
|
271
295
|
)
|
|
272
|
-
except BaseException:
|
|
273
|
-
#
|
|
274
|
-
#
|
|
296
|
+
except BaseException as exc:
|
|
297
|
+
# Keep a failed record, so `stack status`, `stack remove` and `service ... remove`
|
|
298
|
+
# still find what was installed and stop a service that may have started.
|
|
275
299
|
for partial in started:
|
|
276
300
|
partial["error"] = (
|
|
277
|
-
|
|
278
|
-
|
|
301
|
+
(
|
|
302
|
+
"deployment interrupted: the service may have started; stack remove or "
|
|
303
|
+
"service HOST NAME remove stops it"
|
|
304
|
+
)
|
|
305
|
+
if starting
|
|
306
|
+
else f"deployment stopped before start: {_stop_reason(exc)}"
|
|
279
307
|
)
|
|
280
308
|
partial["finished_at"] = plan_envelope.utc_now()
|
|
281
309
|
hosts.save_record(dev_id, partial)
|
|
@@ -272,6 +272,7 @@ def _launch(
|
|
|
272
272
|
parking_mib: int,
|
|
273
273
|
added_mib: int,
|
|
274
274
|
) -> dict[str, object]:
|
|
275
|
+
vram, floor = suite.gpu_bytes(r, reader)
|
|
275
276
|
return {
|
|
276
277
|
"window": r.get("context", 0),
|
|
277
278
|
"spilled": False,
|
|
@@ -279,8 +280,9 @@ def _launch(
|
|
|
279
280
|
"reasons": [r.get("note", "")],
|
|
280
281
|
"threads": int(values["threads"]),
|
|
281
282
|
"memory_estimate_bytes": r["memory_estimate_bytes"] + (added_mib << 20),
|
|
282
|
-
"vram_bytes":
|
|
283
|
-
|
|
283
|
+
"vram_bytes": vram,
|
|
284
|
+
# PolyStrata: vram_bytes is the expert cache's ceiling; this is the least it starts in.
|
|
285
|
+
**({"min_vram_free_bytes": floor} if floor else {}),
|
|
284
286
|
**({"preparation": _formatted(r["preparation"], values)} if r.get("preparation") else {}),
|
|
285
287
|
**({"conversation_cache_mib": parking_mib} if r.get("conversation_cache") else {}),
|
|
286
288
|
**adapter_for(r["runtime"]).launch_keys(profile),
|
|
@@ -10,7 +10,7 @@ from __future__ import annotations
|
|
|
10
10
|
from dataclasses import replace
|
|
11
11
|
|
|
12
12
|
from localmodels import catalog as cat
|
|
13
|
-
from localmodels import component, context_policy, gpu_specs, llm_rank, metal
|
|
13
|
+
from localmodels import component, context_policy, gpu_specs, llm_rank, metal, suite
|
|
14
14
|
from localmodels.context_policy import AGENT, AgentPosture, cache_floor_bytes, posture_for
|
|
15
15
|
from localmodels.deploy import DEFAULT_BASE_DIR
|
|
16
16
|
from localmodels.engine_adapters import llama_cpp
|
|
@@ -23,6 +23,7 @@ from localmodels.estimator import (
|
|
|
23
23
|
from localmodels.plan_envelope import PlanError
|
|
24
24
|
from localmodels.planning.budget import gib
|
|
25
25
|
from localmodels.probe import GPU, HostFacts
|
|
26
|
+
from localmodels.records import Plan
|
|
26
27
|
from localmodels.stack_plan import CapacityFit, Hardware, StackOptions
|
|
27
28
|
|
|
28
29
|
WDDM_NOTE = (
|
|
@@ -48,6 +49,41 @@ def decision_reserve(card_budget_bytes: int, options: StackOptions) -> int:
|
|
|
48
49
|
return min(fitting) if fitting else 0
|
|
49
50
|
|
|
50
51
|
|
|
52
|
+
def start_floor(part: Plan) -> int:
|
|
53
|
+
"""The least free VRAM a part's engine starts in, 0 when its recipe sets none. A PolyStrata
|
|
54
|
+
expert cache shrinks to what is free above ``launch.min_vram_free_bytes``, so its
|
|
55
|
+
``vram_bytes`` is a ceiling. A plan saved before plans carried the floor takes the catalog
|
|
56
|
+
recipe's by model id."""
|
|
57
|
+
launch = part["launch"]
|
|
58
|
+
if "min_vram_free_bytes" in launch:
|
|
59
|
+
return int(str(launch["min_vram_free_bytes"]))
|
|
60
|
+
try:
|
|
61
|
+
recipe = suite.recipe(part["model"].get("id", ""))
|
|
62
|
+
except PlanError:
|
|
63
|
+
return 0
|
|
64
|
+
return suite.gpu_bytes(recipe, str(launch.get("vision", "off")))[1]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def start_need(vram_bytes: int, floor: int, card: GPU, options: StackOptions | None) -> int:
|
|
68
|
+
"""Free VRAM a GPU part needs on ``card`` to start: the one measure for planning a shared
|
|
69
|
+
Strata card, every recipe (stack_suite), the check before ``stack apply`` starts a part and
|
|
70
|
+
``stack up``.
|
|
71
|
+
``options`` adds the smallest decision model kept beside the LLM (``stack apply``'s LLM and
|
|
72
|
+
planning); ``stack up`` starts each part on its own and passes None.
|
|
73
|
+
|
|
74
|
+
With a floor (``start_floor``): the floor, the decision reserve and VRAM_MARGIN. The engine's
|
|
75
|
+
own ``--vram-reserve-mib`` already keeps the display and its overshoot out of the expert
|
|
76
|
+
cache, so the 1 GiB agent reserve is not added again. Without one, ``vram_bytes`` with the
|
|
77
|
+
agent reserve (``stack apply``) or VRAM_MARGIN (``stack up``), as before."""
|
|
78
|
+
reserve = (
|
|
79
|
+
decision_reserve(component.auto_budget(card["total_bytes"]), options) if options else 0
|
|
80
|
+
)
|
|
81
|
+
if floor > 0:
|
|
82
|
+
return floor + reserve + component.VRAM_MARGIN
|
|
83
|
+
margin = AGENT_VRAM_RESERVE_BYTES if options is not None else component.VRAM_MARGIN
|
|
84
|
+
return vram_bytes + margin + reserve
|
|
85
|
+
|
|
86
|
+
|
|
51
87
|
def device(facts: HostFacts, index: int) -> GPU:
|
|
52
88
|
"""Card ``index`` of ``cards``: an NVIDIA card, or a Mac's Metal GPU."""
|
|
53
89
|
found = metal.device(facts)
|
|
@@ -147,6 +147,7 @@ def apply_cli(
|
|
|
147
147
|
plan_id=plan_id,
|
|
148
148
|
attempt_id=attempt_ids[-1] if attempt_ids else None,
|
|
149
149
|
cause=stack_run.cause_of(exc, started=bool(attempt_ids)),
|
|
150
|
+
counts=stack_run.cause_counts(exc),
|
|
150
151
|
)
|
|
151
152
|
|
|
152
153
|
def emit_progress(event: stack_events.ProgressEvent) -> None:
|
|
@@ -10,7 +10,6 @@ from typing import Any, cast
|
|
|
10
10
|
from localmodels import catalog as cat
|
|
11
11
|
from localmodels import (
|
|
12
12
|
catalog_recipes,
|
|
13
|
-
component,
|
|
14
13
|
gpu_specs,
|
|
15
14
|
llm_rank,
|
|
16
15
|
metal,
|
|
@@ -20,7 +19,6 @@ from localmodels import (
|
|
|
20
19
|
suite,
|
|
21
20
|
)
|
|
22
21
|
from localmodels.context_policy import AgentPosture, posture_for
|
|
23
|
-
from localmodels.estimator import AGENT_VRAM_RESERVE_BYTES
|
|
24
22
|
from localmodels.planning.budget import (
|
|
25
23
|
gib,
|
|
26
24
|
holders,
|
|
@@ -33,6 +31,8 @@ from localmodels.records import Plan
|
|
|
33
31
|
from localmodels.stack_capacity import decision_reserve as decision_reserve
|
|
34
32
|
from localmodels.stack_capacity import device as device
|
|
35
33
|
from localmodels.stack_capacity import llm_budget as llm_budget
|
|
34
|
+
from localmodels.stack_capacity import start_floor as start_floor
|
|
35
|
+
from localmodels.stack_capacity import start_need as start_need
|
|
36
36
|
from localmodels.stack_picks import picks
|
|
37
37
|
from localmodels.stack_plan import (
|
|
38
38
|
Card,
|
|
@@ -41,6 +41,7 @@ from localmodels.stack_plan import (
|
|
|
41
41
|
LlmFit,
|
|
42
42
|
StackError,
|
|
43
43
|
StackOptions,
|
|
44
|
+
VramShortError,
|
|
44
45
|
default_options,
|
|
45
46
|
platform_error,
|
|
46
47
|
)
|
|
@@ -181,7 +182,8 @@ def check_shared_start(
|
|
|
181
182
|
part: Plan, facts: HostFacts, *, options: StackOptions | None = None
|
|
182
183
|
) -> None:
|
|
183
184
|
"""Recheck free VRAM before starting. Shared or not, an unknown owner of other GPU work no
|
|
184
|
-
longer refuses (roadmap decision 60): the card's free memory
|
|
185
|
+
longer refuses (roadmap decision 60): the card's free memory against ``start_need`` decides;
|
|
186
|
+
too little raises VramShortError (STACK_VRAM_INSUFFICIENT)."""
|
|
185
187
|
from localmodels import hosts, stack_lifecycle
|
|
186
188
|
|
|
187
189
|
for record in hosts.records("local"):
|
|
@@ -198,24 +200,24 @@ def check_shared_start(
|
|
|
198
200
|
and rows[0]["health"] in ("ok", "ready")
|
|
199
201
|
):
|
|
200
202
|
return # The verified healthy backend is already resident; no new allocation.
|
|
201
|
-
|
|
203
|
+
vram = int(str(part["launch"].get("vram_bytes") or 0))
|
|
204
|
+
floor = start_floor(part)
|
|
202
205
|
assigned = cast(list[dict[str, Any]], part["placement"].get("gpus") or [])
|
|
203
|
-
if
|
|
206
|
+
if vram <= 0 or not assigned:
|
|
204
207
|
raise StackError("the GPU-sharing model has no VRAM budget or no approved GPU placement")
|
|
205
208
|
for target in assigned:
|
|
206
209
|
card = next((g for g in facts.get("gpus") or [] if g["uuid"] == target["uuid"]), None)
|
|
207
|
-
|
|
208
|
-
decision_reserve(component.auto_budget(card["total_bytes"]), options)
|
|
209
|
-
if card and options
|
|
210
|
-
else 0
|
|
211
|
-
)
|
|
212
|
-
margin = AGENT_VRAM_RESERVE_BYTES if options is not None else component.VRAM_MARGIN
|
|
213
|
-
if card is None or card["free_bytes"] < needed + margin + reserve:
|
|
214
|
-
free = gib(card["free_bytes"]) if card else "no such card"
|
|
210
|
+
if card is None:
|
|
215
211
|
raise StackError(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
212
|
+
"the approved GPU of the model is not on this computer now; plan again"
|
|
213
|
+
)
|
|
214
|
+
needed = start_need(vram, floor, card, options)
|
|
215
|
+
if card["free_bytes"] < needed:
|
|
216
|
+
raise VramShortError(
|
|
217
|
+
f"free VRAM too low for the approved model ({gib(card['free_bytes'])} free, "
|
|
218
|
+
f"{gib(needed)} needed); close programs that use the GPU and retry",
|
|
219
|
+
free_bytes=card["free_bytes"],
|
|
220
|
+
required_bytes=needed,
|
|
219
221
|
)
|
|
220
222
|
|
|
221
223
|
|
|
@@ -86,8 +86,29 @@ class StackReplanError(StackGuardError, PlanError):
|
|
|
86
86
|
"""A guarded rebuild still satisfies the existing PlanError catch contract."""
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
class VramShortError(StackGuardError):
|
|
90
|
+
"""Too little free VRAM to start an approved GPU part; carries only the two byte counts."""
|
|
91
|
+
|
|
92
|
+
def __init__(self, message: str, *, free_bytes: int, required_bytes: int) -> None:
|
|
93
|
+
super().__init__(
|
|
94
|
+
message,
|
|
95
|
+
cause_code="STACK_VRAM_INSUFFICIENT",
|
|
96
|
+
public_message="free VRAM is too low to start the model; close programs that use "
|
|
97
|
+
"the GPU and retry",
|
|
98
|
+
)
|
|
99
|
+
self.free_bytes = free_bytes
|
|
100
|
+
self.required_bytes = required_bytes
|
|
101
|
+
|
|
102
|
+
|
|
89
103
|
def guard_details(exc: BaseException) -> dict[str, object]:
|
|
90
104
|
"""Project only typed guard metadata; the lower event layer validates its values."""
|
|
105
|
+
if isinstance(exc, VramShortError):
|
|
106
|
+
return {
|
|
107
|
+
"causeCode": exc.cause_code,
|
|
108
|
+
"changedFields": exc.changed_fields,
|
|
109
|
+
"freeBytes": exc.free_bytes,
|
|
110
|
+
"requiredBytes": exc.required_bytes,
|
|
111
|
+
}
|
|
91
112
|
if isinstance(exc, StackGuardError):
|
|
92
113
|
return {"causeCode": exc.cause_code, "changedFields": exc.changed_fields}
|
|
93
114
|
return {}
|
|
@@ -18,6 +18,16 @@ __all__ = ["JsonlObserver", "ProgressObserver", "PublicProgress", "forward", "re
|
|
|
18
18
|
|
|
19
19
|
# Shared section names; approval.py continues to own the authorization checks.
|
|
20
20
|
ERROR_PLAN_FIELDS = frozenset(STACK_PLAN_SECTIONS)
|
|
21
|
+
_MAX_SAFE_INT = (1 << 53) - 1 # JavaScript's safe integer range
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def byte_counts(metadata: Mapping[str, object]) -> dict[str, int]:
|
|
25
|
+
"""``freeBytes`` and ``requiredBytes`` of a STACK_VRAM_INSUFFICIENT guard, only when both
|
|
26
|
+
are plain non-negative integers in JavaScript's safe range; else none."""
|
|
27
|
+
counts = {key: metadata.get(key) for key in ("freeBytes", "requiredBytes")}
|
|
28
|
+
if all(type(v) is int and 0 <= v <= _MAX_SAFE_INT for v in counts.values()):
|
|
29
|
+
return {key: int(str(v)) for key, v in counts.items()}
|
|
30
|
+
return {}
|
|
21
31
|
|
|
22
32
|
|
|
23
33
|
class JsonlObserver:
|
|
@@ -84,11 +94,13 @@ def error(code: int, details: Mapping[str, object] | None = None) -> int:
|
|
|
84
94
|
cause = "STACK_APPLY_INTERRUPTED" if code == 130 else "STACK_APPLY_FAILED"
|
|
85
95
|
category = "interrupted" if code == 130 else "execution"
|
|
86
96
|
fields: list[str] | None = None
|
|
97
|
+
counts: dict[str, int] = {}
|
|
87
98
|
guards = {
|
|
88
99
|
"STACK_PLAN_CHANGED",
|
|
89
100
|
"STACK_APPROVAL_MISMATCH",
|
|
90
101
|
"STACK_REPLAN_FAILED",
|
|
91
102
|
"STACK_APPLY_LOCKED",
|
|
103
|
+
"STACK_VRAM_INSUFFICIENT",
|
|
92
104
|
}
|
|
93
105
|
metadata = details if isinstance(details, Mapping) else {}
|
|
94
106
|
cause_code = metadata.get("causeCode")
|
|
@@ -105,6 +117,8 @@ def error(code: int, details: Mapping[str, object] | None = None) -> int:
|
|
|
105
117
|
):
|
|
106
118
|
cause, category = cause_code, "guard"
|
|
107
119
|
fields = [field for field in changed if field in ERROR_PLAN_FIELDS] or None
|
|
120
|
+
if cause_code == "STACK_VRAM_INSUFFICIENT":
|
|
121
|
+
counts = byte_counts(metadata)
|
|
108
122
|
event = {
|
|
109
123
|
"schema": "localmodels.stack-error/v1",
|
|
110
124
|
"event": "error",
|
|
@@ -112,6 +126,7 @@ def error(code: int, details: Mapping[str, object] | None = None) -> int:
|
|
|
112
126
|
"category": category,
|
|
113
127
|
"causeCode": cause,
|
|
114
128
|
**({"changedFields": fields} if fields is not None else {}),
|
|
129
|
+
**counts,
|
|
115
130
|
}
|
|
116
131
|
print(json.dumps(event), flush=True)
|
|
117
132
|
return code
|
|
@@ -11,7 +11,7 @@ from datetime import datetime, timezone
|
|
|
11
11
|
from typing import Any, Literal
|
|
12
12
|
from uuid import UUID, uuid4
|
|
13
13
|
|
|
14
|
-
from localmodels import console, hosts
|
|
14
|
+
from localmodels import console, hosts, stack_progress
|
|
15
15
|
from localmodels.approval import digest
|
|
16
16
|
from localmodels.contracts import decode
|
|
17
17
|
from localmodels.plan_envelope import utc_now
|
|
@@ -25,6 +25,7 @@ from localmodels.stack_plan import (
|
|
|
25
25
|
StackRecord,
|
|
26
26
|
command,
|
|
27
27
|
deployments,
|
|
28
|
+
guard_details,
|
|
28
29
|
)
|
|
29
30
|
|
|
30
31
|
RunState = Literal["running", "completed", "failed", "interrupted"]
|
|
@@ -452,6 +453,10 @@ CAUSES = {
|
|
|
452
453
|
"STACK_REPLAN_FAILED": "planning again from this computer's current state failed; "
|
|
453
454
|
"run stack plan again on this computer",
|
|
454
455
|
"STACK_APPLY_LOCKED": "another stack apply is running",
|
|
456
|
+
# Raised before a GPU part starts, also after execution began; free_bytes and
|
|
457
|
+
# required_bytes say by how much.
|
|
458
|
+
"STACK_VRAM_INSUFFICIENT": "free VRAM is too low to start the model; close programs that "
|
|
459
|
+
"use the GPU and retry",
|
|
455
460
|
"STACK_APPLY_INTERRUPTED": "interrupted",
|
|
456
461
|
"STACK_APPLY_REJECTED": "the plan could not be loaded or checked; "
|
|
457
462
|
"run the same command without --json to see why",
|
|
@@ -583,6 +588,10 @@ def component_failure(record: StackRecord) -> tuple[list[str], tuple[str, str]]
|
|
|
583
588
|
return failed, ("STACK_COMPONENT_FAILED", CAUSES["STACK_COMPONENT_FAILED"])
|
|
584
589
|
|
|
585
590
|
|
|
591
|
+
# Guard codes that keep their own cause when raised after execution started.
|
|
592
|
+
_AFTER_START = frozenset({"STACK_VRAM_INSUFFICIENT"})
|
|
593
|
+
|
|
594
|
+
|
|
586
595
|
def cause_of(exc: BaseException, *, started: bool) -> tuple[str, str]:
|
|
587
596
|
"""(cause code, fixed message) for an apply that raised ``exc``: a guard's own code (and its
|
|
588
597
|
literal public sentence when it has one), else interrupted, failed after starting, or
|
|
@@ -590,13 +599,25 @@ def cause_of(exc: BaseException, *, started: bool) -> tuple[str, str]:
|
|
|
590
599
|
if isinstance(exc, KeyboardInterrupt):
|
|
591
600
|
return "STACK_APPLY_INTERRUPTED", CAUSES["STACK_APPLY_INTERRUPTED"]
|
|
592
601
|
code = getattr(exc, "cause_code", None)
|
|
593
|
-
if isinstance(code, str) and code in CAUSES and not started:
|
|
602
|
+
if isinstance(code, str) and code in CAUSES and (not started or code in _AFTER_START):
|
|
594
603
|
public = getattr(exc, "public_message", "")
|
|
595
604
|
return code, public if isinstance(public, str) and public else CAUSES[code]
|
|
596
605
|
code = "STACK_APPLY_FAILED" if started else "STACK_APPLY_REJECTED"
|
|
597
606
|
return code, CAUSES[code]
|
|
598
607
|
|
|
599
608
|
|
|
609
|
+
def cause_counts(exc: BaseException) -> dict[str, int]:
|
|
610
|
+
"""``free_bytes`` and ``required_bytes`` of a STACK_VRAM_INSUFFICIENT guard, else none."""
|
|
611
|
+
if getattr(exc, "cause_code", None) != "STACK_VRAM_INSUFFICIENT":
|
|
612
|
+
return {}
|
|
613
|
+
counts = stack_progress.byte_counts(guard_details(exc))
|
|
614
|
+
return (
|
|
615
|
+
{"free_bytes": counts["freeBytes"], "required_bytes": counts["requiredBytes"]}
|
|
616
|
+
if counts
|
|
617
|
+
else {}
|
|
618
|
+
)
|
|
619
|
+
|
|
620
|
+
|
|
600
621
|
def machine_result(
|
|
601
622
|
record: StackRecord | None,
|
|
602
623
|
state: str,
|
|
@@ -606,6 +627,7 @@ def machine_result(
|
|
|
606
627
|
attempt_id: str | None = None,
|
|
607
628
|
plan: StackPlan | None = None,
|
|
608
629
|
cause: tuple[str, str] | None = None,
|
|
630
|
+
counts: Mapping[str, int] | None = None,
|
|
609
631
|
) -> int:
|
|
610
632
|
view = project(record, plan)
|
|
611
633
|
if record is not None and (view is None or (state == "completed" and not view["ok"])):
|
|
@@ -644,6 +666,7 @@ def machine_result(
|
|
|
644
666
|
else {}
|
|
645
667
|
),
|
|
646
668
|
**({"cause_code": cause[0], "message": cause[1]} if cause else {}),
|
|
669
|
+
**(counts if cause and counts else {}),
|
|
647
670
|
},
|
|
648
671
|
separators=(",", ":"),
|
|
649
672
|
)
|
|
@@ -32,6 +32,7 @@ from localmodels.planning.budget import (
|
|
|
32
32
|
from localmodels.planning.llm_ram import prompt_cache_bytes, prompt_cache_fit
|
|
33
33
|
from localmodels.probe import GPU, HostFacts
|
|
34
34
|
from localmodels.records import Plan
|
|
35
|
+
from localmodels.stack_capacity import start_need
|
|
35
36
|
from localmodels.stack_plan import (
|
|
36
37
|
HARNESS_RAM,
|
|
37
38
|
RAM_FLOOR,
|
|
@@ -262,10 +263,12 @@ def _suite_gpu(
|
|
|
262
263
|
gpu: int | None = None,
|
|
263
264
|
*,
|
|
264
265
|
share_gpu: bool = False,
|
|
266
|
+
free_needed: Callable[[GPU], int] | None = None,
|
|
265
267
|
) -> GPU:
|
|
266
268
|
"""The card of the running Strata LLM, else the best idle card (``gpu``: only that one). A
|
|
267
269
|
running plan without a GPU (WHI-169: a synthetic or CPU plan of the same name) runs on no
|
|
268
|
-
suite card.
|
|
270
|
+
suite card. Shared, a card at least ``need`` large passes with ``free_needed(card)`` free,
|
|
271
|
+
at least what the check before start will ask (``stack_capacity.start_need``)."""
|
|
269
272
|
placed = running["placement"].get("gpus") if running is not None else None
|
|
270
273
|
cards_of_running = (
|
|
271
274
|
[c for c in placed if isinstance(c, dict)] if isinstance(placed, list) else []
|
|
@@ -290,21 +293,53 @@ def _suite_gpu(
|
|
|
290
293
|
free = gib(mac["free_bytes"])
|
|
291
294
|
raise StackError(f"{llm['id']} needs {gib(need)} of unified memory, {free} is free")
|
|
292
295
|
return mac
|
|
293
|
-
|
|
296
|
+
if share_gpu and free_needed is not None:
|
|
297
|
+
candidates = [
|
|
298
|
+
g
|
|
299
|
+
for g in sharing_cards(facts, 0)
|
|
300
|
+
if g["total_bytes"] >= need and g["free_bytes"] >= free_needed(g)
|
|
301
|
+
]
|
|
302
|
+
else:
|
|
303
|
+
candidates = sharing_cards(facts, need) if share_gpu else idle_cards(facts, need)
|
|
294
304
|
cards = [g for g in candidates if gpu is None or g["index"] == gpu]
|
|
295
|
-
if
|
|
296
|
-
|
|
305
|
+
if cards:
|
|
306
|
+
return cards[0]
|
|
307
|
+
which = "an" if gpu is None else f"GPU {gpu} to be an"
|
|
308
|
+
if share_gpu and free_needed is not None:
|
|
297
309
|
seen = "; ".join(
|
|
298
|
-
f"GPU {g['index']} {gib(g['total_bytes'])}"
|
|
299
|
-
+
|
|
300
|
-
for g in facts
|
|
310
|
+
f"GPU {g['index']} {gib(g['total_bytes'])}, {gib(g['free_bytes'])} free"
|
|
311
|
+
+ (f" of {gib(free_needed(g))} needed" if g["total_bytes"] >= need else "")
|
|
312
|
+
for g in sharing_cards(facts, 0)
|
|
301
313
|
)
|
|
302
|
-
which = "an" if gpu is None else f"GPU {gpu} to be an"
|
|
303
314
|
raise StackError(
|
|
304
|
-
f"{llm['id']} needs {which} NVIDIA GPU
|
|
305
|
-
f"
|
|
315
|
+
f"{llm['id']} needs {which} NVIDIA GPU of at least {gib(need)} with enough free "
|
|
316
|
+
f"VRAM for it; this host: {seen or 'no NVIDIA GPU'}"
|
|
306
317
|
)
|
|
307
|
-
|
|
318
|
+
held_by = holders(facts)
|
|
319
|
+
seen = "; ".join(
|
|
320
|
+
f"GPU {g['index']} {gib(g['total_bytes'])}"
|
|
321
|
+
+ "".join(f", {why}" for why in held_by.get(g["uuid"], ["idle"]))
|
|
322
|
+
for g in facts.get("gpus") or []
|
|
323
|
+
)
|
|
324
|
+
raise StackError(
|
|
325
|
+
f"{llm['id']} needs {which} NVIDIA GPU with no compute processes and at least "
|
|
326
|
+
f"{gib(need)} of memory; this host: {seen or 'no NVIDIA GPU'}"
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def _free_to_plan(recipe: suite.SuiteRecipe, card: GPU, options: StackOptions) -> int:
|
|
331
|
+
"""The free VRAM a shared ``card`` needs for the recipe: never less than ``stack apply`` asks
|
|
332
|
+
before it starts it (``stack_capacity.start_need`` on its plan's ``vram_bytes`` and floor
|
|
333
|
+
there, with the picture reader this card gets and the decision reserve), and never less
|
|
334
|
+
than the recipe's ``vram_bytes``. A PolyStrata floor is enough to start, not to run at
|
|
335
|
+
speed: on a card another program is using, Windows pages the expert cache in and out
|
|
336
|
+
(MR !781 homewin acceptance, 2026-12-01: 6.5 GiB free decoded about 11 tok/s), so shared
|
|
337
|
+
planning keeps the full-cache size until the engine sizes its cache by the real free VRAM."""
|
|
338
|
+
reader = vision.strata_mode(
|
|
339
|
+
options.get("vision", "off"), card["total_bytes"], bool(recipe.get("vision"))
|
|
340
|
+
)
|
|
341
|
+
vram, floor = suite.gpu_bytes(recipe, reader)
|
|
342
|
+
return max(int(recipe.get("vram_bytes", 0)), start_need(vram, floor, card, options))
|
|
308
343
|
|
|
309
344
|
|
|
310
345
|
def strata_parts(
|
|
@@ -334,7 +369,14 @@ def strata_parts(
|
|
|
334
369
|
unified = metal.supported(facts) and llm_recipe["runtime"] == "strata-poly"
|
|
335
370
|
need = unified_bytes(llm_recipe) if unified else int(llm_recipe.get("vram_bytes", 0))
|
|
336
371
|
gpu = _suite_gpu(
|
|
337
|
-
facts,
|
|
372
|
+
facts,
|
|
373
|
+
llm_recipe,
|
|
374
|
+
need,
|
|
375
|
+
running_llm,
|
|
376
|
+
options.get("gpu"),
|
|
377
|
+
share_gpu=options["share_gpu"],
|
|
378
|
+
# A shared card: at least what stack apply checks before it starts the LLM.
|
|
379
|
+
free_needed=None if unified else (lambda card: _free_to_plan(llm_recipe, card, options)),
|
|
338
380
|
)
|
|
339
381
|
# Strata's own free margin, the decision model, and its growth.
|
|
340
382
|
reserve = STRATA_FREE_MIB + ((vram + DECISION_VRAM_GROWTH) >> 20) if vram else STRATA_FREE_MIB
|
|
@@ -32,7 +32,7 @@ from localmodels.engines import (
|
|
|
32
32
|
from localmodels.plan_envelope import MODELSCOPE_URL, PlanError
|
|
33
33
|
from localmodels.probe import GPU, HostFacts
|
|
34
34
|
from localmodels.records import Plan, ReleaseEngine
|
|
35
|
-
from localmodels.vision import StrataVision
|
|
35
|
+
from localmodels.vision import StrataVision, strata_gpu_mib
|
|
36
36
|
|
|
37
37
|
GIB = 1 << 30
|
|
38
38
|
# Engines that keep a MoE model's experts in host RAM beside a GPU cache: Strata, and PolyStrata's
|
|
@@ -232,6 +232,15 @@ def unbounded(plan: Plan) -> Plan:
|
|
|
232
232
|
return plan
|
|
233
233
|
|
|
234
234
|
|
|
235
|
+
def gpu_bytes(r: SuiteRecipe, reader: str) -> tuple[int, int]:
|
|
236
|
+
"""``(vram_bytes, min_vram_free_bytes)`` of the recipe's plan with picture reader ``reader``:
|
|
237
|
+
a reader on the GPU adds its VRAM to both. The floor is 0 when the recipe sets none; for
|
|
238
|
+
PolyStrata ``vram_bytes`` is the expert cache's ceiling and the floor the least it starts in."""
|
|
239
|
+
added = strata_gpu_mib(r.get("vision") or {}, reader) << 20
|
|
240
|
+
floor = int(r.get("min_vram_free_bytes") or 0)
|
|
241
|
+
return int(r.get("vram_bytes", 0)) + added, (floor + added if floor else 0)
|
|
242
|
+
|
|
243
|
+
|
|
235
244
|
def bounded_ram(part: Plan) -> int:
|
|
236
245
|
"""What a bounded service may hold before the kernel reclaims from it: MemoryHigh, else
|
|
237
246
|
MemoryMax, else the recipe's estimate."""
|