@simplexai/localmodels-darwin-x64 0.1.0-dev.101 → 0.1.0-dev.102
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.dev101.dist-info → simplex_localmodels-0.1.0.dev102.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev101.dist-info → simplex_localmodels-0.1.0.dev102.dist-info}/RECORD +17 -17
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/{simplex_localmodels-0.1.0.dev101.dist-info → simplex_localmodels-0.1.0.dev102.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev101.dist-info → simplex_localmodels-0.1.0.dev102.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev101.dist-info → simplex_localmodels-0.1.0.dev102.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev101.dist-info → simplex_localmodels-0.1.0.dev102.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
package/bootstrap.identity
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
darwin-x64
|
|
1
|
+
darwin-x64 d4c3de858b2de935d7899649c74b094f215388f2 0.1.0.dev102 python/bin/python3.12 modules
|
package/bootstrap.sha256
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
9682ac57834a6f1e3b4a2cc2a1d87adaf8dcc4833e540da0f9d14536ddc1a586 bootstrap.identity
|
|
2
2
|
15f49306ae54bb208f5a65763f59522a9193d5b01b31279c9bab116bba7ffe5c kit.py
|
|
3
3
|
821556e6336796450ab852d375117b48a4887e71d255794fd6318d99982a5ab6 modules/localmodels/HERMES-LICENSE
|
|
4
|
-
|
|
4
|
+
f016fb5a06ae56169487dfaf37daa2fc4850b1ab6d1fcbb57dbe45f4fe6f31d9 modules/localmodels/__init__.py
|
|
5
5
|
549aef8a0466450ebce8eb1e99ad7a775b72abc1775984a2d9f2fb73af59cb17 modules/localmodels/__main__.py
|
|
6
|
-
|
|
6
|
+
64f260c9e60950e607bcf17342c9d30148480c5e4e6bbcd8f050ed1058f42637 modules/localmodels/app.py
|
|
7
7
|
57a4799a2a94ce5af4d8834e1d35b599ab5de8ab1ab168c38ffcc3662e76f9db modules/localmodels/apple_sensors.py
|
|
8
8
|
9c5c9e0e9c919fae39e858f36e6ac68bb14e6ba017e23c7219558b8b0bf03511 modules/localmodels/approval.py
|
|
9
9
|
53cbc910a97afb9080574b7bf5967067302b0678178a3948d7303fbe657b79a0 modules/localmodels/asr_audio.py
|
|
@@ -45,7 +45,7 @@ dd13deb64712d7e741f01e77c5ffb49abb14c093db7d36a01331300db65d811d modules/localm
|
|
|
45
45
|
e8ffe3b5f3f43ebdbdd2929bca04efc9bd2ad76ca93126ce4626a539fc054fea modules/localmodels/engine_adapters/base.py
|
|
46
46
|
9bd5ff65fc068d7cff951a567c621538f43a5687ad1ceb0c54b030b93877e831 modules/localmodels/engine_adapters/llama_cpp.py
|
|
47
47
|
3224c2fd59b79bc96bdf70d365da5a3c10eb7fb88dce4c22abc6be66c0e7df2e modules/localmodels/engine_adapters/strata_poly.py
|
|
48
|
-
|
|
48
|
+
077dd6454f6803f4ee41aa932f9ab789f4599494c87ba1ec287bce1df1119165 modules/localmodels/engine_adapters/suite_plan.py
|
|
49
49
|
aeb8effc1fa087752aee4b71be5133fc999cb3b15a0b11429fa5a24f61e5a9b3 modules/localmodels/engines-b11583.json
|
|
50
50
|
86452ddba54584c9bc7ea88fdf591afb0057fa069879ea9a7870a0e35d2acbe4 modules/localmodels/engines-b12588-mix-c0c3de8.json
|
|
51
51
|
c231f74b276785186e45836d019e59b20d5db4caa71857f523e160d1bca0f130 modules/localmodels/engines-b12757-mix-ef2df21.json
|
|
@@ -178,10 +178,10 @@ bd5e01ab0828816c38a43050058b8f3df888bed4443142f50550bcca542ad72a modules/localm
|
|
|
178
178
|
e7f3bcd7c42c20807f3ea6d514ddb24f41412724c5535efb0ba17a3dfa11129f modules/localmodels/stack_args.py
|
|
179
179
|
e0f592a497a5aa84fa038dcf137a9996bc5eeab2f7903bd8c7f688e1e4649443 modules/localmodels/stack_auto.py
|
|
180
180
|
a154319139d3ef936b847783c623cbc11d6d2bc2e293d063253ca0e36905a1d3 modules/localmodels/stack_aux_gpu.py
|
|
181
|
-
|
|
181
|
+
36e436f01417589d415ac68005c61b9269203ca35c36328beab057cb960b2d89 modules/localmodels/stack_capacity.py
|
|
182
182
|
47ad4323533efe7120cdb53e713623d42b811cdafd04e8cff2fc40f08406b90b modules/localmodels/stack_card.py
|
|
183
183
|
43e1bc67e4742b043d277279dfa0bef5606689905798fe05e4fda716d8eef215 modules/localmodels/stack_cleanup.py
|
|
184
|
-
|
|
184
|
+
57324950f8b9aafa00f3202d97b6eeddc8922a3c2fcd5053da0a88f46ed8bda0 modules/localmodels/stack_cli.py
|
|
185
185
|
378b9a7659a62f2f62394f015646fb304a7be5214eb2a57abfec5dc70aa20ce4 modules/localmodels/stack_compose.py
|
|
186
186
|
12f26eaa9cd77f5daad227753f4563db6309cd249487505977f20ee0b473b7c3 modules/localmodels/stack_console.py
|
|
187
187
|
acec8b592b1a8ef0dd2d6cafd7c06cf1fa7ea22e00b37925d3756f2cb25c9f7b modules/localmodels/stack_debug.py
|
|
@@ -190,7 +190,7 @@ b85c24eab286182a810afad9190f8f9d8896921f6eae7d86cfe960cee7f89cb3 modules/localm
|
|
|
190
190
|
2316e0ca811f224d96df811d822425a891de2703e8eeb759c9b92bf21f498c6d modules/localmodels/stack_down.py
|
|
191
191
|
ab71bc39c82cd9d1e8bed0c3b2c8643bec6fee5a26688b433bbfce996a5b31e3 modules/localmodels/stack_events.py
|
|
192
192
|
559fa61918b3c49f9e141ffb69b9d6cca2f3568acbecfa6935e7f6a7f6369c06 modules/localmodels/stack_gpu_memory.py
|
|
193
|
-
|
|
193
|
+
d8c97f5968ff5e83eaf78372e2d949d788b5751236c15fc606e1cdc1d9240d18 modules/localmodels/stack_hardware.py
|
|
194
194
|
0826b2c52d5e5c8f17862df79e598794db5ecfb8f73ef2e2757abf6f782854e4 modules/localmodels/stack_hardware_text.py
|
|
195
195
|
8e1c51ca353f4544ea52b7719290b3533d372308edb74adfdba956b5c4e2755d modules/localmodels/stack_journal.py
|
|
196
196
|
ea63d55aaa1fd132c269a0c6d0b8690a59f3834e47b5348865f45ae4012d620d modules/localmodels/stack_ledger.py
|
|
@@ -199,10 +199,10 @@ d456ebefdd1edbe4fcaab887091e007b2209893addeceac1bae5b67a7a4aa6e6 modules/localm
|
|
|
199
199
|
1b4d718a9a18f2248ee0a49a7e5287e3d45264056f92ea01763c9d19c1c32c5b modules/localmodels/stack_memory.py
|
|
200
200
|
0cd25bf8f69628b1611acebe8500939e27191232a82d2f6216a40cd657aa1744 modules/localmodels/stack_mlx.py
|
|
201
201
|
0fe08a97489f2f482afd7d433bcb569bc7c03b8c2ec228a2b91f4478569578a0 modules/localmodels/stack_picks.py
|
|
202
|
-
|
|
202
|
+
96c0ff1816013c9c868d0d91ba2195068590a232f30631ebf195ea13aa84039f modules/localmodels/stack_plan.py
|
|
203
203
|
f8ba5178a31fc6ed1cbb2ebfda90c3cfc3dbe01215a5c1068495caddc6852104 modules/localmodels/stack_ports.py
|
|
204
204
|
466aa0eeb2f2aa452799335aea8c3660e11f54176297ed634c252a9cc2e5d211 modules/localmodels/stack_preflight.py
|
|
205
|
-
|
|
205
|
+
463fa643b43441a1a8b067e4480473b2dd2e7740129cec399e052dd89750d28a modules/localmodels/stack_progress.py
|
|
206
206
|
75b4ec9c937d9de4aa235c5119404f20c08c6f141937ee8049a30fa990669083 modules/localmodels/stack_remove.py
|
|
207
207
|
c6f7548a090b4b508b11460ab61d1665ba5be1595b44ba47c32ad46b0f4ac200 modules/localmodels/stack_research.py
|
|
208
208
|
4be035bd46217a6efadd9968ce5202eaef1ffe301862077cb3a41f4803e5b6b6 modules/localmodels/stack_research_demo.py
|
|
@@ -210,8 +210,8 @@ eb776cbdf6ec5ba36954c35f9b41725bb4cf6b63af4a362621cde6210b864b74 modules/localm
|
|
|
210
210
|
484b4a49e7f0024c1898909d861e22bc2b08403e7a5ecf170992b2a711020ecf modules/localmodels/stack_review.py
|
|
211
211
|
98fda2c42da645e6a81fbf56dd10331baf74c142abf9ea5b68021f3b93e3a228 modules/localmodels/stack_rollback.py
|
|
212
212
|
21b8d7f8cea7e871e53d71602a874f2b568c519b7dbc6856a2b4438dd6b9320a modules/localmodels/stack_route.py
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
10e04e3155167f9c3988be1354cee7b0a80fa6506181903ec0013c49562e65c2 modules/localmodels/stack_run.py
|
|
214
|
+
87cfbe2f803f53072a86eb71ec6291e186689a1427eb6684f261d94eaac8f60a modules/localmodels/stack_suite.py
|
|
215
215
|
3e3b4c1f12eb1b76a43ee0f166421561651e658d53c12ca7fb61e0d0433e21a9 modules/localmodels/stack_summary.py
|
|
216
216
|
9f595f41da91f05d42f8d725d1f2a06d6425de80c3596355f03591200c33f240 modules/localmodels/stack_try.py
|
|
217
217
|
42deb0e0495b35165b73319fcf6d744994a68bd67f9e33409913fd3dd9dcab25 modules/localmodels/stack_try_client.py
|
|
@@ -246,7 +246,7 @@ aa2496ee31f531000907de70ff117909d24c07d989b7315d429a648350a97eba modules/localm
|
|
|
246
246
|
94158929dcf13d1e189b8e552ae3f646fc484767e4d47eecf2c37cbf47130816 modules/localmodels/strata-poly-serve-0.2.20-poly.1.txt
|
|
247
247
|
6786a3355e2c7ec870e2169091a0fb0173f55d049d0defe3e7479dacf5e5c5b4 modules/localmodels/strata-poly-serve-0.2.20-poly.7.txt
|
|
248
248
|
c9a84cfa4e4dfad81510fc6f111c7db76929d566cd96c49fafdc5f8e5447f5b1 modules/localmodels/strata_poly_server.py
|
|
249
|
-
|
|
249
|
+
eac89deb9eb8801567fea5e75ffbc32d399b632293f2177b9588251f8a113fe3 modules/localmodels/suite.py
|
|
250
250
|
02a53037a7010566090c87c603b703bca439ed85c1700717103eaaaea995e00f modules/localmodels/telemetry_math.py
|
|
251
251
|
22be2d2d6303c7714503bbe72d5d4788eb070b9939f6ec81ebd947eb45f53f8b modules/localmodels/tool_archive.py
|
|
252
252
|
8bc52a5fe5e6eeadfc83cba2ebdffde78453cbab1208a971b8e8cb67c6ccbdbb modules/localmodels/tools.json
|
|
@@ -278,13 +278,13 @@ e6356d972d86a3f3fee7b31714021e50670d2be9327f1c6d1a26529fdec048a1 modules/localm
|
|
|
278
278
|
5b301ed9ff864d51669e133a1175eb4d5661db47eb857eccb2497fbc0d7f79bf modules/localmodels/web/view/view.js
|
|
279
279
|
84535ea1c54aeb68bfbfbe357b7f19e7a2d69b9ce9ff2f4f7e8b6a668f76eb3f modules/localmodels/win_probe.py
|
|
280
280
|
d3be4542d9b3f32a61bc65cc4264a74301b0eab6f302a30f43e878e9e9b228d6 modules/localmodels/windows_job.py
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
d5d0ff1a812a108c50ed59eb504c60763fde1316386f85207d1d2206518a55a7 modules/simplex_localmodels-0.1.0.
|
|
284
|
-
3a3059212ac60178113110eaaeafa6dbafe72c598d64d3616cbb498ae9c881f7 modules/simplex_localmodels-0.1.0.
|
|
285
|
-
aca894c2cf6b3e08b8ccb7290297db7160d31a396be6d3151046792e4ac81b97 modules/simplex_localmodels-0.1.0.
|
|
286
|
-
821556e6336796450ab852d375117b48a4887e71d255794fd6318d99982a5ab6 modules/simplex_localmodels-0.1.0.
|
|
287
|
-
|
|
281
|
+
106e334568060699858bfc59940624d91262d71cbdab9aabf30fb28ad216616b modules/simplex_localmodels-0.1.0.dev102.dist-info/METADATA
|
|
282
|
+
6c5e1ef45c583811a01c2acbe9c0f1302698092d55c8021c0688bf339028d1d6 modules/simplex_localmodels-0.1.0.dev102.dist-info/RECORD
|
|
283
|
+
d5d0ff1a812a108c50ed59eb504c60763fde1316386f85207d1d2206518a55a7 modules/simplex_localmodels-0.1.0.dev102.dist-info/WHEEL
|
|
284
|
+
3a3059212ac60178113110eaaeafa6dbafe72c598d64d3616cbb498ae9c881f7 modules/simplex_localmodels-0.1.0.dev102.dist-info/entry_points.txt
|
|
285
|
+
aca894c2cf6b3e08b8ccb7290297db7160d31a396be6d3151046792e4ac81b97 modules/simplex_localmodels-0.1.0.dev102.dist-info/licenses/NOTICE
|
|
286
|
+
821556e6336796450ab852d375117b48a4887e71d255794fd6318d99982a5ab6 modules/simplex_localmodels-0.1.0.dev102.dist-info/licenses/localmodels/HERMES-LICENSE
|
|
287
|
+
ca3f107e2df8be0d8a16be59d6f43d7ee027f50a352b3a4574b3644e974cde47 package.json
|
|
288
288
|
4a13fa8745de2aaf0cc8867ef3ecc9de1a4a8c5ad932471bca81931a92a457de python/bin/python3.12
|
|
289
289
|
3b2f81fe21d181c499c59a256c8e1968455d6689d269aa85373bfb6af41da3bf python/lib/python3.12/LICENSE.txt
|
|
290
290
|
981d4c398849f9ebcab72300d9c1fe288fd6d7f28957b3b3fa3a493a5836d95c python/lib/python3.12/__future__.py
|
|
@@ -1375,4 +1375,4 @@ ac7fb403e4371d07482ef2fda81dbcf6879484e9fc41d4be42c156d7e54c68a8 python/lib/pyt
|
|
|
1375
1375
|
67deaf0ba41aa4865e007297677207485a89b75629eea0ee5c472be8a3e83bf6 python/lib/python3.12/zoneinfo/_common.py
|
|
1376
1376
|
5dc473af6f6ae35e5531cc9705a1e4923aa07e7d35f6b4c275b90c6a3c2591c4 python/lib/python3.12/zoneinfo/_tzpath.py
|
|
1377
1377
|
ebb9b679519a23252eb90541003a2fdbb3f2d7bc36713fd70672baa575dcdcb6 python/lib/python3.12/zoneinfo/_zoneinfo.py
|
|
1378
|
-
|
|
1378
|
+
22a68b59a74cae227f56f039d353a39e0e1dfdbbbf2e635599d95a73d14f27e1 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)
|
|
@@ -144,6 +144,7 @@ def apply_cli(
|
|
|
144
144
|
plan_id=plan_id,
|
|
145
145
|
attempt_id=attempt_ids[-1] if attempt_ids else None,
|
|
146
146
|
cause=stack_run.cause_of(exc, started=bool(attempt_ids)),
|
|
147
|
+
counts=stack_run.cause_counts(exc),
|
|
147
148
|
)
|
|
148
149
|
|
|
149
150
|
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
|
|
|
@@ -130,8 +130,29 @@ class StackReplanError(StackGuardError, PlanError):
|
|
|
130
130
|
"""A guarded rebuild still satisfies the existing PlanError catch contract."""
|
|
131
131
|
|
|
132
132
|
|
|
133
|
+
class VramShortError(StackGuardError):
|
|
134
|
+
"""Too little free VRAM to start an approved GPU part; carries only the two byte counts."""
|
|
135
|
+
|
|
136
|
+
def __init__(self, message: str, *, free_bytes: int, required_bytes: int) -> None:
|
|
137
|
+
super().__init__(
|
|
138
|
+
message,
|
|
139
|
+
cause_code="STACK_VRAM_INSUFFICIENT",
|
|
140
|
+
public_message="free VRAM is too low to start the model; close programs that use "
|
|
141
|
+
"the GPU and retry",
|
|
142
|
+
)
|
|
143
|
+
self.free_bytes = free_bytes
|
|
144
|
+
self.required_bytes = required_bytes
|
|
145
|
+
|
|
146
|
+
|
|
133
147
|
def guard_details(exc: BaseException) -> dict[str, object]:
|
|
134
148
|
"""Project only typed guard metadata; the lower event layer validates its values."""
|
|
149
|
+
if isinstance(exc, VramShortError):
|
|
150
|
+
return {
|
|
151
|
+
"causeCode": exc.cause_code,
|
|
152
|
+
"changedFields": exc.changed_fields,
|
|
153
|
+
"freeBytes": exc.free_bytes,
|
|
154
|
+
"requiredBytes": exc.required_bytes,
|
|
155
|
+
}
|
|
135
156
|
if isinstance(exc, StackGuardError):
|
|
136
157
|
return {"causeCode": exc.cause_code, "changedFields": exc.changed_fields}
|
|
137
158
|
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"]
|
|
@@ -470,6 +471,10 @@ CAUSES = {
|
|
|
470
471
|
"STACK_REPLAN_FAILED": "planning again from this computer's current state failed; "
|
|
471
472
|
"run stack plan again on this computer",
|
|
472
473
|
"STACK_APPLY_LOCKED": "another stack apply is running",
|
|
474
|
+
# Raised before a GPU part starts, also after execution began; free_bytes and
|
|
475
|
+
# required_bytes say by how much.
|
|
476
|
+
"STACK_VRAM_INSUFFICIENT": "free VRAM is too low to start the model; close programs that "
|
|
477
|
+
"use the GPU and retry",
|
|
473
478
|
"STACK_APPLY_INTERRUPTED": "interrupted",
|
|
474
479
|
"STACK_APPLY_REJECTED": "the plan could not be loaded or checked; "
|
|
475
480
|
"run the same command without --json to see why",
|
|
@@ -601,6 +606,10 @@ def component_failure(record: StackRecord) -> tuple[list[str], tuple[str, str]]
|
|
|
601
606
|
return failed, ("STACK_COMPONENT_FAILED", CAUSES["STACK_COMPONENT_FAILED"])
|
|
602
607
|
|
|
603
608
|
|
|
609
|
+
# Guard codes that keep their own cause when raised after execution started.
|
|
610
|
+
_AFTER_START = frozenset({"STACK_VRAM_INSUFFICIENT"})
|
|
611
|
+
|
|
612
|
+
|
|
604
613
|
def cause_of(exc: BaseException, *, started: bool) -> tuple[str, str]:
|
|
605
614
|
"""(cause code, fixed message) for an apply that raised ``exc``: a guard's own code (and its
|
|
606
615
|
literal public sentence when it has one), else interrupted, failed after starting, or
|
|
@@ -608,13 +617,25 @@ def cause_of(exc: BaseException, *, started: bool) -> tuple[str, str]:
|
|
|
608
617
|
if isinstance(exc, KeyboardInterrupt):
|
|
609
618
|
return "STACK_APPLY_INTERRUPTED", CAUSES["STACK_APPLY_INTERRUPTED"]
|
|
610
619
|
code = getattr(exc, "cause_code", None)
|
|
611
|
-
if isinstance(code, str) and code in CAUSES and not started:
|
|
620
|
+
if isinstance(code, str) and code in CAUSES and (not started or code in _AFTER_START):
|
|
612
621
|
public = getattr(exc, "public_message", "")
|
|
613
622
|
return code, public if isinstance(public, str) and public else CAUSES[code]
|
|
614
623
|
code = "STACK_APPLY_FAILED" if started else "STACK_APPLY_REJECTED"
|
|
615
624
|
return code, CAUSES[code]
|
|
616
625
|
|
|
617
626
|
|
|
627
|
+
def cause_counts(exc: BaseException) -> dict[str, int]:
|
|
628
|
+
"""``free_bytes`` and ``required_bytes`` of a STACK_VRAM_INSUFFICIENT guard, else none."""
|
|
629
|
+
if getattr(exc, "cause_code", None) != "STACK_VRAM_INSUFFICIENT":
|
|
630
|
+
return {}
|
|
631
|
+
counts = stack_progress.byte_counts(guard_details(exc))
|
|
632
|
+
return (
|
|
633
|
+
{"free_bytes": counts["freeBytes"], "required_bytes": counts["requiredBytes"]}
|
|
634
|
+
if counts
|
|
635
|
+
else {}
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
|
|
618
639
|
def machine_result(
|
|
619
640
|
record: StackRecord | None,
|
|
620
641
|
state: str,
|
|
@@ -624,6 +645,7 @@ def machine_result(
|
|
|
624
645
|
attempt_id: str | None = None,
|
|
625
646
|
plan: StackPlan | None = None,
|
|
626
647
|
cause: tuple[str, str] | None = None,
|
|
648
|
+
counts: Mapping[str, int] | None = None,
|
|
627
649
|
) -> int:
|
|
628
650
|
view = project(record, plan)
|
|
629
651
|
if record is not None and (view is None or (state == "completed" and not view["ok"])):
|
|
@@ -662,6 +684,7 @@ def machine_result(
|
|
|
662
684
|
else {}
|
|
663
685
|
),
|
|
664
686
|
**({"cause_code": cause[0], "message": cause[1]} if cause else {}),
|
|
687
|
+
**(counts if cause and counts else {}),
|
|
665
688
|
},
|
|
666
689
|
separators=(",", ":"),
|
|
667
690
|
)
|
|
@@ -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
|
|
@@ -231,6 +231,15 @@ def unbounded(plan: Plan) -> Plan:
|
|
|
231
231
|
return plan
|
|
232
232
|
|
|
233
233
|
|
|
234
|
+
def gpu_bytes(r: SuiteRecipe, reader: str) -> tuple[int, int]:
|
|
235
|
+
"""``(vram_bytes, min_vram_free_bytes)`` of the recipe's plan with picture reader ``reader``:
|
|
236
|
+
a reader on the GPU adds its VRAM to both. The floor is 0 when the recipe sets none; for
|
|
237
|
+
PolyStrata ``vram_bytes`` is the expert cache's ceiling and the floor the least it starts in."""
|
|
238
|
+
added = strata_gpu_mib(r.get("vision") or {}, reader) << 20
|
|
239
|
+
floor = int(r.get("min_vram_free_bytes") or 0)
|
|
240
|
+
return int(r.get("vram_bytes", 0)) + added, (floor + added if floor else 0)
|
|
241
|
+
|
|
242
|
+
|
|
234
243
|
def bounded_ram(part: Plan) -> int:
|
|
235
244
|
"""What a bounded service may hold before the kernel reclaims from it: MemoryHigh, else
|
|
236
245
|
MemoryMax, else the recipe's estimate."""
|