@simplexai/localmodels-linux-x64 0.1.0-dev.36 → 0.1.0-dev.37
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 +119 -98
- package/kit.py +1 -0
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +9 -3
- package/modules/localmodels/bifrost_config.py +188 -0
- package/modules/localmodels/budget.py +13 -2
- package/modules/localmodels/catalog.py +51 -320
- package/modules/localmodels/catalog_add.py +2 -8
- package/modules/localmodels/catalog_recipes.py +321 -0
- package/modules/localmodels/cli_parser.py +4 -1
- package/modules/localmodels/console.py +5 -4
- package/modules/localmodels/contracts.py +13 -3
- package/modules/localmodels/debug_cli.py +158 -0
- package/modules/localmodels/debug_mode.py +727 -0
- package/modules/localmodels/debug_stub_server.py +192 -0
- package/modules/localmodels/decode_calibration.json +1 -1
- package/modules/localmodels/decode_calibration.py +34 -17
- package/modules/localmodels/gateway.py +21 -155
- package/modules/localmodels/gateway_accept.py +201 -0
- package/modules/localmodels/gateway_bifrost.py +19 -184
- package/modules/localmodels/gateway_cli.py +11 -4
- package/modules/localmodels/gateway_foundations.py +2 -4
- package/modules/localmodels/gateway_probe.py +0 -1
- package/modules/localmodels/gateway_server.py +2 -3
- package/modules/localmodels/gpu_specs.py +12 -0
- package/modules/localmodels/guard.py +2 -7
- package/modules/localmodels/harness.py +16 -129
- package/modules/localmodels/harness_cleanup.py +135 -0
- package/modules/localmodels/harness_gateway.py +16 -14
- package/modules/localmodels/harness_probe.py +12 -4
- package/modules/localmodels/hosts.py +25 -2
- package/modules/localmodels/http_local.py +59 -0
- package/modules/localmodels/install.py +23 -8
- package/modules/localmodels/library_gateway.py +9 -9
- package/modules/localmodels/library_jobs.py +76 -27
- package/modules/localmodels/library_serve.py +12 -1
- package/modules/localmodels/library_state.py +6 -1
- package/modules/localmodels/llm_rank.py +102 -9
- package/modules/localmodels/probe.py +108 -174
- package/modules/localmodels/process_identity.py +109 -154
- package/modules/localmodels/process_windows.py +86 -0
- package/modules/localmodels/recommend.py +1 -1
- package/modules/localmodels/recommend_cli.py +14 -6
- package/modules/localmodels/remote_ops.py +65 -0
- package/modules/localmodels/remote_ops_service.py +14 -2
- package/modules/localmodels/runtime_args.py +10 -3
- package/modules/localmodels/runtime_auth.py +5 -9
- package/modules/localmodels/runtime_cli.py +128 -129
- package/modules/localmodels/runtime_discovery.py +84 -0
- package/modules/localmodels/runtime_install.py +101 -0
- package/modules/localmodels/runtime_releases.py +302 -0
- package/modules/localmodels/service_stop.py +8 -108
- package/modules/localmodels/service_upgrade.py +394 -63
- package/modules/localmodels/services_cli.py +24 -14
- package/modules/localmodels/setup_inspection.py +97 -9
- package/modules/localmodels/setup_text.py +7 -0
- package/modules/localmodels/sizecalc.py +0 -1
- package/modules/localmodels/stack.py +14 -221
- package/modules/localmodels/stack_arena.py +732 -0
- package/modules/localmodels/stack_args.py +15 -9
- package/modules/localmodels/stack_auto.py +384 -3
- package/modules/localmodels/stack_aux_gpu.py +4 -3
- package/modules/localmodels/stack_capacity.py +138 -0
- package/modules/localmodels/stack_cleanup.py +9 -4
- package/modules/localmodels/stack_cli.py +286 -0
- package/modules/localmodels/stack_compose.py +58 -25
- package/modules/localmodels/stack_console.py +9 -6
- package/modules/localmodels/stack_hardware.py +92 -263
- package/modules/localmodels/stack_hardware_text.py +263 -0
- package/modules/localmodels/stack_journal.py +3 -9
- package/modules/localmodels/stack_ledger.py +48 -18
- package/modules/localmodels/stack_lifecycle.py +33 -312
- package/modules/localmodels/stack_mcp.py +729 -0
- package/modules/localmodels/stack_memory.py +0 -2
- package/modules/localmodels/stack_picks.py +59 -12
- package/modules/localmodels/stack_plan.py +19 -1
- package/modules/localmodels/stack_preflight.py +11 -19
- package/modules/localmodels/stack_remove.py +373 -0
- package/modules/localmodels/stack_route.py +101 -17
- package/modules/localmodels/stack_suite.py +11 -7
- package/modules/localmodels/stack_summary.py +14 -0
- package/modules/localmodels/stack_try.py +238 -24
- package/modules/localmodels/stack_try_client.py +53 -15
- package/modules/localmodels/stack_try_docs.py +2 -2
- package/modules/localmodels/stack_view.py +24 -171
- package/modules/localmodels/stack_view_access.py +114 -1
- package/modules/localmodels/stack_view_agent.py +3 -13
- package/modules/localmodels/stack_view_hub.py +9 -10
- package/modules/localmodels/stack_view_llm.py +1 -1
- package/modules/localmodels/stack_view_sandbox.py +2 -2
- package/modules/localmodels/stack_view_schema.py +183 -0
- package/modules/localmodels/stack_view_serve.py +7 -1
- package/modules/localmodels/stack_view_service.py +1 -2
- package/modules/localmodels/stack_view_text.py +13 -9
- package/modules/localmodels/stack_warm.py +3 -0
- package/modules/localmodels/stack_warm_store.py +517 -0
- package/modules/localmodels/tui.py +28 -4
- package/modules/localmodels/tui_dialogs.py +136 -0
- package/modules/localmodels/tui_modals.py +279 -0
- package/modules/localmodels/tui_screen.py +113 -154
- package/modules/localmodels/tui_views.py +134 -203
- package/modules/localmodels/web/index.html +510 -101
- package/modules/localmodels/web/sizecalc/app.js +363 -10
- package/modules/localmodels/web/sizecalc/page.html +27 -3
- package/modules/localmodels/web/view/fleet.html +11 -2
- package/modules/localmodels/web/view/fleet.js +191 -17
- package/modules/localmodels/web/view/i18n.js +3 -2
- package/modules/localmodels/web/view/index.html +1 -1
- package/modules/localmodels/web/view/nav.js +22 -3
- package/modules/localmodels/web/view/view.css +63 -18
- package/modules/localmodels/web/view/view.js +169 -32
- package/modules/{simplex_localmodels-0.1.0.dev36.dist-info → simplex_localmodels-0.1.0.dev37.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev36.dist-info → simplex_localmodels-0.1.0.dev37.dist-info}/RECORD +115 -94
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/localmodels/engines-strata-0.1.49.1.json +0 -31
- /package/modules/{simplex_localmodels-0.1.0.dev36.dist-info → simplex_localmodels-0.1.0.dev37.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev36.dist-info → simplex_localmodels-0.1.0.dev37.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev36.dist-info → simplex_localmodels-0.1.0.dev37.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev36.dist-info → simplex_localmodels-0.1.0.dev37.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""Schema types, constants and next-step links for ``stack view``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
from localmodels import hosts
|
|
8
|
+
from localmodels import stack_journal as journal
|
|
9
|
+
from localmodels import stack_view_apply as running
|
|
10
|
+
from localmodels.stack_plan import Hardware, StackPlan, command
|
|
11
|
+
from localmodels.stack_view_events import Event
|
|
12
|
+
from localmodels.stack_view_gpu import GpuLoad
|
|
13
|
+
from localmodels.stack_view_measure import Measured, MeasuredRow
|
|
14
|
+
from localmodels.stack_view_slots import Slot
|
|
15
|
+
from localmodels.stack_view_words import say
|
|
16
|
+
|
|
17
|
+
SCHEMA = "localmodels.stack-view/v1"
|
|
18
|
+
GIB = 1 << 30
|
|
19
|
+
METRICS_BYTES = 256 * 1024 # a llama-server /metrics page is a few KiB
|
|
20
|
+
TASKS = ("llm", "llm_fast", "decision", "embedding", "rerank", "stt", "tts")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Figure(TypedDict):
|
|
24
|
+
value: float | None
|
|
25
|
+
basis: str # live | measured | estimate | demo | none
|
|
26
|
+
note: str
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Segment(TypedDict):
|
|
30
|
+
kind: str # weights kv state compute draft process decision embedding rerank stt ...
|
|
31
|
+
label: str
|
|
32
|
+
bytes: int
|
|
33
|
+
basis: str # measured | estimate | demo
|
|
34
|
+
component: str | None # the component it belongs to, None for the host's own share
|
|
35
|
+
note: str
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Fit(TypedDict):
|
|
39
|
+
"""A validated LLM that passes the agent gate on this card now (stack hardware's check)."""
|
|
40
|
+
|
|
41
|
+
id: str
|
|
42
|
+
quant: str
|
|
43
|
+
decode_tok_s: float | None # the planner's calibrated decode estimate, None when unavailable
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Gpu(TypedDict):
|
|
47
|
+
index: int
|
|
48
|
+
name: str
|
|
49
|
+
total_bytes: int
|
|
50
|
+
used_bytes: int
|
|
51
|
+
bandwidth_gb_s: float | None
|
|
52
|
+
holders: list[str]
|
|
53
|
+
segments: list[Segment]
|
|
54
|
+
fits: list[Fit]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Memory(TypedDict):
|
|
58
|
+
total_bytes: int
|
|
59
|
+
available_bytes: int
|
|
60
|
+
segments: list[Segment]
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class Counters(TypedDict):
|
|
64
|
+
"""llama-server's own counters since it started; a client diffs two to get a rate."""
|
|
65
|
+
|
|
66
|
+
prompt_tokens: float
|
|
67
|
+
prompt_seconds: float
|
|
68
|
+
predicted_tokens: float
|
|
69
|
+
predicted_seconds: float
|
|
70
|
+
processing: float
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Perf(TypedDict):
|
|
74
|
+
prefill_tok_s: Figure # for embedding and rerank: the tokens they read per second
|
|
75
|
+
decode_tok_s: Figure
|
|
76
|
+
decode_bound: Figure # the bandwidth ceiling the planner estimates; never a measurement
|
|
77
|
+
latency_ms: Figure # mean call time in the gateway log; Jev: the gateway's share per turn
|
|
78
|
+
calls: int | None # calls in the gateway log's recent window
|
|
79
|
+
failed: int # of those, the ones that did not succeed (not in latency_ms)
|
|
80
|
+
tiers: dict[str, int] | None # Jev only: the tiers it chose in that window
|
|
81
|
+
counters: Counters | None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class Component(TypedDict):
|
|
85
|
+
id: str # llm | decision | embedding | rerank | stt | tts
|
|
86
|
+
role: str
|
|
87
|
+
title: str
|
|
88
|
+
model: str
|
|
89
|
+
quant: str
|
|
90
|
+
device: str
|
|
91
|
+
gpu: int | None
|
|
92
|
+
endpoint: str
|
|
93
|
+
state: str # serving | stopped | failed | planned
|
|
94
|
+
health: str
|
|
95
|
+
window: int | None
|
|
96
|
+
slots: int | None
|
|
97
|
+
kv_types: str | None
|
|
98
|
+
vram_bytes: int
|
|
99
|
+
ram_bytes: int
|
|
100
|
+
perf: Perf
|
|
101
|
+
explain: str
|
|
102
|
+
live_slots: list[Slot] | None # llama-server's slots now (stack_view_slots), None unread
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class Client(TypedDict):
|
|
106
|
+
id: str
|
|
107
|
+
name: str
|
|
108
|
+
model: str
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class Gateway(TypedDict):
|
|
112
|
+
kind: str # bifrost | magpie
|
|
113
|
+
addr: str
|
|
114
|
+
route: str # the routed model the clients pick
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class WhatIf(TypedDict):
|
|
118
|
+
"""Enough for a slider to reprice the LLM's card at another window: linear in the window,
|
|
119
|
+
without the sliding-window cap, so it never under-prices (an upper bound)."""
|
|
120
|
+
|
|
121
|
+
gpu: int
|
|
122
|
+
window: int
|
|
123
|
+
slots: int
|
|
124
|
+
kv_bytes_per_token: float
|
|
125
|
+
compute_bytes_per_token: float
|
|
126
|
+
fixed_bytes: int # the LLM's window-independent share
|
|
127
|
+
room_bytes: int # what the card leaves the LLM: total less other programs, reserve, others
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class Host(TypedDict):
|
|
131
|
+
hostname: str
|
|
132
|
+
system: str
|
|
133
|
+
tier: str
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class Step(TypedDict):
|
|
137
|
+
command: str
|
|
138
|
+
why: str
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def next_steps() -> list[Step]:
|
|
142
|
+
"""What a computer without an applied plan runs next, written the way the operator runs
|
|
143
|
+
this tool (``command``) and explained (stack_view_words "next.*")."""
|
|
144
|
+
steps = (("install", "install"), ("stack plan", "plan"), ("stack view --demo", "demo"))
|
|
145
|
+
return [{"command": f"{command()} {sub}", "why": say(f"next.{key}")} for sub, key in steps]
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class StackView(TypedDict):
|
|
149
|
+
schema: str
|
|
150
|
+
generated_at: str
|
|
151
|
+
source: str # live | demo | empty
|
|
152
|
+
lang: str # always "en"; kept for clients that read it
|
|
153
|
+
plan_id: str | None
|
|
154
|
+
host: Host
|
|
155
|
+
gateway: Gateway | None
|
|
156
|
+
clients: list[Client]
|
|
157
|
+
components: list[Component]
|
|
158
|
+
gpus: list[Gpu]
|
|
159
|
+
ram: Memory
|
|
160
|
+
what_if: WhatIf | None
|
|
161
|
+
events: list[Event] # the gateway's recent calls, newest-ended first; metadata only
|
|
162
|
+
measured: list[MeasuredRow] # what the running services hold, beside what the plan priced
|
|
163
|
+
notes: list[str]
|
|
164
|
+
next_steps: list[Step] # empty once a plan is applied
|
|
165
|
+
apply: running.Apply | None # a stack apply running now, else None
|
|
166
|
+
gpu_load: list[GpuLoad] # each card's utilization, power and temperature now
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class Reading(TypedDict):
|
|
170
|
+
"""What one look at the computer found; ``render`` draws it."""
|
|
171
|
+
|
|
172
|
+
hw: Hardware
|
|
173
|
+
plan: StackPlan | None
|
|
174
|
+
liveness: dict[str, tuple[str, str]]
|
|
175
|
+
counters: dict[str, Counters]
|
|
176
|
+
owned: hosts.Owned | None
|
|
177
|
+
events: list[Event]
|
|
178
|
+
measured: dict[str, Measured] # by task
|
|
179
|
+
source: str # live | demo
|
|
180
|
+
generated_at: str
|
|
181
|
+
apply: journal.Live | None
|
|
182
|
+
gpu_load: list[GpuLoad]
|
|
183
|
+
slots: dict[str, list[Slot]] # by deployment name
|
|
@@ -36,7 +36,7 @@ from urllib.parse import parse_qs, urlsplit
|
|
|
36
36
|
from localmodels import hosts, stack_view, stack_view_demo, stack_view_sandbox, stack_view_text
|
|
37
37
|
from localmodels.stack_plan import Hardware
|
|
38
38
|
from localmodels.stack_view import Reading
|
|
39
|
-
from localmodels.stack_view_access import KEY_ENV, Gate, lan_addresses, run_key
|
|
39
|
+
from localmodels.stack_view_access import KEY_ENV, Gate, gate_page, lan_addresses, run_key
|
|
40
40
|
from localmodels.stack_view_events import Event
|
|
41
41
|
|
|
42
42
|
PAGE_DIR = Path(__file__).with_name("web") / "view"
|
|
@@ -263,6 +263,12 @@ def handler_for(
|
|
|
263
263
|
def do_GET(self) -> None:
|
|
264
264
|
peer, host = self.client_address[0], self.headers.get("Host")
|
|
265
265
|
if not door.admit(peer, host, self.path, self.headers.get("Cookie")):
|
|
266
|
+
if self.command == "GET" and door.wants_html_gate(self.path):
|
|
267
|
+
return self._send(
|
|
268
|
+
HTTPStatus.FORBIDDEN,
|
|
269
|
+
gate_page("localmodels - stack", self.path),
|
|
270
|
+
"text/html; charset=utf-8",
|
|
271
|
+
)
|
|
266
272
|
return self._send(HTTPStatus.FORBIDDEN, FORBIDDEN, "text/plain; charset=utf-8")
|
|
267
273
|
if cookie := door.set_cookie(
|
|
268
274
|
self.path
|
|
@@ -20,7 +20,6 @@ import hashlib
|
|
|
20
20
|
import os
|
|
21
21
|
import plistlib
|
|
22
22
|
import shutil
|
|
23
|
-
import signal
|
|
24
23
|
import subprocess
|
|
25
24
|
import sys
|
|
26
25
|
import time
|
|
@@ -247,7 +246,7 @@ def start(service: Service, argv: list[str], what: str) -> str:
|
|
|
247
246
|
process_identity.save(root / "service.pid", proc.pid)
|
|
248
247
|
except (OSError, RuntimeError, subprocess.TimeoutExpired) as exc:
|
|
249
248
|
with contextlib.suppress(OSError): # not yet reaped, so the group is still ours
|
|
250
|
-
|
|
249
|
+
process_identity.kill_started(proc.pid) # its group; its tree on Windows
|
|
251
250
|
proc.wait(timeout=10)
|
|
252
251
|
raise ServiceError(f"cannot record the process identity ({exc}); stopped it") from None
|
|
253
252
|
return f"background process {proc.pid} (log {log}; not started again after a reboot)"
|
|
@@ -14,10 +14,10 @@ import os
|
|
|
14
14
|
import shutil
|
|
15
15
|
import sys
|
|
16
16
|
import time
|
|
17
|
-
import unicodedata
|
|
18
17
|
from collections.abc import Callable
|
|
19
18
|
from typing import TextIO
|
|
20
19
|
|
|
20
|
+
from localmodels import console
|
|
21
21
|
from localmodels.stack_view import Component, Counters, Figure, Segment, StackView
|
|
22
22
|
from localmodels.stack_view_events import Event
|
|
23
23
|
from localmodels.stack_view_words import say
|
|
@@ -38,6 +38,8 @@ PALETTE = {
|
|
|
38
38
|
"stt": "#e11d48",
|
|
39
39
|
"tts": "#c026d3",
|
|
40
40
|
"harness": "#475569",
|
|
41
|
+
"llm_fast": "#0284c7",
|
|
42
|
+
"search": "#0d9488",
|
|
41
43
|
"foreign": "#8b8b94",
|
|
42
44
|
"reserve": "#a1a1aa",
|
|
43
45
|
"free": "#a1a1aa",
|
|
@@ -80,12 +82,8 @@ class Paint:
|
|
|
80
82
|
return f"\x1b[{';'.join(codes)}m{text}\x1b[0m" if codes else text
|
|
81
83
|
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def pad(text: str, cells: int) -> str:
|
|
88
|
-
return text + " " * max(0, cells - width_of(text))
|
|
85
|
+
width_of = console.cells
|
|
86
|
+
pad = console.pad
|
|
89
87
|
|
|
90
88
|
|
|
91
89
|
def gb(size: int) -> str:
|
|
@@ -271,7 +269,7 @@ def _status(comp: Component, recent: dict[str, float] | None, paint: Paint, old:
|
|
|
271
269
|
return paint(f"{say(key)}{reason}", "bad")
|
|
272
270
|
perf = comp["perf"]
|
|
273
271
|
busy = bool(recent and (recent["prompt"] > 0 or recent["pred"] > 0))
|
|
274
|
-
if comp["id"]
|
|
272
|
+
if comp["id"] in ("llm", "llm_fast"):
|
|
275
273
|
pre = (recent or {}).get("prefill") or perf["prefill_tok_s"]["value"]
|
|
276
274
|
dec = (recent or {}).get("decode") or perf["decode_tok_s"]["value"]
|
|
277
275
|
doing = (
|
|
@@ -458,7 +456,13 @@ def _memory(view: StackView, paint: Paint, cells: int) -> list[str]:
|
|
|
458
456
|
lines += [head, f" {used}", *([] if aside else _map(gpu["segments"], paint, cells))]
|
|
459
457
|
if gpu["fits"]:
|
|
460
458
|
items = [
|
|
461
|
-
f"{f['id']} {f['quant']}
|
|
459
|
+
f"{f['id']} {f['quant']} "
|
|
460
|
+
+ (
|
|
461
|
+
f"({rate(tok_s)} tok/s)"
|
|
462
|
+
if (tok_s := f["decode_tok_s"]) is not None
|
|
463
|
+
else "(speed unavailable)"
|
|
464
|
+
)
|
|
465
|
+
for f in gpu["fits"]
|
|
462
466
|
]
|
|
463
467
|
lines += [paint(line, "muted") for line in _fits(items, cells)]
|
|
464
468
|
ram = view["ram"]
|
|
@@ -51,6 +51,7 @@ from localmodels import (
|
|
|
51
51
|
process_identity,
|
|
52
52
|
stack_up,
|
|
53
53
|
stack_verify,
|
|
54
|
+
stack_warm_store,
|
|
54
55
|
)
|
|
55
56
|
from localmodels.budget import gib
|
|
56
57
|
from localmodels.records import Plan
|
|
@@ -467,6 +468,8 @@ def warm(
|
|
|
467
468
|
}
|
|
468
469
|
if "llm_fast" in warmed:
|
|
469
470
|
report["llm_fast"] = warmed["llm_fast"]
|
|
471
|
+
if not host_only and plan is not None:
|
|
472
|
+
stack_warm_store.persist_warm(plan, report, parts, warmed)
|
|
470
473
|
return report
|
|
471
474
|
|
|
472
475
|
|