@simplexai/localmodels-darwin-x64 0.1.0-dev.102 → 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/NOTICE +126 -0
- package/README.md +10 -0
- package/bootstrap.identity +1 -1
- package/bootstrap.sha256 +139 -121
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +3 -1
- package/modules/localmodels/catalog.json +435 -127
- package/modules/localmodels/catalog.py +7 -3
- package/modules/localmodels/catalog_recipes.py +3 -3
- package/modules/localmodels/cli_parser.py +7 -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/debug_stub_server.py +280 -7
- 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 +77 -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 +68 -0
- 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 +162 -75
- 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_common.py +12 -2
- 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 +460 -0
- package/modules/localmodels/sidecar_http.py +452 -0
- package/modules/localmodels/sidecar_state.py +516 -0
- package/modules/localmodels/speech_admission.py +33 -4
- package/modules/localmodels/speech_catalog.py +23 -0
- package/modules/localmodels/speech_cli.py +10 -2
- package/modules/localmodels/speech_jobs.py +120 -384
- package/modules/localmodels/speech_server.py +187 -77
- package/modules/localmodels/speech_state.py +90 -454
- package/modules/localmodels/speech_workers.py +51 -162
- package/modules/localmodels/stack.py +18 -0
- 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_down.py +19 -14
- 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 +32 -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_up.py +51 -1
- 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 +251 -3
- package/modules/localmodels/suite.py +137 -5
- package/modules/localmodels/tts-moss.txt +321 -0
- package/modules/localmodels/tts_admission.py +381 -0
- package/modules/localmodels/tts_backend_speechcpp.py +487 -0
- package/modules/localmodels/tts_catalog.py +279 -0
- package/modules/localmodels/tts_cli.py +352 -0
- package/modules/localmodels/tts_http.py +623 -0
- package/modules/localmodels/tts_jobs.py +526 -0
- package/modules/localmodels/tts_model.py +591 -0
- package/modules/localmodels/tts_moss_presets.json +1 -0
- package/modules/localmodels/tts_serve.py +451 -0
- package/modules/localmodels/tts_server.py +1 -1
- package/modules/localmodels/tts_sidecar.py +788 -0
- package/modules/localmodels/tts_state.py +400 -0
- package/modules/localmodels/tts_worker_kokoro.py +463 -0
- package/modules/localmodels/tts_worker_moss.py +748 -0
- package/modules/localmodels/tts_workers.py +696 -0
- 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.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/RECORD +132 -109
- 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.dev102.dist-info/METADATA +0 -9
- package/modules/simplex_localmodels-0.1.0.dev102.dist-info/licenses/NOTICE +0 -68
- /package/modules/{simplex_localmodels-0.1.0.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev102.dist-info → simplex_localmodels-0.1.0.dev104.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -19,6 +19,7 @@ from localmodels import (
|
|
|
19
19
|
deployment_lifecycle,
|
|
20
20
|
hosts,
|
|
21
21
|
speech_state,
|
|
22
|
+
tts_state,
|
|
22
23
|
)
|
|
23
24
|
from localmodels import stack_lifecycle as lifecycle
|
|
24
25
|
from localmodels.stack_plan import StackError, platform_error
|
|
@@ -80,20 +81,24 @@ def _down(out: Out) -> DownReport:
|
|
|
80
81
|
f"{'✗' if failed else '…'} {plan['name']} {'failed to stop' if failed else 'stopped'}"
|
|
81
82
|
)
|
|
82
83
|
parts.append(row)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
for sidecar_name, task_name, stop_fn in (
|
|
85
|
+
("speech-sidecar", "stt", speech_state.stop_sidecar_if_recorded),
|
|
86
|
+
("tts-sidecar", "tts", tts_state.stop_sidecar_if_recorded),
|
|
87
|
+
):
|
|
88
|
+
action, detail = stop_fn()
|
|
89
|
+
if action == "stopped" or action == "failed":
|
|
90
|
+
parts.append(
|
|
91
|
+
{
|
|
92
|
+
"name": sidecar_name,
|
|
93
|
+
"task": task_name,
|
|
94
|
+
"action": action,
|
|
95
|
+
"detail": detail,
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
out(
|
|
99
|
+
f"{'✗' if action == 'failed' else '…'} {sidecar_name} "
|
|
100
|
+
f"{'failed to stop' if action == 'failed' else 'stopped'}"
|
|
101
|
+
)
|
|
97
102
|
return {
|
|
98
103
|
"schema": SCHEMA,
|
|
99
104
|
"ok": all(p["action"] != "failed" for p in parts),
|
|
@@ -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
|
|
@@ -119,10 +126,25 @@ AUXILIARY_PORTS = {
|
|
|
119
126
|
"reranker": (18351, *range(18400, 18432)),
|
|
120
127
|
"stt": (18370, *range(18464, 18496)),
|
|
121
128
|
}
|
|
129
|
+
TTS_PORTS: tuple[int, ...] = (18380, *range(18528, 18560))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
PORTS_IN_USE = "PORTS_IN_USE"
|
|
122
133
|
|
|
123
134
|
|
|
124
135
|
class PortUnavailableError(PlanError):
|
|
125
|
-
"""
|
|
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
|
|
126
148
|
|
|
127
149
|
|
|
128
150
|
class PortProbeError(StackError):
|
|
@@ -141,7 +163,10 @@ PortState = Literal["free", "busy", "unknown"]
|
|
|
141
163
|
|
|
142
164
|
def port_state(facts: HostFacts, port: int, listening: Callable[[int], bool]) -> PortState:
|
|
143
165
|
"""Free only on known absence of every observed loopback listener; ``unknown`` when the
|
|
144
|
-
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"
|
|
145
170
|
if any(service["port"] == port for service in facts.get("llama_servers") or []):
|
|
146
171
|
return "busy"
|
|
147
172
|
services = facts.get("services")
|
|
@@ -258,6 +283,8 @@ def loopback_bindable(port: int) -> bool:
|
|
|
258
283
|
|
|
259
284
|
def loopback_listening(port: int) -> bool:
|
|
260
285
|
"""Keep planning failures typed while sharing the lower-level listener proof."""
|
|
286
|
+
if plan_envelope.ports_assumed_free():
|
|
287
|
+
return False
|
|
261
288
|
seen = _SNAPSHOT.get()
|
|
262
289
|
if seen is not None and port in seen:
|
|
263
290
|
known = seen[port]
|
|
@@ -326,7 +353,8 @@ def llm_port(
|
|
|
326
353
|
"loopback check failed); check again, or pick a port with --llm-port"
|
|
327
354
|
)
|
|
328
355
|
raise StackError(
|
|
329
|
-
"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,
|
|
330
358
|
)
|
|
331
359
|
|
|
332
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(
|
|
@@ -28,6 +28,7 @@ from localmodels import (
|
|
|
28
28
|
)
|
|
29
29
|
from localmodels import stack_lifecycle as lifecycle
|
|
30
30
|
from localmodels.contracts import decode
|
|
31
|
+
from localmodels.plan_envelope import PlanError
|
|
31
32
|
from localmodels.planning.budget import gpu_conflicts, gpu_users_unknown, unknown_services
|
|
32
33
|
from localmodels.records import Plan
|
|
33
34
|
from localmodels.stack_plan import (
|
|
@@ -54,7 +55,7 @@ class Part(TypedDict):
|
|
|
54
55
|
detail: str
|
|
55
56
|
|
|
56
57
|
|
|
57
|
-
class
|
|
58
|
+
class _UpResult(TypedDict):
|
|
58
59
|
schema: Literal["localmodels.stack-up/v1"]
|
|
59
60
|
plan_id: str
|
|
60
61
|
ok: bool
|
|
@@ -62,6 +63,42 @@ class UpReport(TypedDict):
|
|
|
62
63
|
notes: list[str]
|
|
63
64
|
|
|
64
65
|
|
|
66
|
+
class UpReport(_UpResult, total=False):
|
|
67
|
+
# A refusal (exit 2): a cause code and a fixed sentence, never the exception's text (it can
|
|
68
|
+
# name paths and plan contents), and for STACK_VRAM_INSUFFICIENT the two byte counts.
|
|
69
|
+
cause_code: str
|
|
70
|
+
message: str
|
|
71
|
+
free_bytes: int
|
|
72
|
+
required_bytes: int
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
REFUSED = (
|
|
76
|
+
"STACK_UP_REFUSED",
|
|
77
|
+
"stack up refused to start the stack; run the same command without --json to see why",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def refusal(exc: BaseException, plan_id: str) -> UpReport:
|
|
82
|
+
"""The ``--json`` result of an ``up`` that raised ``exc`` before it could report: what
|
|
83
|
+
Linger reads instead of a line on stderr alone."""
|
|
84
|
+
code = getattr(exc, "cause_code", None)
|
|
85
|
+
cause = (code, stack_run.CAUSES[code]) if code == "STACK_VRAM_INSUFFICIENT" else REFUSED
|
|
86
|
+
report: UpReport = {
|
|
87
|
+
"schema": SCHEMA,
|
|
88
|
+
"plan_id": stack_run.safe_digest(plan_id) or "",
|
|
89
|
+
"ok": False,
|
|
90
|
+
"parts": [],
|
|
91
|
+
"notes": [],
|
|
92
|
+
"cause_code": cause[0],
|
|
93
|
+
"message": cause[1],
|
|
94
|
+
}
|
|
95
|
+
counts = stack_run.cause_counts(exc)
|
|
96
|
+
if counts:
|
|
97
|
+
report["free_bytes"] = counts["free_bytes"]
|
|
98
|
+
report["required_bytes"] = counts["required_bytes"]
|
|
99
|
+
return report
|
|
100
|
+
|
|
101
|
+
|
|
65
102
|
def accepted() -> StackPlan | None:
|
|
66
103
|
"""The plan of the last ``stack apply``, if that apply passed."""
|
|
67
104
|
return stack_run.accepted()
|
|
@@ -275,6 +312,18 @@ def print_report(report: UpReport, out: Out = print) -> int:
|
|
|
275
312
|
|
|
276
313
|
|
|
277
314
|
def cli(args: argparse.Namespace) -> int:
|
|
315
|
+
if not args.json:
|
|
316
|
+
return _cli(args)
|
|
317
|
+
plan_id: list[str] = []
|
|
318
|
+
try:
|
|
319
|
+
return _cli(args, plan_id.append)
|
|
320
|
+
except (StackError, PlanError, OSError, ValueError, KeyError) as exc:
|
|
321
|
+
print(json.dumps(refusal(exc, plan_id[-1] if plan_id else ""), indent=1))
|
|
322
|
+
print(f"stack: {exc}", file=sys.stderr)
|
|
323
|
+
return 2
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def _cli(args: argparse.Namespace, chosen: Callable[[str], None] = lambda _id: None) -> int:
|
|
278
327
|
if args.plan is None:
|
|
279
328
|
plan = stack_run.accepted()
|
|
280
329
|
if plan is None:
|
|
@@ -290,6 +339,7 @@ def cli(args: argparse.Namespace) -> int:
|
|
|
290
339
|
f"plan {saved['plan_id'][:12]} has no stack apply record that passed full acceptance; "
|
|
291
340
|
f"run {command()} stack apply first"
|
|
292
341
|
)
|
|
342
|
+
chosen(plan["plan_id"])
|
|
293
343
|
report = up(
|
|
294
344
|
plan,
|
|
295
345
|
share_gpu=args.share_gpu,
|
|
@@ -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]
|