@simplexai/localmodels-win32-x64 0.1.0-dev.103 → 0.1.0-dev.104
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/LICENSE +201 -0
- package/{modules/simplex_localmodels-0.1.0.dev103.dist-info/licenses/NOTICE → NOTICE} +42 -13
- package/README.md +10 -0
- package/bootstrap.identity +1 -1
- package/bootstrap.sha256 +126 -127
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/catalog.json +130 -127
- package/modules/localmodels/catalog.py +7 -3
- package/modules/localmodels/catalog_recipes.py +3 -3
- package/modules/localmodels/cli_parser.py +3 -3
- package/modules/localmodels/component.py +1 -1
- package/modules/localmodels/console.py +1 -1
- package/modules/localmodels/context_policy.py +6 -5
- package/modules/localmodels/debug_cli.py +0 -12
- package/modules/localmodels/debug_mode.py +0 -6
- package/modules/localmodels/decode_calibration.json +3 -4
- package/modules/localmodels/decode_calibration.py +5 -2
- package/modules/localmodels/deployment_lifecycle.py +1 -1
- package/modules/localmodels/download-mirrors.json +1 -1
- package/modules/localmodels/engine_adapters/base.py +11 -1
- package/modules/localmodels/engine_adapters/strata_poly.py +65 -3
- package/modules/localmodels/engine_adapters/suite_plan.py +57 -20
- package/modules/localmodels/engines-b11583.json +6 -26
- package/modules/localmodels/engines-b12588-mix-c0c3de8.json +3 -15
- package/modules/localmodels/engines-b12757-mix-ef2df21.json +3 -15
- package/modules/localmodels/engines-prism-b12178-03ec600.json +3 -15
- package/modules/localmodels/engines-speechcpp-v0.11.3.json +4 -20
- package/modules/localmodels/engines-strata-0.1.47.json +1 -5
- package/modules/localmodels/engines-strata-0.1.49.2.json +1 -5
- package/modules/localmodels/engines-strata-0.1.59.1.json +1 -5
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.1.json +6 -30
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.9.json +129 -0
- package/modules/localmodels/engines-whisper-b5454.json +6 -30
- package/modules/localmodels/engines.json +13 -61
- package/modules/localmodels/estimator.py +10 -5
- package/modules/localmodels/gpu_specs.py +1 -1
- package/modules/localmodels/hosts.py +12 -16
- package/modules/localmodels/kokoro-tts-0.6.1.txt +1 -1
- package/modules/localmodels/library_elastic.py +135 -6
- package/modules/localmodels/library_kept.py +9 -1
- package/modules/localmodels/library_model.py +28 -1
- package/modules/localmodels/library_poly.py +109 -11
- package/modules/localmodels/library_pricing.py +12 -3
- package/modules/localmodels/library_serve.py +134 -67
- package/modules/localmodels/library_smoke.py +63 -5
- package/modules/localmodels/library_state.py +3 -2
- package/modules/localmodels/library_status.py +8 -1
- package/modules/localmodels/llm_rank.py +13 -8
- package/modules/localmodels/metal.py +1 -2
- package/modules/localmodels/plan_envelope.py +29 -11
- package/modules/localmodels/planning/budget.py +14 -12
- package/modules/localmodels/planning/memory_pools.py +7 -1
- package/modules/localmodels/privacy_acceptance.py +6 -5
- package/modules/localmodels/py.typed +0 -0
- package/modules/localmodels/quant_formats.py +1 -1
- package/modules/localmodels/recommend_cli.py +1 -1
- package/modules/localmodels/remote_ops_launchd.py +8 -1
- package/modules/localmodels/runtime_process.py +1 -1
- package/modules/localmodels/service_deployment.py +2 -4
- package/modules/localmodels/service_probe.py +59 -13
- package/modules/localmodels/setup_inspection.py +72 -70
- package/modules/localmodels/setup_text.py +7 -56
- package/modules/localmodels/sidecar_downloads.py +34 -0
- package/modules/localmodels/sidecar_http.py +61 -5
- package/modules/localmodels/sidecar_state.py +52 -2
- package/modules/localmodels/speech_admission.py +20 -4
- package/modules/localmodels/speech_catalog.py +23 -0
- package/modules/localmodels/speech_cli.py +10 -2
- package/modules/localmodels/speech_jobs.py +42 -17
- package/modules/localmodels/speech_server.py +182 -81
- package/modules/localmodels/speech_state.py +4 -1
- package/modules/localmodels/speech_workers.py +11 -0
- package/modules/localmodels/stack.py +1 -1
- package/modules/localmodels/stack_args.py +6 -6
- package/modules/localmodels/stack_auto.py +1 -1
- package/modules/localmodels/stack_aux_gpu.py +1 -1
- package/modules/localmodels/stack_cleanup.py +21 -18
- package/modules/localmodels/stack_cli.py +6 -2
- package/modules/localmodels/stack_compose.py +11 -4
- package/modules/localmodels/stack_debug.py +1 -2
- package/modules/localmodels/stack_decision.py +4 -4
- package/modules/localmodels/stack_doctor.py +2 -2
- package/modules/localmodels/stack_events.py +1 -1
- package/modules/localmodels/stack_gpu_memory.py +1 -1
- package/modules/localmodels/stack_hardware.py +3 -3
- package/modules/localmodels/stack_mcp.py +1 -2
- package/modules/localmodels/stack_picks.py +1 -1
- package/modules/localmodels/stack_plan.py +9 -9
- package/modules/localmodels/stack_ports.py +31 -4
- package/modules/localmodels/stack_rollback.py +1 -1
- package/modules/localmodels/stack_run.py +1 -1
- package/modules/localmodels/stack_suite.py +61 -12
- package/modules/localmodels/stack_view_agent.py +1 -1
- package/modules/localmodels/stack_view_serve.py +0 -2
- package/modules/localmodels/stack_view_words.py +2 -2
- package/modules/localmodels/stack_warm.py +2 -2
- package/modules/localmodels/stack_whatif.py +524 -41
- package/modules/localmodels/stack_whatif_html.py +903 -0
- package/modules/localmodels/startlux-decide-83fe6c7d.txt +2 -2
- package/modules/localmodels/{strata-poly-serve-0.2.20-poly.7.txt → strata-poly-serve-0.2.20-poly.9.txt} +1 -1
- package/modules/localmodels/strata_poly_server.py +114 -3
- package/modules/localmodels/suite.py +137 -5
- package/modules/localmodels/tts_admission.py +2 -17
- package/modules/localmodels/tts_catalog.py +29 -1
- package/modules/localmodels/tts_cli.py +23 -4
- package/modules/localmodels/tts_http.py +10 -4
- package/modules/localmodels/tts_jobs.py +49 -19
- package/modules/localmodels/tts_server.py +1 -1
- package/modules/localmodels/tts_sidecar.py +66 -28
- package/modules/localmodels/tts_state.py +7 -2
- package/modules/localmodels/vision.py +5 -3
- package/modules/localmodels/web/view/ASSET-SOURCES.md +4 -7
- package/modules/localmodels/web/view/view.css +0 -1
- package/modules/localmodels/web/view/view.js +2 -5
- package/modules/localmodels/web/whatif/app.js +730 -0
- package/modules/localmodels/web/whatif/page.html +1172 -0
- package/modules/localmodels/web/whatif/sim.js +303 -0
- package/modules/localmodels/windows_job.py +179 -11
- package/modules/simplex_localmodels-0.1.0.dev104.dist-info/METADATA +14 -0
- package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/RECORD +118 -114
- package/modules/simplex_localmodels-0.1.0.dev104.dist-info/licenses/LICENSE +201 -0
- package/modules/simplex_localmodels-0.1.0.dev104.dist-info/licenses/NOTICE +126 -0
- package/package.json +11 -2
- package/tool.json +1 -1
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.7.json +0 -94
- package/modules/localmodels/fixtures/stack-research-demo-plan.json +0 -1059
- package/modules/localmodels/stack_research.py +0 -716
- package/modules/localmodels/stack_research_demo.py +0 -125
- package/modules/localmodels/stack_research_plan.py +0 -146
- package/modules/localmodels/web/index.html +0 -2605
- package/modules/localmodels/web/sizecalc/app.js +0 -1306
- package/modules/localmodels/web/sizecalc/calc.js +0 -269
- package/modules/localmodels/web/sizecalc/page.html +0 -520
- package/modules/localmodels/web/view/logo-claude.svg +0 -3
- package/modules/localmodels/web/view/logo-codex.png +0 -0
- package/modules/simplex_localmodels-0.1.0.dev103.dist-info/METADATA +0 -9
- /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev103.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -36,6 +36,7 @@ from localmodels import (
|
|
|
36
36
|
stack_view_hub_cli,
|
|
37
37
|
stack_warm,
|
|
38
38
|
stack_whatif,
|
|
39
|
+
stack_whatif_html,
|
|
39
40
|
)
|
|
40
41
|
from localmodels import stack_decision as decide
|
|
41
42
|
from localmodels import stack_doctor as day2_mod
|
|
@@ -84,9 +85,9 @@ def _hardware(facts: HostFacts | None, as_json: bool, unified_memory: str | None
|
|
|
84
85
|
_WAITS = {
|
|
85
86
|
"status": "Reading each deployment's state and health check…",
|
|
86
87
|
"verify": "Sending acceptance requests to the running stack…",
|
|
87
|
-
"doctor": "Checking services, ports,
|
|
88
|
+
"doctor": "Checking services, ports, GPU memory and disk…",
|
|
88
89
|
"up": "Starting services that are not running and waiting for health checks…",
|
|
89
|
-
"down": "Stopping the
|
|
90
|
+
"down": "Stopping the stack's services…",
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
|
|
@@ -220,6 +221,7 @@ _PLAN_ERROR_CODES = frozenset(
|
|
|
220
221
|
"DISK_INSUFFICIENT",
|
|
221
222
|
"GPU_CONFLICT",
|
|
222
223
|
"PORT_PROBE_FAILED",
|
|
224
|
+
"PORTS_IN_USE",
|
|
223
225
|
}
|
|
224
226
|
)
|
|
225
227
|
_SAFE_HOST = re.compile(r"^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?(?::[0-9]{1,5})?$")
|
|
@@ -286,6 +288,8 @@ def run_cli(
|
|
|
286
288
|
if args.stack_command == "memory":
|
|
287
289
|
return stack_memory.cli(args)
|
|
288
290
|
if args.stack_command == "what-if":
|
|
291
|
+
if getattr(args, "html", None):
|
|
292
|
+
return stack_whatif_html.cli_html(args)
|
|
289
293
|
return stack_whatif.cli(args)
|
|
290
294
|
facts = (
|
|
291
295
|
decode(json.loads(args.facts.read_text(encoding="utf-8")), HostFacts)
|
|
@@ -47,7 +47,7 @@ from localmodels import stack_gpu_memory as gpu_memory
|
|
|
47
47
|
from localmodels import stack_hardware as hardware
|
|
48
48
|
from localmodels.approval import digest
|
|
49
49
|
from localmodels.context_policy import AGENT, AgentPosture, posture_for, window_k
|
|
50
|
-
from localmodels.plan_envelope import PlanError, require_free_port, utc_now
|
|
50
|
+
from localmodels.plan_envelope import PlanError, ports_assumed_free, require_free_port, utc_now
|
|
51
51
|
from localmodels.planning import llm_ram
|
|
52
52
|
from localmodels.planning.budget import gib, host_ram
|
|
53
53
|
from localmodels.probe import HostFacts
|
|
@@ -117,6 +117,10 @@ def _native_owned(plan: Plan, port: int) -> bool:
|
|
|
117
117
|
return False
|
|
118
118
|
|
|
119
119
|
|
|
120
|
+
def _no_listener(_port: int) -> bool:
|
|
121
|
+
return False
|
|
122
|
+
|
|
123
|
+
|
|
120
124
|
def compose(
|
|
121
125
|
facts: HostFacts,
|
|
122
126
|
options: StackOptions,
|
|
@@ -137,9 +141,12 @@ def compose(
|
|
|
137
141
|
) -> StackPlan:
|
|
138
142
|
"""The whole-stack plan from facts read now. Pure apart from the Hub lookups in resolver and
|
|
139
143
|
the local lookups each keyword stands for (tests replace them); who holds a GPU comes from
|
|
140
|
-
the facts' service discovery alone, so saved facts price the host they describe.
|
|
144
|
+
the facts' service discovery alone, so saved facts price the host they describe. Under
|
|
145
|
+
plan_envelope.assume_ports_free no port is in use."""
|
|
141
146
|
options = options.copy()
|
|
142
147
|
owned_ram = cache(owned_ram)
|
|
148
|
+
if ports_assumed_free():
|
|
149
|
+
listening = _no_listener
|
|
143
150
|
stack_route.validate(options, facts)
|
|
144
151
|
if error := platform_error(facts["platform"], options.get("profile"), facts["arch"]):
|
|
145
152
|
raise StackError(error)
|
|
@@ -299,7 +306,7 @@ def _llama_quality(
|
|
|
299
306
|
|
|
300
307
|
def agent_posture(options: StackOptions) -> AgentPosture:
|
|
301
308
|
"""The stack's agent posture with the operator's slot count. One slot is allowed since
|
|
302
|
-
|
|
309
|
+
default policy (the smartest model does not have to serve two requests at once);
|
|
303
310
|
``--prefer concurrent`` keeps decision 13's two. Images are on unless the plan says
|
|
304
311
|
otherwise (decision 31); a plan saved before ``--vision`` existed stays text-only. The
|
|
305
312
|
thinking cap and ``--context``'s window ceiling come from the plan (decision 37)."""
|
|
@@ -459,7 +466,7 @@ def _llama_parts(
|
|
|
459
466
|
its full size, the LLM is planned again without it (``draft=False``)."""
|
|
460
467
|
posture = agent_posture(options)
|
|
461
468
|
if min_prompt_cache or not draft:
|
|
462
|
-
#
|
|
469
|
+
# Capacity plans for blocked-now hosts price minimum required RAM, not
|
|
463
470
|
# optional accelerators that greedily expand into synthetic idle memory.
|
|
464
471
|
posture = replace(posture, draft="off")
|
|
465
472
|
aux_notes: list[str] = []
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
``stack plan`` normally chooses these itself (the agent posture's KV order, the catalog entry's
|
|
4
4
|
last variant). For local testing and debugging an operator may pin them; the window and the
|
|
5
|
-
thinking cap are product options already (``--context``, ``--reasoning-budget
|
|
6
|
-
decision 37). The overrides are plan options, so the approval id binds them and
|
|
5
|
+
thinking cap are product options already (``--context``, ``--reasoning-budget``). The overrides are plan options, so the approval id binds them and
|
|
7
6
|
``stack apply`` re-plans with them; they are still priced: a pinned KV pair or variant that does
|
|
8
7
|
not fit is refused, never lowered or spilled. They need ``--llm`` naming a llama.cpp model:
|
|
9
8
|
``auto`` might pick a Strata recipe, which has its own launch, and naming the model keeps the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Which decision model the stack runs, and on which card.
|
|
2
2
|
|
|
3
|
-
A decision model only runs on a GPU
|
|
3
|
+
A decision model only runs on a GPU. In the llama.cpp branch ``choose`` ranks every
|
|
4
4
|
catalog model's measured tiers by quality inside the decision VRAM budget and takes the best one
|
|
5
5
|
with which the LLM, priced again with that VRAM held back, neither spills nor loses window. An
|
|
6
6
|
explicit ``--decision-vram`` takes the best tier in that budget as it is, spill included. The plan
|
|
@@ -106,7 +106,7 @@ def priced(facts: HostFacts, card: GPU, reserve: int, llm: Plan, price_llm: Pric
|
|
|
106
106
|
def keeps(llm: Plan, again: Plan) -> bool:
|
|
107
107
|
"""The re-priced LLM still runs beside the tier. In agent posture an optional decision
|
|
108
108
|
model may not cost the LLM its preferred window (128K, or what it reached alone when that
|
|
109
|
-
was less), its slots or its MTP (
|
|
109
|
+
was less), its slots or its MTP (the LLM is the product, the decision
|
|
110
110
|
model an add-on); a default plan keeps the old rule — no spill and no lost window."""
|
|
111
111
|
if again["launch"].get("posture") == "agent":
|
|
112
112
|
# MTP, where the LLM had it alone, is part of what a tier may not take away: the
|
|
@@ -615,7 +615,7 @@ def listing() -> str:
|
|
|
615
615
|
lines.append(
|
|
616
616
|
"Decision models only run on a GPU, on the LLM's card; stack plan picks by measured "
|
|
617
617
|
"quality by default, --decision <id> picks another, --decision-vram <GiB> sets the VRAM "
|
|
618
|
-
"budget.
|
|
618
|
+
"budget. Reference timings measured on an RTX 4090 D"
|
|
619
619
|
)
|
|
620
620
|
return "\n".join(lines)
|
|
621
621
|
|
|
@@ -705,7 +705,7 @@ def add_arguments(plan: argparse._ActionsContainer) -> None:
|
|
|
705
705
|
action=cli_help.ComponentSelection,
|
|
706
706
|
default="none",
|
|
707
707
|
metavar="ID|auto|none",
|
|
708
|
-
help="optional decision model: none (
|
|
708
|
+
help="optional decision model: none (default: only the "
|
|
709
709
|
"LLM is installed), an id from `stack decisions`, or auto (highest measured quality on "
|
|
710
710
|
"the LLM's card, any license; the plan lists the others as options)",
|
|
711
711
|
)
|
|
@@ -153,7 +153,7 @@ def _service(component: str, part: Plan) -> Finding:
|
|
|
153
153
|
plan = record["plan"]
|
|
154
154
|
row = lifecycle.status_rows([record])[0]
|
|
155
155
|
port, log = plan["service"]["port"], f"{plan['service']['deploy_dir']}/server.log"
|
|
156
|
-
if row["state"]
|
|
156
|
+
if deployment_lifecycle.healthy(row["state"], row["health"]):
|
|
157
157
|
return finding(check, "pass", f"{name} running, 127.0.0.1:{port} health {row['health']}")
|
|
158
158
|
if row["state"] == "active" and row["health"] == "loading":
|
|
159
159
|
return finding(
|
|
@@ -295,7 +295,7 @@ def _proxy(env: dict[str, str]) -> Finding | None:
|
|
|
295
295
|
"host.proxy",
|
|
296
296
|
"warn",
|
|
297
297
|
f"{', '.join(names)} set, but NO_PROXY lacks 127.0.0.1 and localhost: "
|
|
298
|
-
"clients may reach the local
|
|
298
|
+
"clients may reach the local model servers through the proxy",
|
|
299
299
|
'export NO_PROXY="127.0.0.1,localhost${NO_PROXY:+,$NO_PROXY}" (add it to your shell profile)',
|
|
300
300
|
)
|
|
301
301
|
|
|
@@ -50,7 +50,7 @@ COMPONENTS = frozenset(
|
|
|
50
50
|
)
|
|
51
51
|
STEPS = frozenset({"engine", "download", "install", "start", "verify"})
|
|
52
52
|
PHASES = frozenset({"download", "verify", "loading"})
|
|
53
|
-
# Safe, closed-set public sub-reasons for a failing stack component
|
|
53
|
+
# Safe, closed-set public sub-reasons for a failing stack component:
|
|
54
54
|
# never raw stderr, paths, hostnames, or exception text.
|
|
55
55
|
COMPONENT_REASON_CODES = frozenset(
|
|
56
56
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""``--gpu-memory``: price a plan as if its card had at most this much free memory, so several
|
|
2
|
-
stacks can each take a share of one large card
|
|
2
|
+
stacks can each take a share of one large card."""
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -47,7 +47,7 @@ from localmodels.stack_plan import (
|
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
GIB = 1 << 30
|
|
50
|
-
TIERS_GIB = (8, 12, 16, 24, 32, 48, 96)
|
|
50
|
+
TIERS_GIB = (8, 12, 16, 24, 32, 48, 96)
|
|
51
51
|
_NOMINAL_SLACK = 1.1 # a 24 GB card reports 22.5–24 GiB; an 80 GB one is not a 96 GB card
|
|
52
52
|
_FIRST_TIER_RAM = 60 * GIB # 64 GB of RAM reads about 62 GiB
|
|
53
53
|
# ``--unified-memory`` when the option is not given: a front-end that runs this tool (the Simplex
|
|
@@ -151,7 +151,7 @@ def slow_advisory(facts: HostFacts, llm: Plan) -> str | None:
|
|
|
151
151
|
def cards(facts: HostFacts, gpu: int | None = None, *, share_gpu: bool = False) -> list[int]:
|
|
152
152
|
"""Single-card choices by free memory. A card with foreign GPU work needs explicit sharing;
|
|
153
153
|
with it, who else uses the card, known or not, does not matter: the free memory decides,
|
|
154
|
-
with the usual margins
|
|
154
|
+
with the usual margins."""
|
|
155
155
|
if metal.device(facts) is not None:
|
|
156
156
|
if gpu not in (None, 0):
|
|
157
157
|
raise StackError(f"this computer has one Metal GPU (GPU 0), no GPU {gpu}")
|
|
@@ -182,7 +182,7 @@ def check_shared_start(
|
|
|
182
182
|
part: Plan, facts: HostFacts, *, options: StackOptions | None = None
|
|
183
183
|
) -> None:
|
|
184
184
|
"""Recheck free VRAM before starting. Shared or not, an unknown owner of other GPU work no
|
|
185
|
-
longer refuses
|
|
185
|
+
longer refuses: the card's free memory against ``start_need`` decides;
|
|
186
186
|
too little raises VramShortError (STACK_VRAM_INSUFFICIENT)."""
|
|
187
187
|
from localmodels import hosts, stack_lifecycle
|
|
188
188
|
|
|
@@ -158,8 +158,7 @@ TOOLS: tuple[dict[str, Any], ...] = (
|
|
|
158
158
|
),
|
|
159
159
|
_tool_def(
|
|
160
160
|
"stack_status",
|
|
161
|
-
"Read-only status of local stack deployments, owned manifest, latest "
|
|
162
|
-
"apply run, gateway wiring, and observed gateway speed.",
|
|
161
|
+
"Read-only status of local stack deployments, owned manifest, and latest apply run.",
|
|
163
162
|
{},
|
|
164
163
|
),
|
|
165
164
|
)
|
|
@@ -8,7 +8,7 @@ pick is returned when the same model is both, or when the faster one gains less
|
|
|
8
8
|
WORTH_FASTER. Speeds are the catalog's: measured on the same device model where a measurement
|
|
9
9
|
exists, an estimate otherwise (memory bandwidth over the bytes read per token, with no
|
|
10
10
|
speculative decoding); the basis travels with each pick and is printed. An estimate is not a
|
|
11
|
-
bound: with MTP on, Qwen3.8-27B decoded prose faster than its estimate on
|
|
11
|
+
bound: with MTP on, Qwen3.8-27B decoded prose faster than its bandwidth estimate on reference hardware.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
14
|
from __future__ import annotations
|
|
@@ -83,10 +83,10 @@ GIB = 1 << 30
|
|
|
83
83
|
# memory "available" there counts free + inactive + speculative pages, and macOS reclaims beyond
|
|
84
84
|
# it, so Linux's 4 GiB floor held back a second margin. A 24 GiB Mac ran Ling 128K and 64K with
|
|
85
85
|
# pi for 20+ minutes from 8.4–8.9 GB available, pressure 1 and no swap growth, where the 4 GiB
|
|
86
|
-
# floor refused it
|
|
86
|
+
# floor refused it. The live gates stay: a
|
|
87
87
|
# plan needs pressure 1 or 2 (2 keeps a quarter back, metal.pressured) and apply re-probes.
|
|
88
88
|
METAL_RAM_FLOOR = 1 * GIB
|
|
89
|
-
# The thinking cap new plans give the LLM
|
|
89
|
+
# The thinking cap new plans give the LLM. An estimate, not a measurement:
|
|
90
90
|
# the only measured cap is 2,048 (MM64, Ling 3.0 tiny on a 24 GB Mac: basic and long-input checks
|
|
91
91
|
# unchanged); 8,192 is four times that and the whole-reply budget agent clients already send,
|
|
92
92
|
# so a reply that would think without end (14,000 tokens of thinking, no answer, on local-119
|
|
@@ -160,8 +160,8 @@ def guard_details(exc: BaseException) -> dict[str, object]:
|
|
|
160
160
|
|
|
161
161
|
def platform_error(platform: str, profile: str | None = None, arch: str | None = "") -> str | None:
|
|
162
162
|
"""Executable stack recipes, not the controller's ability to inspect a host: Linux, Apple
|
|
163
|
-
Silicon Macs (Metal; an unknown ``arch`` is taken as one), 64-bit Windows (
|
|
164
|
-
|
|
163
|
+
Silicon Macs (Metal; an unknown ``arch`` is taken as one), 64-bit Windows (an unknown
|
|
164
|
+
``arch`` is taken as x64) and the explicit Apple Silicon MLX installation
|
|
165
165
|
preview."""
|
|
166
166
|
if profile == "macos-mlx-preview":
|
|
167
167
|
if platform == "darwin" and arch == "arm64":
|
|
@@ -207,20 +207,20 @@ class _OptionsSince20261022(TypedDict, total=False):
|
|
|
207
207
|
# Since 2026-11-03 (`stack plan --update`): the plan id of the accepted stack this plan
|
|
208
208
|
# updates (stack_update). Absent: a plain plan, which keeps running parts as recorded.
|
|
209
209
|
update: str
|
|
210
|
-
#
|
|
210
|
+
# What ``--llm auto`` optimizes, one of PREFERENCES.
|
|
211
211
|
# Absent: "smartest", the highest installed SimplexAI score that fits.
|
|
212
212
|
prefer: str
|
|
213
|
-
#
|
|
213
|
+
# Where the LLM's picture reader runs, one of
|
|
214
214
|
# vision.READERS ("auto" for new plans). Absent: "off", text-only like every older plan.
|
|
215
215
|
vision: str
|
|
216
216
|
# Since 2026-11-04: price the plan with at most this much free memory on the --gpu card
|
|
217
217
|
# (every NVIDIA card without --gpu); systemd size, e.g. 24G (stack_gpu_memory.capped).
|
|
218
218
|
# Absent: the cards as read.
|
|
219
219
|
gpu_memory: str
|
|
220
|
-
#
|
|
220
|
+
# The LLM's window ceiling in tokens (``--context``;
|
|
221
221
|
# at least the agent floor, 64K). Absent: the largest window that fits, up to 200K.
|
|
222
222
|
context: int
|
|
223
|
-
#
|
|
223
|
+
# The most tokens one reply may think, passed to
|
|
224
224
|
# llama-server's --reasoning-budget and Strata's reasoning_budget_tokens; 0: no cap.
|
|
225
225
|
# Absent: no cap, as every older plan ran.
|
|
226
226
|
reasoning_budget: int
|
|
@@ -232,7 +232,7 @@ class _OptionsSince20261022(TypedDict, total=False):
|
|
|
232
232
|
llm_fast_port: int # resolved when route is enabled, bound by approval
|
|
233
233
|
|
|
234
234
|
|
|
235
|
-
# The scenarios a user picks instead of weights (
|
|
235
|
+
# The scenarios a user picks instead of weights (see docs/local-models/model-scoring-public.md).
|
|
236
236
|
# Since 2026-11-12 (decision 45): fastest, the highest decode speed that fits whatever its score,
|
|
237
237
|
# the second choice `stack` offers beside smartest (stack_picks).
|
|
238
238
|
PREFERENCES = ("smartest", "concurrent", "fast", "fastest")
|
|
@@ -13,7 +13,14 @@ from collections.abc import Callable, Iterator, Sequence
|
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from typing import Literal
|
|
15
15
|
|
|
16
|
-
from localmodels import
|
|
16
|
+
from localmodels import (
|
|
17
|
+
component,
|
|
18
|
+
deploy,
|
|
19
|
+
deployment_lifecycle,
|
|
20
|
+
hosts,
|
|
21
|
+
plan_envelope,
|
|
22
|
+
process_identity_darwin,
|
|
23
|
+
)
|
|
17
24
|
from localmodels.plan_envelope import PlanError
|
|
18
25
|
from localmodels.probe import HostFacts
|
|
19
26
|
from localmodels.records import Plan
|
|
@@ -122,8 +129,22 @@ AUXILIARY_PORTS = {
|
|
|
122
129
|
TTS_PORTS: tuple[int, ...] = (18380, *range(18528, 18560))
|
|
123
130
|
|
|
124
131
|
|
|
132
|
+
PORTS_IN_USE = "PORTS_IN_USE"
|
|
133
|
+
|
|
134
|
+
|
|
125
135
|
class PortUnavailableError(PlanError):
|
|
126
|
-
"""
|
|
136
|
+
"""Every port of a bounded range is known to be in use. Like PortProbeError it says nothing
|
|
137
|
+
about the model being planned; its cause code PORTS_IN_USE tells an installer the hardware
|
|
138
|
+
may still fit once a program frees a port (setup inspect: ``ports-in-use``, blocked-now)."""
|
|
139
|
+
|
|
140
|
+
def __init__(self, message: str) -> None:
|
|
141
|
+
super().__init__(message, cause_code=PORTS_IN_USE)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def ports_in_use(exc: BaseException) -> bool:
|
|
145
|
+
"""Whether ``exc`` refuses a plan only because a whole default port range is in use. The
|
|
146
|
+
cause code survives the PlanError-to-StackError wrapping between the planner's layers."""
|
|
147
|
+
return getattr(exc, "cause_code", None) == PORTS_IN_USE
|
|
127
148
|
|
|
128
149
|
|
|
129
150
|
class PortProbeError(StackError):
|
|
@@ -142,7 +163,10 @@ PortState = Literal["free", "busy", "unknown"]
|
|
|
142
163
|
|
|
143
164
|
def port_state(facts: HostFacts, port: int, listening: Callable[[int], bool]) -> PortState:
|
|
144
165
|
"""Free only on known absence of every observed loopback listener; ``unknown`` when the
|
|
145
|
-
inventory or the probe cannot tell.
|
|
166
|
+
inventory or the probe cannot tell. Every port is free while plan_envelope.assume_ports_free
|
|
167
|
+
holds (setup inspect only)."""
|
|
168
|
+
if plan_envelope.ports_assumed_free():
|
|
169
|
+
return "free"
|
|
146
170
|
if any(service["port"] == port for service in facts.get("llama_servers") or []):
|
|
147
171
|
return "busy"
|
|
148
172
|
services = facts.get("services")
|
|
@@ -259,6 +283,8 @@ def loopback_bindable(port: int) -> bool:
|
|
|
259
283
|
|
|
260
284
|
def loopback_listening(port: int) -> bool:
|
|
261
285
|
"""Keep planning failures typed while sharing the lower-level listener proof."""
|
|
286
|
+
if plan_envelope.ports_assumed_free():
|
|
287
|
+
return False
|
|
262
288
|
seen = _SNAPSHOT.get()
|
|
263
289
|
if seen is not None and port in seen:
|
|
264
290
|
known = seen[port]
|
|
@@ -327,7 +353,8 @@ def llm_port(
|
|
|
327
353
|
"loopback check failed); check again, or pick a port with --llm-port"
|
|
328
354
|
)
|
|
329
355
|
raise StackError(
|
|
330
|
-
"default LLM ports 18100..18131 are all in use; pick a free port with --llm-port"
|
|
356
|
+
"default LLM ports 18100..18131 are all in use; pick a free port with --llm-port",
|
|
357
|
+
cause_code=PORTS_IN_USE,
|
|
331
358
|
)
|
|
332
359
|
|
|
333
360
|
|
|
@@ -166,7 +166,7 @@ def _cards(target: StackPlan, facts: HostFacts, share_gpu: bool) -> list[str]:
|
|
|
166
166
|
)
|
|
167
167
|
# Metal needs every discovery section read; an unshared card needs to know who uses
|
|
168
168
|
# the GPUs, as at plan time (budget.gpu_users_unknown). Sharing consent decides by free
|
|
169
|
-
# VRAM whoever else is there
|
|
169
|
+
# VRAM whoever else is there.
|
|
170
170
|
unknown = (
|
|
171
171
|
bool(unknown_services(facts))
|
|
172
172
|
if stack_hardware.on_metal(part)
|
|
@@ -189,7 +189,7 @@ def persist(session: RunSession) -> StackRecord:
|
|
|
189
189
|
def checkpointed(session: RunSession) -> Iterator[None]:
|
|
190
190
|
"""Record the run before its first component and on every way out. A Ctrl+C or SIGTERM
|
|
191
191
|
during the first write, or a second one while the end is being recorded, still leaves the
|
|
192
|
-
record interrupted or failed, never running
|
|
192
|
+
record interrupted or failed, never running."""
|
|
193
193
|
try:
|
|
194
194
|
persist(session)
|
|
195
195
|
yield
|
|
@@ -64,8 +64,8 @@ def add_arguments(plan: argparse._ActionsContainer) -> None:
|
|
|
64
64
|
type=_aux,
|
|
65
65
|
default="none",
|
|
66
66
|
metavar="auto|none|TASK[,TASK]",
|
|
67
|
-
help="optional embedding, reranker and STT: none (the
|
|
68
|
-
"
|
|
67
|
+
help="optional embedding, reranker and STT: none (default: only the LLM is installed), "
|
|
68
|
+
"auto fits all three into the RAM left, a comma list "
|
|
69
69
|
"such as embedding,reranker plans only those",
|
|
70
70
|
)
|
|
71
71
|
plan.add_argument(
|
|
@@ -241,15 +241,53 @@ def strata_recipe(facts: HostFacts, requested: str) -> tuple[suite.SuiteRecipe |
|
|
|
241
241
|
METAL_BESIDE_BYTES = 12 << 30
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
def unified_bytes(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
def unified_bytes(
|
|
245
|
+
recipe: suite.SuiteRecipe,
|
|
246
|
+
*,
|
|
247
|
+
window: int | None = None,
|
|
248
|
+
slots: int | None = None,
|
|
249
|
+
kv_fmt: str | None = None,
|
|
250
|
+
vision_reader: str = "off",
|
|
251
|
+
) -> int:
|
|
252
|
+
"""What a strata-poly LLM holds on a Mac, where every expert stays in unified memory.
|
|
253
|
+
|
|
254
|
+
Recipes carrying explicit KV geometry (e.g. Inkling 2 Mini ``poly.9``) use compositional sizing
|
|
255
|
+
(weights + KV + resident Metal vision + Metal overhead); legacy recipes without KV geometry
|
|
256
|
+
fall back to ``weights + METAL_BESIDE_BYTES`` (PS219, M5 Ultra)."""
|
|
257
|
+
total, _ = suite.poly_unified_footprint(
|
|
258
|
+
recipe,
|
|
259
|
+
window=window,
|
|
260
|
+
slots=slots,
|
|
261
|
+
kv_fmt=kv_fmt,
|
|
262
|
+
vision_reader=vision_reader,
|
|
263
|
+
allow_catalog_fallback=False,
|
|
264
|
+
fallback_beside_bytes=METAL_BESIDE_BYTES,
|
|
265
|
+
)
|
|
266
|
+
return total
|
|
249
267
|
|
|
250
268
|
|
|
251
269
|
def _on_unified_memory(llm: Plan, recipe: suite.SuiteRecipe) -> Plan:
|
|
252
270
|
"""The plan on a Mac: priced whole and once (``launch.unified_bytes``), no cgroup ceiling."""
|
|
271
|
+
if suite.poly_kv_geometry(recipe, allow_catalog_fallback=False) is not None:
|
|
272
|
+
launch = llm["launch"]
|
|
273
|
+
window = int(str(launch.get("window") or 0)) or None
|
|
274
|
+
slots = int(str(launch.get("slots") or 0)) or None
|
|
275
|
+
reader = str(launch.get("vision") or "off")
|
|
276
|
+
kv_fmt = suite.plan_kv_format(llm, recipe)
|
|
277
|
+
total, wired = suite.poly_unified_footprint(
|
|
278
|
+
recipe,
|
|
279
|
+
window=window,
|
|
280
|
+
slots=slots,
|
|
281
|
+
kv_fmt=kv_fmt,
|
|
282
|
+
vision_reader=reader,
|
|
283
|
+
allow_catalog_fallback=False,
|
|
284
|
+
fallback_beside_bytes=METAL_BESIDE_BYTES,
|
|
285
|
+
)
|
|
286
|
+
parking = int(str(launch.get("conversation_cache_mib") or 0)) << 20
|
|
287
|
+
llm["launch"]["unified_bytes"] = total + parking
|
|
288
|
+
llm["launch"]["vram_bytes"] = wired
|
|
289
|
+
llm["launch"].pop("min_vram_free_bytes", None)
|
|
290
|
+
return suite.unbounded(llm)
|
|
253
291
|
added = int(str(llm["launch"]["memory_estimate_bytes"])) - recipe["memory_estimate_bytes"]
|
|
254
292
|
llm["launch"]["unified_bytes"] = unified_bytes(recipe) + added
|
|
255
293
|
return suite.unbounded(llm)
|
|
@@ -266,7 +304,7 @@ def _suite_gpu(
|
|
|
266
304
|
free_needed: Callable[[GPU], int] | None = None,
|
|
267
305
|
) -> GPU:
|
|
268
306
|
"""The card of the running Strata LLM, else the best idle card (``gpu``: only that one). A
|
|
269
|
-
running plan without a GPU (
|
|
307
|
+
running plan without a GPU (a synthetic or CPU plan of the same name) runs on no
|
|
270
308
|
suite card. Shared, a card at least ``need`` large passes with ``free_needed(card)`` free,
|
|
271
309
|
at least what the check before start will ask (``stack_capacity.start_need``)."""
|
|
272
310
|
placed = running["placement"].get("gpus") if running is not None else None
|
|
@@ -333,7 +371,7 @@ def _free_to_plan(recipe: suite.SuiteRecipe, card: GPU, options: StackOptions) -
|
|
|
333
371
|
there, with the picture reader this card gets and the decision reserve), and never less
|
|
334
372
|
than the recipe's ``vram_bytes``. A PolyStrata floor is enough to start, not to run at
|
|
335
373
|
speed: on a card another program is using, Windows pages the expert cache in and out
|
|
336
|
-
(
|
|
374
|
+
(reference 8 GB WDDM measurement: 6.5 GiB free decoded about 11 tok/s), so shared
|
|
337
375
|
planning keeps the full-cache size until the engine sizes its cache by the real free VRAM."""
|
|
338
376
|
reader = vision.strata_mode(
|
|
339
377
|
options.get("vision", "off"), card["total_bytes"], bool(recipe.get("vision"))
|
|
@@ -367,7 +405,17 @@ def strata_parts(
|
|
|
367
405
|
raise StackError(f"{exc}; cannot share a card with {llm_recipe['id']}") from None
|
|
368
406
|
vram = pick.tier["vram_bytes"] if pick else 0
|
|
369
407
|
unified = metal.supported(facts) and llm_recipe["runtime"] == "strata-poly"
|
|
370
|
-
|
|
408
|
+
spec = llm_recipe.get("vision") or {}
|
|
409
|
+
need = (
|
|
410
|
+
unified_bytes(
|
|
411
|
+
llm_recipe,
|
|
412
|
+
vision_reader=vision.strata_mode(
|
|
413
|
+
options.get("vision", "off"), 0, bool(spec), unified=True
|
|
414
|
+
),
|
|
415
|
+
)
|
|
416
|
+
if unified
|
|
417
|
+
else int(llm_recipe.get("vram_bytes", 0))
|
|
418
|
+
)
|
|
371
419
|
gpu = _suite_gpu(
|
|
372
420
|
facts,
|
|
373
421
|
llm_recipe,
|
|
@@ -380,8 +428,9 @@ def strata_parts(
|
|
|
380
428
|
)
|
|
381
429
|
# Strata's own free margin, the decision model, and its growth.
|
|
382
430
|
reserve = STRATA_FREE_MIB + ((vram + DECISION_VRAM_GROWTH) >> 20) if vram else STRATA_FREE_MIB
|
|
383
|
-
|
|
384
|
-
|
|
431
|
+
reader = vision.strata_mode(
|
|
432
|
+
options.get("vision", "off"), gpu["total_bytes"], bool(spec), unified=unified
|
|
433
|
+
)
|
|
385
434
|
if llm_recipe["runtime"] == "strata-poly":
|
|
386
435
|
cache = "auto"
|
|
387
436
|
reserve = poly_reserve_mib(
|
|
@@ -308,7 +308,7 @@ def add_parser(actions: argparse._SubParsersAction[argparse.ArgumentParser]) ->
|
|
|
308
308
|
cli_help.document(
|
|
309
309
|
agent,
|
|
310
310
|
"Optional add-on for a view hub: reads this stack like `stack view` and sends the same "
|
|
311
|
-
"document. Changes nothing in the stack
|
|
311
|
+
"document. Changes nothing in the stack or its clients.",
|
|
312
312
|
examples=[
|
|
313
313
|
("%(prog)s install --hub http://hub:18491 --token TOKEN", ""),
|
|
314
314
|
("%(prog)s status", "exit 0 when running and the last report was accepted"),
|
|
@@ -72,8 +72,6 @@ FILES = {
|
|
|
72
72
|
"fleet.js": ("fleet.js", "text/javascript; charset=utf-8"),
|
|
73
73
|
"icon.svg": ("icon.svg", "image/svg+xml"),
|
|
74
74
|
"logo-pi.svg": ("logo-pi.svg", "image/svg+xml"),
|
|
75
|
-
"logo-claude.svg": ("logo-claude.svg", "image/svg+xml"),
|
|
76
|
-
"logo-codex.png": ("logo-codex.png", "image/png"),
|
|
77
75
|
"manifest.webmanifest": ("manifest.webmanifest", "application/manifest+json"),
|
|
78
76
|
}
|
|
79
77
|
FORBIDDEN = b"stack view: this address needs the access key; open the LAN link printed at start.\n"
|
|
@@ -103,7 +103,7 @@ WORDS: dict[str, str] = {
|
|
|
103
103
|
"fig.bound": "Ceiling estimate: {basis} ÷ the weight bytes read per token; real speed is lower",
|
|
104
104
|
"fig.bound.none": "No estimate for this card; the live figure comes once the service runs",
|
|
105
105
|
"fig.latency.none": "The catalog has no latency for this model",
|
|
106
|
-
"fig.latency": "Single-stream p50 measured on
|
|
106
|
+
"fig.latency": "Single-stream p50 measured on a reference RTX 4090 D, not this machine",
|
|
107
107
|
"fig.prefill.live": "The service's /metrics: mean prompt speed since it started",
|
|
108
108
|
"fig.decode.live": "The service's /metrics: mean generation speed since it started",
|
|
109
109
|
"fig.decode.none": "Nothing generated yet; the live figure comes after the first request",
|
|
@@ -112,7 +112,7 @@ WORDS: dict[str, str] = {
|
|
|
112
112
|
"after the first request"
|
|
113
113
|
),
|
|
114
114
|
"fig.demo": "Demo data, not a measurement",
|
|
115
|
-
"fig.gateway": "
|
|
115
|
+
"fig.gateway": "Request log: the last {n} calls",
|
|
116
116
|
"fig.kv_ratio.live": "The service's /metrics: live KV cache usage ratio",
|
|
117
117
|
"fig.kv_ratio.none": "KV cache usage ratio not reported by the service",
|
|
118
118
|
"fig.deferred.live": "The service's /metrics: requests deferred waiting for a slot",
|
|
@@ -7,7 +7,7 @@ which flushes the file cache). Stack, when an accepted stack is installed: start
|
|
|
7
7
|
each running LLM two short requests so the first real one does not pay for a cold start, and
|
|
8
8
|
report each first-request time and decode speed separately.
|
|
9
9
|
|
|
10
|
-
What each system gets
|
|
10
|
+
What each system gets:
|
|
11
11
|
|
|
12
12
|
- macOS: memory is unified, so the file cache and other apps compete with the model. ``purge``
|
|
13
13
|
needs root; oMLX frees no system memory either, it only budgets around what is in use. The
|
|
@@ -67,7 +67,7 @@ REQUEST_TIMEOUT_S = 180 # a cold first request on a large model
|
|
|
67
67
|
WARM_TOKENS = 64
|
|
68
68
|
# Ordinary prose, so the speed is the one a user sees. A counting prompt is so predictable that
|
|
69
69
|
# speculative decoding (MTP) accepts nearly every draft: Qwen3.8-27B read 118-126 tok/s on it
|
|
70
|
-
#
|
|
70
|
+
# on reference hardware, well above the same server's speed on prose.
|
|
71
71
|
WARM_PROMPT = "In a few sentences, explain why the sky looks blue during the day."
|
|
72
72
|
|
|
73
73
|
Out = Callable[[str], None]
|