@simplexai/localmodels-win32-x64 0.1.0-dev.59 → 0.1.0-dev.61
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 +126 -107
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +107 -44
- package/modules/localmodels/apple_sensors.py +431 -0
- package/modules/localmodels/auth_proxy.py +185 -19
- package/modules/localmodels/bifrost_admin.py +30 -0
- package/modules/localmodels/bifrost_checks.py +2 -2
- package/modules/localmodels/bifrost_config.py +132 -9
- package/modules/localmodels/bifrost_models.py +1 -1
- package/modules/localmodels/catalog.json +509 -54
- package/modules/localmodels/catalog.py +21 -4
- package/modules/localmodels/catalog_add.py +42 -11
- package/modules/localmodels/catalog_license.py +2 -0
- package/modules/localmodels/catalog_recipes.py +2 -0
- package/modules/localmodels/cli_parser.py +6 -2
- package/modules/localmodels/context_policy.py +40 -4
- package/modules/localmodels/custom_hub.py +983 -0
- package/modules/localmodels/custom_hub_http.py +579 -0
- package/modules/localmodels/custom_probe.py +451 -0
- package/modules/localmodels/debug_mode.py +13 -0
- package/modules/localmodels/debug_stub_server.py +156 -1
- package/modules/localmodels/deploy.py +38 -7
- package/modules/localmodels/deploy_steps.py +5 -0
- package/modules/localmodels/download-mirrors.json +20 -0
- package/modules/localmodels/engines-b12757-mix-ef2df21.json +26 -0
- package/modules/localmodels/engines-prism-b12178-03ec600.json +131 -0
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.6.json +94 -0
- package/modules/localmodels/engines-whisper-b5454.json +120 -1
- package/modules/localmodels/engines.py +38 -8
- package/modules/localmodels/estimator.py +60 -7
- package/modules/localmodels/gateway.py +48 -3
- package/modules/localmodels/gateway_app_bifrost.py +18 -18
- package/modules/localmodels/gateway_bifrost.py +102 -16
- package/modules/localmodels/gateway_cli.py +14 -80
- package/modules/localmodels/gateway_server.py +88 -16
- package/modules/localmodels/gguf.py +6 -0
- package/modules/localmodels/gpu_specs.py +35 -1
- package/modules/localmodels/harness.py +1 -2
- package/modules/localmodels/hf_repo.py +12 -4
- package/modules/localmodels/host_sensors.py +704 -0
- package/modules/localmodels/install.py +4 -4
- package/modules/localmodels/library_cli.py +181 -3
- package/modules/localmodels/library_custom.py +831 -0
- package/modules/localmodels/library_elastic.py +35 -7
- package/modules/localmodels/library_gateway.py +94 -32
- package/modules/localmodels/library_jobs.py +76 -11
- package/modules/localmodels/library_kept.py +50 -6
- package/modules/localmodels/library_model.py +254 -2
- package/modules/localmodels/library_pricing.py +83 -4
- package/modules/localmodels/library_serve.py +178 -60
- package/modules/localmodels/library_smoke.py +315 -0
- package/modules/localmodels/library_state.py +77 -1
- package/modules/localmodels/library_status.py +126 -4
- package/modules/localmodels/npm_transport.py +4 -58
- package/modules/localmodels/nvml_ctypes.py +431 -0
- package/modules/localmodels/plan_envelope.py +14 -6
- package/modules/localmodels/recommend_cli.py +2 -1
- package/modules/localmodels/records.py +1 -0
- package/modules/localmodels/remote_ops.py +120 -665
- package/modules/localmodels/remote_ops_common.py +729 -0
- package/modules/localmodels/remote_ops_download.py +396 -241
- package/modules/localmodels/remote_ops_mirrors.py +26 -65
- package/modules/localmodels/remote_ops_prepare.py +43 -35
- package/modules/localmodels/remote_ops_ranges.py +98 -65
- package/modules/localmodels/remote_ops_remove.py +30 -22
- package/modules/localmodels/remote_ops_service.py +103 -95
- package/modules/localmodels/remote_ops_verify.py +113 -65
- package/modules/localmodels/runtime-lock.json +19 -19
- package/modules/localmodels/runtime_cli.py +15 -5
- package/modules/localmodels/runtime_io.py +54 -1
- package/modules/localmodels/service_control.py +32 -1
- package/modules/localmodels/service_wiring.py +2 -3
- package/modules/localmodels/service_worker.py +6 -2
- package/modules/localmodels/services_cli.py +35 -27
- package/modules/localmodels/source_byok.py +3 -5
- package/modules/localmodels/speech-sv.txt +93 -0
- package/modules/localmodels/speech_admission.py +437 -0
- package/modules/localmodels/speech_catalog.py +170 -0
- package/modules/localmodels/speech_cli.py +273 -0
- package/modules/localmodels/speech_jobs.py +772 -0
- package/modules/localmodels/speech_model.py +404 -0
- package/modules/localmodels/speech_serve.py +287 -0
- package/modules/localmodels/speech_server.py +837 -0
- package/modules/localmodels/speech_state.py +697 -0
- package/modules/localmodels/speech_worker_sensevoice.py +255 -0
- package/modules/localmodels/speech_workers.py +783 -0
- package/modules/localmodels/stack.py +0 -33
- package/modules/localmodels/stack_auto.py +5 -3
- package/modules/localmodels/stack_aux_gpu.py +45 -4
- package/modules/localmodels/stack_capacity.py +77 -8
- package/modules/localmodels/stack_cli.py +16 -1
- package/modules/localmodels/stack_compose.py +1 -1
- package/modules/localmodels/stack_down.py +24 -1
- package/modules/localmodels/stack_hardware.py +57 -88
- package/modules/localmodels/stack_hardware_text.py +4 -59
- package/modules/localmodels/stack_lifecycle.py +2 -2
- package/modules/localmodels/stack_memory.py +14 -3
- package/modules/localmodels/stack_suite.py +9 -10
- package/modules/localmodels/stack_summary.py +4 -4
- package/modules/localmodels/stack_view.py +77 -53
- package/modules/localmodels/stack_view_demo.py +36 -5
- package/modules/localmodels/stack_view_events.py +147 -12
- package/modules/localmodels/stack_view_gpu.py +97 -17
- package/modules/localmodels/stack_view_llm.py +16 -1
- package/modules/localmodels/stack_view_measure.py +4 -1
- package/modules/localmodels/stack_view_schema.py +54 -8
- package/modules/localmodels/stack_view_serve.py +40 -3
- package/modules/localmodels/stack_view_slots.py +89 -10
- package/modules/localmodels/stack_view_telemetry.py +163 -0
- package/modules/localmodels/stack_view_text.py +5 -2
- package/modules/localmodels/stack_view_tick.py +658 -0
- package/modules/localmodels/stack_view_words.py +4 -0
- package/modules/localmodels/{strata-poly-serve-0.2.20-poly.5.txt → strata-poly-serve-0.2.20-poly.6.txt} +1 -1
- package/modules/localmodels/suite.py +3 -1
- package/modules/localmodels/telemetry_math.py +538 -0
- package/modules/localmodels/transport.py +3 -2
- package/modules/localmodels/tui_views.py +2 -2
- package/modules/localmodels/web/view/view.js +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/RECORD +123 -104
- package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/licenses/NOTICE +9 -0
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/localmodels/bifrost_datasheet.py +0 -53
- package/modules/localmodels/bifrost_provider.py +0 -88
- package/modules/localmodels/bifrost_unit.py +0 -99
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.5.json +0 -94
- package/modules/localmodels/gateway_switch.py +0 -51
- package/modules/localmodels/library_floor.py +0 -78
- package/modules/localmodels/service_stop.py +0 -52
- /package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev61.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
"""Fast single-tick telemetry snapshot for ``localmodels stack view --json --live-tick``.
|
|
2
|
+
|
|
3
|
+
Caches static hardware metadata (GPU names/specs/fits, host tier, deployed component metadata)
|
|
4
|
+
under the state directory for ``CACHE_TTL_S`` seconds and refreshes only live sensor readings
|
|
5
|
+
(NVML ctypes / Apple sensors, host CPU/disk/memory pressure, loopback ``/metrics`` and ``/slots``)
|
|
6
|
+
on each steady-state tick so wall latency stays well below 150 ms.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import contextlib
|
|
12
|
+
import copy
|
|
13
|
+
import datetime as dt
|
|
14
|
+
import json
|
|
15
|
+
import math
|
|
16
|
+
import os
|
|
17
|
+
import sys
|
|
18
|
+
import tempfile
|
|
19
|
+
import time
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import Any, cast
|
|
22
|
+
|
|
23
|
+
from localmodels import host_sensors, stack_view_gpu, telemetry_math
|
|
24
|
+
from localmodels.stack_view_words import say
|
|
25
|
+
|
|
26
|
+
CACHE_NAME = "stack-view-tick-cache.json"
|
|
27
|
+
CACHE_VERSION = 1
|
|
28
|
+
CACHE_TTL_S = 300.0
|
|
29
|
+
MAGPIE_REFRESH_TTL_S = 5.0
|
|
30
|
+
LOOPBACK_TIMEOUT_S = 0.4
|
|
31
|
+
METRICS_BYTES = 256 * 1024
|
|
32
|
+
_FAST_TICK_FLAGS = frozenset({"--json", "--live-tick", "--demo", "--stream"})
|
|
33
|
+
_FAST_TICK_VALUE_FLAGS = frozenset({"--interval", "--ticks"})
|
|
34
|
+
_METRICS_TASKS = frozenset({"llm", "llm_fast", "decision", "embedding", "rerank"})
|
|
35
|
+
_DEBUG_OFF_WORDS = frozenset({"", "0", "false", "off", "none", "disabled"})
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _debug_json_active(path: Path) -> bool:
|
|
39
|
+
if not path.is_file():
|
|
40
|
+
return False
|
|
41
|
+
try:
|
|
42
|
+
raw = json.loads(path.read_text(encoding="utf-8"))
|
|
43
|
+
except (OSError, ValueError):
|
|
44
|
+
return False
|
|
45
|
+
if not isinstance(raw, dict):
|
|
46
|
+
return False
|
|
47
|
+
mode = str(raw.get("mode") or "off").strip().lower()
|
|
48
|
+
return mode not in _DEBUG_OFF_WORDS
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _user_debug_config_path() -> Path:
|
|
52
|
+
if sys.platform == "win32" and (appdata := os.environ.get("APPDATA", "").strip()):
|
|
53
|
+
return Path(appdata) / "localmodels" / "debug.json"
|
|
54
|
+
xdg = os.environ.get("XDG_CONFIG_HOME", "").strip()
|
|
55
|
+
base = Path(xdg).expanduser() if xdg else Path.home() / ".config"
|
|
56
|
+
return base / "localmodels" / "debug.json"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def debug_mode_configured() -> bool:
|
|
60
|
+
"""Lightweight check matching ``debug_mode.resolve_config()`` without heavy CLI imports."""
|
|
61
|
+
env_val = os.environ.get("LOCALMODELS_DEBUG", "").strip()
|
|
62
|
+
if env_val:
|
|
63
|
+
if env_val.startswith("{"):
|
|
64
|
+
try:
|
|
65
|
+
raw = json.loads(env_val)
|
|
66
|
+
except ValueError:
|
|
67
|
+
return False
|
|
68
|
+
if not isinstance(raw, dict):
|
|
69
|
+
return False
|
|
70
|
+
return str(raw.get("mode") or "off").strip().lower() not in _DEBUG_OFF_WORDS
|
|
71
|
+
head = env_val.partition(":")[0].strip().lower()
|
|
72
|
+
return head not in _DEBUG_OFF_WORDS
|
|
73
|
+
if _debug_json_active(_state_dir() / "debug.json"):
|
|
74
|
+
return True
|
|
75
|
+
if (
|
|
76
|
+
"PYTEST_CURRENT_TEST" not in os.environ
|
|
77
|
+
or os.environ.get("LOCALMODELS_DEBUG_USER_CONFIG") == "1"
|
|
78
|
+
):
|
|
79
|
+
return _debug_json_active(_user_debug_config_path())
|
|
80
|
+
return False
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def is_fast_live_tick(argv: list[str] | None) -> bool:
|
|
84
|
+
"""True when CLI args invoke the lightweight ``stack view --json --live-tick`` fast path."""
|
|
85
|
+
if debug_mode_configured():
|
|
86
|
+
return False
|
|
87
|
+
args = sys.argv[1:] if argv is None else argv
|
|
88
|
+
if len(args) < 4 or args[0] != "stack" or args[1] != "view":
|
|
89
|
+
return False
|
|
90
|
+
has_json = False
|
|
91
|
+
has_tick = False
|
|
92
|
+
idx = 2
|
|
93
|
+
while idx < len(args):
|
|
94
|
+
tok = args[idx]
|
|
95
|
+
if tok in _FAST_TICK_FLAGS:
|
|
96
|
+
has_json = has_json or tok == "--json"
|
|
97
|
+
has_tick = has_tick or tok == "--live-tick"
|
|
98
|
+
idx += 1
|
|
99
|
+
elif tok in _FAST_TICK_VALUE_FLAGS and idx + 1 < len(args):
|
|
100
|
+
idx += 2
|
|
101
|
+
elif any(tok.startswith(f"{flag}=") for flag in _FAST_TICK_VALUE_FLAGS):
|
|
102
|
+
idx += 1
|
|
103
|
+
else:
|
|
104
|
+
return False
|
|
105
|
+
return has_json and has_tick
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _state_dir() -> Path:
|
|
109
|
+
raw = os.environ.get("LOCALMODELS_STATE")
|
|
110
|
+
if raw:
|
|
111
|
+
return Path(os.path.expanduser(raw))
|
|
112
|
+
if sys.platform == "win32":
|
|
113
|
+
base = os.environ.get("LOCALAPPDATA") or str(Path.home() / "AppData" / "Local")
|
|
114
|
+
return Path(base) / "localmodels"
|
|
115
|
+
xdg = os.environ.get("XDG_STATE_HOME")
|
|
116
|
+
return Path(xdg or Path.home() / ".local" / "state") / "localmodels"
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _now_iso() -> str:
|
|
120
|
+
return dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds")
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _state_stamp(state_root: Path) -> list[float]:
|
|
124
|
+
stamps: list[float] = []
|
|
125
|
+
for rel in ("owned.json", "stacks"):
|
|
126
|
+
target = state_root / rel
|
|
127
|
+
try:
|
|
128
|
+
stamps.append(target.stat().st_mtime)
|
|
129
|
+
except OSError:
|
|
130
|
+
stamps.append(0.0)
|
|
131
|
+
return stamps
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _load_cache(path: Path) -> dict[str, Any] | None:
|
|
135
|
+
try:
|
|
136
|
+
raw = json.loads(path.read_text(encoding="utf-8"))
|
|
137
|
+
except (OSError, ValueError):
|
|
138
|
+
return None
|
|
139
|
+
if not isinstance(raw, dict) or raw.get("version") != CACHE_VERSION:
|
|
140
|
+
return None
|
|
141
|
+
return raw
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _save_cache(path: Path, payload: dict[str, Any]) -> None:
|
|
145
|
+
try:
|
|
146
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
147
|
+
fd, tmp = tempfile.mkstemp(prefix=".tick-", suffix=".tmp", dir=str(path.parent))
|
|
148
|
+
try:
|
|
149
|
+
with os.fdopen(fd, "w", encoding="utf-8") as handle:
|
|
150
|
+
json.dump(payload, handle, separators=(",", ":"))
|
|
151
|
+
if os.name != "nt":
|
|
152
|
+
with contextlib.suppress(OSError):
|
|
153
|
+
os.chmod(tmp, 0o600)
|
|
154
|
+
os.replace(tmp, path)
|
|
155
|
+
except OSError:
|
|
156
|
+
with contextlib.suppress(OSError):
|
|
157
|
+
os.unlink(tmp)
|
|
158
|
+
except OSError:
|
|
159
|
+
return
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def _loopback_get(port: int, deploy_dir: str, path: str, limit: int) -> bytes | None:
|
|
163
|
+
import urllib.error
|
|
164
|
+
import urllib.request
|
|
165
|
+
|
|
166
|
+
request = urllib.request.Request(f"http://127.0.0.1:{port}{path}")
|
|
167
|
+
if deploy_dir:
|
|
168
|
+
key_file = Path(os.path.expanduser(deploy_dir)) / "api-key"
|
|
169
|
+
with contextlib.suppress(OSError):
|
|
170
|
+
if key_file.is_file():
|
|
171
|
+
request.add_header(
|
|
172
|
+
"Authorization", f"Bearer {key_file.read_text(encoding='utf-8').strip()}"
|
|
173
|
+
)
|
|
174
|
+
direct = urllib.request.build_opener(urllib.request.ProxyHandler({}))
|
|
175
|
+
try:
|
|
176
|
+
with direct.open(request, timeout=LOOPBACK_TIMEOUT_S) as resp:
|
|
177
|
+
body = bytes(resp.read(limit + 1))
|
|
178
|
+
except (urllib.error.URLError, OSError, ValueError):
|
|
179
|
+
return None
|
|
180
|
+
return body if len(body) <= limit else None
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _refresh_gpu_segments(gpu_doc: dict[str, Any], used_bytes: int) -> None:
|
|
184
|
+
total = int(gpu_doc.get("total_bytes") or 0)
|
|
185
|
+
gpu_doc["used_bytes"] = used_bytes
|
|
186
|
+
segments = gpu_doc.get("segments")
|
|
187
|
+
if not isinstance(segments, list) or total <= 0:
|
|
188
|
+
return
|
|
189
|
+
ours = sum(int(s.get("bytes") or 0) for s in segments if s.get("component") is not None)
|
|
190
|
+
reserve = sum(int(s.get("bytes") or 0) for s in segments if s.get("kind") == "reserve")
|
|
191
|
+
foreign = max(0, used_bytes - ours)
|
|
192
|
+
free = total - foreign - ours - reserve
|
|
193
|
+
for seg in segments:
|
|
194
|
+
kind = seg.get("kind")
|
|
195
|
+
if kind == "foreign":
|
|
196
|
+
seg["bytes"] = foreign
|
|
197
|
+
elif kind == "free":
|
|
198
|
+
seg["bytes"] = max(0, free)
|
|
199
|
+
elif kind == "over":
|
|
200
|
+
seg["bytes"] = max(0, -free)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _refresh_ram_segments(ram_doc: dict[str, Any], avail_bytes: int) -> None:
|
|
204
|
+
total = int(ram_doc.get("total_bytes") or 0)
|
|
205
|
+
ram_doc["available_bytes"] = avail_bytes
|
|
206
|
+
segments = ram_doc.get("segments")
|
|
207
|
+
if not isinstance(segments, list) or total <= 0:
|
|
208
|
+
return
|
|
209
|
+
ours = sum(int(s.get("bytes") or 0) for s in segments if s.get("component") is not None)
|
|
210
|
+
floor = sum(int(s.get("bytes") or 0) for s in segments if s.get("kind") == "reserve")
|
|
211
|
+
used = max(0, total - avail_bytes)
|
|
212
|
+
foreign = max(0, used - ours)
|
|
213
|
+
free = total - foreign - ours - floor
|
|
214
|
+
for seg in segments:
|
|
215
|
+
kind = seg.get("kind")
|
|
216
|
+
if kind == "foreign":
|
|
217
|
+
seg["bytes"] = foreign
|
|
218
|
+
elif kind == "free":
|
|
219
|
+
seg["bytes"] = max(0, free)
|
|
220
|
+
elif kind == "over":
|
|
221
|
+
seg["bytes"] = max(0, -free)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def _apply_component_metrics(
|
|
225
|
+
comp: dict[str, Any], counters: dict[str, Any]
|
|
226
|
+
) -> tuple[int, float | None, float | None]:
|
|
227
|
+
comp["state"] = "serving"
|
|
228
|
+
comp["health"] = "ok"
|
|
229
|
+
comp["perf"]["counters"] = counters
|
|
230
|
+
p_tok = counters["prompt_tokens"] or 0.0
|
|
231
|
+
p_sec = counters["prompt_seconds"] or 0.0
|
|
232
|
+
d_tok = counters["predicted_tokens"] or 0.0
|
|
233
|
+
d_sec = counters["predicted_seconds"] or 0.0
|
|
234
|
+
p_rate = p_tok / p_sec if p_tok > 0 and p_sec > 0 else counters["prompt_tokens_seconds"]
|
|
235
|
+
d_rate = d_tok / d_sec if d_tok > 0 and d_sec > 0 else counters["predicted_tokens_seconds"]
|
|
236
|
+
if p_rate and p_rate > 0:
|
|
237
|
+
comp["perf"]["prefill_tok_s"] = {
|
|
238
|
+
"value": round(p_rate, 1),
|
|
239
|
+
"basis": "live",
|
|
240
|
+
"note": say("fig.prefill.live"),
|
|
241
|
+
}
|
|
242
|
+
if d_rate and d_rate > 0:
|
|
243
|
+
comp["perf"]["decode_tok_s"] = {
|
|
244
|
+
"value": round(d_rate, 1),
|
|
245
|
+
"basis": "live",
|
|
246
|
+
"note": say("fig.decode.live"),
|
|
247
|
+
}
|
|
248
|
+
processing = int(counters["processing"] or 0)
|
|
249
|
+
deferred = (
|
|
250
|
+
float(counters["requests_deferred"]) if counters["requests_deferred"] is not None else None
|
|
251
|
+
)
|
|
252
|
+
kv_ratio = (
|
|
253
|
+
float(counters["kv_cache_usage_ratio"])
|
|
254
|
+
if comp.get("id") == "llm" and counters["kv_cache_usage_ratio"] is not None
|
|
255
|
+
else None
|
|
256
|
+
)
|
|
257
|
+
return processing, deferred, kv_ratio
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def _mark_component_unreachable(comp: dict[str, Any], ep: dict[str, Any]) -> None:
|
|
261
|
+
"""Clear stale live telemetry when a previously-serving component stops answering."""
|
|
262
|
+
if comp.get("state") != "serving":
|
|
263
|
+
return
|
|
264
|
+
comp["perf"]["counters"] = None
|
|
265
|
+
comp["live_slots"] = None
|
|
266
|
+
for key, note_key in (
|
|
267
|
+
("prefill_tok_s", "fig.prefill.none"),
|
|
268
|
+
("decode_tok_s", "fig.decode.none"),
|
|
269
|
+
):
|
|
270
|
+
fig = comp["perf"].get(key)
|
|
271
|
+
if isinstance(fig, dict) and fig.get("basis") == "live":
|
|
272
|
+
comp["perf"][key] = {"value": None, "basis": "none", "note": say(note_key)}
|
|
273
|
+
task = str(ep.get("id") or "")
|
|
274
|
+
port = int(ep.get("port") or 0)
|
|
275
|
+
deploy_dir = str(ep.get("deploy_dir") or "")
|
|
276
|
+
health_path = str(ep.get("health_path") or "/health")
|
|
277
|
+
if task in _METRICS_TASKS or _loopback_get(port, deploy_dir, health_path, 4096) is None:
|
|
278
|
+
comp["state"] = "failed"
|
|
279
|
+
comp["health"] = "unreachable"
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def _refresh_components(
|
|
283
|
+
view: dict[str, Any], endpoints: list[dict[str, Any]]
|
|
284
|
+
) -> tuple[int, list[dict[str, Any]], float | None, float | None]:
|
|
285
|
+
by_id = {c["id"]: c for c in view.get("components", []) if isinstance(c, dict)}
|
|
286
|
+
all_slots: list[dict[str, Any]] = []
|
|
287
|
+
processing_sum = 0
|
|
288
|
+
deferred_sum: float | None = None
|
|
289
|
+
kv_ratio: float | None = None
|
|
290
|
+
for ep in endpoints:
|
|
291
|
+
comp = by_id.get(ep.get("id"))
|
|
292
|
+
if comp is None:
|
|
293
|
+
continue
|
|
294
|
+
port = int(ep.get("port") or 0)
|
|
295
|
+
deploy_dir = str(ep.get("deploy_dir") or "")
|
|
296
|
+
if port <= 0:
|
|
297
|
+
continue
|
|
298
|
+
body = _loopback_get(port, deploy_dir, "/metrics", METRICS_BYTES)
|
|
299
|
+
counters = (
|
|
300
|
+
telemetry_math.parse_engine_metrics(body.decode("utf-8", "replace"))
|
|
301
|
+
if body is not None
|
|
302
|
+
else None
|
|
303
|
+
)
|
|
304
|
+
if counters is not None:
|
|
305
|
+
proc, deferred, comp_kv = _apply_component_metrics(comp, counters)
|
|
306
|
+
processing_sum += proc
|
|
307
|
+
if deferred is not None:
|
|
308
|
+
deferred_sum = (deferred_sum or 0.0) + deferred
|
|
309
|
+
if comp_kv is not None:
|
|
310
|
+
kv_ratio = comp_kv
|
|
311
|
+
else:
|
|
312
|
+
_mark_component_unreachable(comp, ep)
|
|
313
|
+
if ep.get("id") in ("llm", "llm_fast"):
|
|
314
|
+
if comp.get("state") != "serving":
|
|
315
|
+
comp["live_slots"] = None
|
|
316
|
+
continue
|
|
317
|
+
from localmodels import stack_view_slots
|
|
318
|
+
|
|
319
|
+
s_body = _loopback_get(port, deploy_dir, "/slots", stack_view_slots.SLOTS_BYTES)
|
|
320
|
+
parsed = (
|
|
321
|
+
stack_view_slots.parse(s_body.decode("utf-8", "replace"))
|
|
322
|
+
if s_body is not None
|
|
323
|
+
else None
|
|
324
|
+
)
|
|
325
|
+
if parsed is not None:
|
|
326
|
+
comp["live_slots"] = parsed
|
|
327
|
+
all_slots.extend(cast(list[dict[str, Any]], parsed))
|
|
328
|
+
else:
|
|
329
|
+
comp["live_slots"] = None
|
|
330
|
+
return processing_sum, all_slots, deferred_sum, kv_ratio
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def _refresh_gateway(view: dict[str, Any], cache: dict[str, Any], now_wall: float) -> None:
|
|
334
|
+
"""Refresh gateway events/waterfall/p50 TTFT on warm ticks instead of freezing for 300 s."""
|
|
335
|
+
owned = cache.get("gateway_owned")
|
|
336
|
+
if not isinstance(owned, dict):
|
|
337
|
+
return
|
|
338
|
+
gw_map = owned.get("gateway")
|
|
339
|
+
if not isinstance(gw_map, dict):
|
|
340
|
+
return
|
|
341
|
+
magpie_addr = cache.get("magpie_addr")
|
|
342
|
+
has_bifrost = bool(gw_map.get("bifrost"))
|
|
343
|
+
if not has_bifrost:
|
|
344
|
+
if not magpie_addr or not gw_map.get("providers"):
|
|
345
|
+
return
|
|
346
|
+
last_at = float(cache.get("gateway_at") or 0.0)
|
|
347
|
+
if now_wall - last_at < MAGPIE_REFRESH_TTL_S:
|
|
348
|
+
return
|
|
349
|
+
from localmodels import stack_view_events
|
|
350
|
+
|
|
351
|
+
events, wf = stack_view_events.read_with_waterfall(
|
|
352
|
+
cast(Any, owned), str(magpie_addr) if isinstance(magpie_addr, str) else None
|
|
353
|
+
)
|
|
354
|
+
if not wf and events:
|
|
355
|
+
model_map = {
|
|
356
|
+
c["id"]: c["model"]
|
|
357
|
+
for c in view.get("components", [])
|
|
358
|
+
if isinstance(c, dict) and "id" in c and "model" in c
|
|
359
|
+
}
|
|
360
|
+
wf = stack_view_events.waterfall_from_events(
|
|
361
|
+
events, model_by_component=model_map, basis="live"
|
|
362
|
+
)
|
|
363
|
+
view["events"] = events
|
|
364
|
+
view["waterfall"] = wf
|
|
365
|
+
p50 = telemetry_math.p50_ttft_ms(wf, now=view["generated_at"])
|
|
366
|
+
view["p50_ttft_ms"] = p50
|
|
367
|
+
if isinstance(view.get("gateway"), dict):
|
|
368
|
+
view["gateway"]["p50_ttft_ms"] = p50
|
|
369
|
+
cache["gateway_at"] = now_wall
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def _apply_warm_tick(
|
|
373
|
+
cache: dict[str, Any], sensor_state: dict[str, Any]
|
|
374
|
+
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
375
|
+
view: dict[str, Any] = copy.deepcopy(cache["base_view"])
|
|
376
|
+
view["generated_at"] = _now_iso()
|
|
377
|
+
gpu_loads = stack_view_gpu.read() if view.get("gpus") else []
|
|
378
|
+
view["gpu_load"] = gpu_loads
|
|
379
|
+
|
|
380
|
+
load_by_idx = {g["index"]: g for g in gpu_loads}
|
|
381
|
+
for gpu_doc in view.get("gpus", []):
|
|
382
|
+
row = load_by_idx.get(gpu_doc.get("index"))
|
|
383
|
+
used = row.get("vram_used_bytes") if row else None
|
|
384
|
+
if isinstance(used, int):
|
|
385
|
+
_refresh_gpu_segments(gpu_doc, used)
|
|
386
|
+
|
|
387
|
+
avail_ram = host_sensors.read_live_ram_available_bytes()
|
|
388
|
+
if avail_ram is not None and isinstance(view.get("ram"), dict):
|
|
389
|
+
_refresh_ram_segments(view["ram"], avail_ram)
|
|
390
|
+
if isinstance(view.get("what_if"), dict):
|
|
391
|
+
view["what_if"]["host_ram_available_bytes"] = avail_ram
|
|
392
|
+
|
|
393
|
+
endpoints = cache.get("endpoints") or []
|
|
394
|
+
processing_sum, all_slots, deferred_sum, kv_ratio = _refresh_components(view, endpoints)
|
|
395
|
+
_refresh_gateway(view, cache, time.time())
|
|
396
|
+
liveness = {
|
|
397
|
+
c["id"]: ("active" if c["state"] == "serving" else c["state"], c["health"])
|
|
398
|
+
for c in view.get("components", [])
|
|
399
|
+
if isinstance(c, dict)
|
|
400
|
+
}
|
|
401
|
+
sensors, next_sensor_state = host_sensors.collect(
|
|
402
|
+
liveness=liveness or None, prev_state=sensor_state
|
|
403
|
+
)
|
|
404
|
+
view["sensors"] = sensors
|
|
405
|
+
|
|
406
|
+
waterfall = cast(list[telemetry_math.WaterfallEntry], view.get("waterfall") or [])
|
|
407
|
+
busy_slots = sum(1 for s in all_slots if s.get("busy"))
|
|
408
|
+
streaming_wf = sum(1 for w in waterfall if w.get("status") == "streaming")
|
|
409
|
+
in_flight = max(processing_sum, busy_slots, streaming_wf)
|
|
410
|
+
view["in_flight"] = in_flight
|
|
411
|
+
view["client_lanes"] = telemetry_math.client_lanes(waterfall, in_flight)
|
|
412
|
+
|
|
413
|
+
llm_comp = next((c for c in view.get("components", []) if c.get("id") == "llm"), None)
|
|
414
|
+
decode_fig = llm_comp["perf"]["decode_tok_s"] if llm_comp else None
|
|
415
|
+
active_bytes = cache.get("active_weight_bytes")
|
|
416
|
+
eff_bw = telemetry_math.effective_decode_bw_gb_s(
|
|
417
|
+
decode_fig, int(active_bytes) if isinstance(active_bytes, int) else None
|
|
418
|
+
)
|
|
419
|
+
view["effective_decode_bw_gb_s"] = eff_bw
|
|
420
|
+
|
|
421
|
+
bw_ceiling = view.get("memory_bw_ceiling_gb_s", {})
|
|
422
|
+
primary_gpu = (
|
|
423
|
+
llm_comp.get("gpu")
|
|
424
|
+
if llm_comp is not None
|
|
425
|
+
else (view["gpus"][0]["index"] if view.get("gpus") else None)
|
|
426
|
+
)
|
|
427
|
+
gpu_row = (
|
|
428
|
+
load_by_idx.get(primary_gpu)
|
|
429
|
+
if primary_gpu is not None
|
|
430
|
+
else (gpu_loads[0] if gpu_loads else None)
|
|
431
|
+
)
|
|
432
|
+
view["bottleneck"] = telemetry_math.classify_bottleneck(
|
|
433
|
+
in_flight=in_flight,
|
|
434
|
+
decode_tok_s=decode_fig["value"] if isinstance(decode_fig, dict) else None,
|
|
435
|
+
effective_bw_gb_s=eff_bw["value"],
|
|
436
|
+
bw_ceiling_gb_s=bw_ceiling.get("value") if isinstance(bw_ceiling, dict) else None,
|
|
437
|
+
gpu_util_pct=gpu_row["util_pct"] if gpu_row else None,
|
|
438
|
+
mem_ctrl_util_pct=gpu_row.get("mem_ctrl_util_pct") if gpu_row else None,
|
|
439
|
+
disk_read_mb_s=sensors["disk"]["read_mb_s"]["value"],
|
|
440
|
+
)
|
|
441
|
+
view["requests_deferred"] = (
|
|
442
|
+
{
|
|
443
|
+
"value": round(deferred_sum, 1),
|
|
444
|
+
"basis": "live",
|
|
445
|
+
"note": say("fig.deferred.live"),
|
|
446
|
+
}
|
|
447
|
+
if deferred_sum is not None
|
|
448
|
+
else {"value": None, "basis": "none", "note": say("fig.deferred.none")}
|
|
449
|
+
)
|
|
450
|
+
view["kv_cache_usage_ratio"] = (
|
|
451
|
+
{
|
|
452
|
+
"value": round(kv_ratio, 3),
|
|
453
|
+
"basis": "live",
|
|
454
|
+
"note": say("fig.kv_ratio.live"),
|
|
455
|
+
}
|
|
456
|
+
if kv_ratio is not None
|
|
457
|
+
else {"value": None, "basis": "none", "note": say("fig.kv_ratio.none")}
|
|
458
|
+
)
|
|
459
|
+
view["prefix_hit_pct"] = telemetry_math.prefix_hit_pct(waterfall, all_slots)
|
|
460
|
+
if isinstance(view.get("gateway"), dict):
|
|
461
|
+
view["gateway"]["in_flight"] = in_flight
|
|
462
|
+
view["gateway"]["client_lanes"] = view["client_lanes"]
|
|
463
|
+
return view, next_sensor_state
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
def _cold_build(
|
|
467
|
+
state_root: Path, prev_sensor_state: dict[str, Any]
|
|
468
|
+
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
469
|
+
from localmodels import stack_run, stack_view, stack_view_llm
|
|
470
|
+
|
|
471
|
+
_, plan = stack_run.latest()
|
|
472
|
+
reading = stack_view.read_live()
|
|
473
|
+
sensors, next_sensor_state = host_sensors.collect(
|
|
474
|
+
liveness=reading["liveness"] or None, prev_state=prev_sensor_state
|
|
475
|
+
)
|
|
476
|
+
reading["sensors"] = sensors
|
|
477
|
+
view = cast(dict[str, Any], stack_view.render(reading))
|
|
478
|
+
endpoints: list[dict[str, Any]] = []
|
|
479
|
+
active_bytes: int | None = None
|
|
480
|
+
magpie_addr: str | None = None
|
|
481
|
+
if plan is not None:
|
|
482
|
+
active_bytes = stack_view_llm.active_weight_bytes(plan["llm"])
|
|
483
|
+
if plan["options"].get("gateway", "magpie") == "magpie":
|
|
484
|
+
magpie_addr = plan["harness"]["gateway"]["addr"]
|
|
485
|
+
for task, part in stack_view.parts_of(plan):
|
|
486
|
+
endpoints.append(
|
|
487
|
+
{
|
|
488
|
+
"id": task,
|
|
489
|
+
"port": part["service"]["port"],
|
|
490
|
+
"deploy_dir": part["service"]["deploy_dir"],
|
|
491
|
+
"health_path": part["endpoint"].get("health", "/health"),
|
|
492
|
+
}
|
|
493
|
+
)
|
|
494
|
+
owned = reading.get("owned")
|
|
495
|
+
gateway_owned = (
|
|
496
|
+
{"gateway": copy.deepcopy(owned["gateway"])}
|
|
497
|
+
if isinstance(owned, dict) and isinstance(owned.get("gateway"), dict)
|
|
498
|
+
else None
|
|
499
|
+
)
|
|
500
|
+
now_wall = time.time()
|
|
501
|
+
cache_doc = {
|
|
502
|
+
"version": CACHE_VERSION,
|
|
503
|
+
"cached_at": now_wall,
|
|
504
|
+
"gateway_at": now_wall,
|
|
505
|
+
"state_stamp": _state_stamp(state_root),
|
|
506
|
+
"base_view": view,
|
|
507
|
+
"endpoints": endpoints,
|
|
508
|
+
"active_weight_bytes": active_bytes,
|
|
509
|
+
"gateway_owned": gateway_owned,
|
|
510
|
+
"magpie_addr": magpie_addr,
|
|
511
|
+
"sensor_state": next_sensor_state,
|
|
512
|
+
}
|
|
513
|
+
return view, cache_doc
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
def _is_cache_warm(
|
|
517
|
+
cached: dict[str, Any] | None, stamp: list[float], now_wall: float, ttl_s: float
|
|
518
|
+
) -> bool:
|
|
519
|
+
return (
|
|
520
|
+
cached is not None
|
|
521
|
+
and isinstance(cached.get("base_view"), dict)
|
|
522
|
+
and isinstance(cached.get("cached_at"), int | float)
|
|
523
|
+
and (now_wall - float(cached["cached_at"])) < ttl_s
|
|
524
|
+
and cached.get("state_stamp") == stamp
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
def _step_live_tick(
|
|
529
|
+
root: Path,
|
|
530
|
+
cache_path: Path,
|
|
531
|
+
cached: dict[str, Any] | None,
|
|
532
|
+
*,
|
|
533
|
+
ttl_s: float,
|
|
534
|
+
persist_warm: bool,
|
|
535
|
+
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
536
|
+
stamp = _state_stamp(root)
|
|
537
|
+
now_wall = time.time()
|
|
538
|
+
prev_sensor = (
|
|
539
|
+
cached["sensor_state"] if cached and isinstance(cached.get("sensor_state"), dict) else {}
|
|
540
|
+
)
|
|
541
|
+
if _is_cache_warm(cached, stamp, now_wall, ttl_s) and cached is not None:
|
|
542
|
+
view, next_sensor = _apply_warm_tick(cached, prev_sensor)
|
|
543
|
+
cached["sensor_state"] = next_sensor
|
|
544
|
+
if persist_warm:
|
|
545
|
+
_save_cache(cache_path, cached)
|
|
546
|
+
return view, cached
|
|
547
|
+
view, cache_doc = _cold_build(root, prev_sensor)
|
|
548
|
+
_save_cache(cache_path, cache_doc)
|
|
549
|
+
return view, cache_doc
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
def collect_live_tick(*, state_dir: Path | None = None, ttl_s: float = CACHE_TTL_S) -> Any:
|
|
553
|
+
"""Return one ``localmodels.stack-view/v1`` (v1.1) snapshot, fast-pathing via cached static hw."""
|
|
554
|
+
root = state_dir or _state_dir()
|
|
555
|
+
cache_path = root / CACHE_NAME
|
|
556
|
+
view, _ = _step_live_tick(
|
|
557
|
+
root, cache_path, _load_cache(cache_path), ttl_s=ttl_s, persist_warm=True
|
|
558
|
+
)
|
|
559
|
+
return view
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
def _parse_flag_value(argv: list[str], flag: str) -> str | None:
|
|
563
|
+
for idx, token in enumerate(argv):
|
|
564
|
+
if token == flag and idx + 1 < len(argv):
|
|
565
|
+
return argv[idx + 1]
|
|
566
|
+
if token.startswith(f"{flag}="):
|
|
567
|
+
return token.split("=", 1)[1]
|
|
568
|
+
return None
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
def _parse_cli_options(argv: list[str]) -> tuple[bool, bool, float, int]:
|
|
572
|
+
is_demo = "--demo" in argv
|
|
573
|
+
stream = "--stream" in argv
|
|
574
|
+
raw_interval = _parse_flag_value(argv, "--interval")
|
|
575
|
+
raw_ticks = _parse_flag_value(argv, "--ticks")
|
|
576
|
+
if raw_interval is not None:
|
|
577
|
+
try:
|
|
578
|
+
interval = float(raw_interval)
|
|
579
|
+
except ValueError as exc:
|
|
580
|
+
raise ValueError(f"--interval must be a positive number: {raw_interval!r}") from exc
|
|
581
|
+
else:
|
|
582
|
+
interval = 0.5 if is_demo else 1.0
|
|
583
|
+
if not math.isfinite(interval) or interval <= 0:
|
|
584
|
+
raise ValueError("--interval must be greater than 0")
|
|
585
|
+
if raw_ticks is not None:
|
|
586
|
+
try:
|
|
587
|
+
max_ticks = int(raw_ticks)
|
|
588
|
+
except ValueError as exc:
|
|
589
|
+
raise ValueError(f"--ticks must be a non-negative integer: {raw_ticks!r}") from exc
|
|
590
|
+
else:
|
|
591
|
+
max_ticks = 0 if stream else 1
|
|
592
|
+
if max_ticks < 0:
|
|
593
|
+
raise ValueError("--ticks must be >= 0")
|
|
594
|
+
return is_demo, stream, interval, max_ticks
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
def _silence_broken_pipe() -> None:
|
|
598
|
+
with contextlib.suppress(OSError, ValueError):
|
|
599
|
+
os.dup2(os.open(os.devnull, os.O_WRONLY), sys.stdout.fileno())
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
def _stream_live_ticks(is_demo: bool, interval: float, max_ticks: int) -> None:
|
|
603
|
+
root = _state_dir()
|
|
604
|
+
cache_path = root / CACHE_NAME
|
|
605
|
+
cached: dict[str, Any] | None = None if is_demo else _load_cache(cache_path)
|
|
606
|
+
emitted = 0
|
|
607
|
+
try:
|
|
608
|
+
while max_ticks == 0 or emitted < max_ticks:
|
|
609
|
+
tick_start = time.monotonic()
|
|
610
|
+
if is_demo:
|
|
611
|
+
from localmodels import stack_view_demo
|
|
612
|
+
|
|
613
|
+
payload: Any = stack_view_demo.view()
|
|
614
|
+
else:
|
|
615
|
+
payload, cached = _step_live_tick(
|
|
616
|
+
root, cache_path, cached, ttl_s=CACHE_TTL_S, persist_warm=False
|
|
617
|
+
)
|
|
618
|
+
sys.stdout.write(json.dumps(payload, ensure_ascii=False, separators=(",", ":")) + "\n")
|
|
619
|
+
sys.stdout.flush()
|
|
620
|
+
emitted += 1
|
|
621
|
+
if max_ticks and emitted >= max_ticks:
|
|
622
|
+
break
|
|
623
|
+
remaining = interval - (time.monotonic() - tick_start)
|
|
624
|
+
if remaining > 0:
|
|
625
|
+
time.sleep(remaining)
|
|
626
|
+
finally:
|
|
627
|
+
if not is_demo and cached is not None:
|
|
628
|
+
_save_cache(cache_path, cached)
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
def cli(argv: list[str]) -> int:
|
|
632
|
+
"""Fast CLI entry for ``localmodels stack view --json --live-tick [--stream]``."""
|
|
633
|
+
try:
|
|
634
|
+
is_demo, stream, interval, max_ticks = _parse_cli_options(argv)
|
|
635
|
+
except ValueError as exc:
|
|
636
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
637
|
+
return 2
|
|
638
|
+
|
|
639
|
+
try:
|
|
640
|
+
if not stream and max_ticks <= 1:
|
|
641
|
+
if is_demo:
|
|
642
|
+
from localmodels import stack_view_demo
|
|
643
|
+
|
|
644
|
+
payload: Any = stack_view_demo.view()
|
|
645
|
+
else:
|
|
646
|
+
payload = collect_live_tick()
|
|
647
|
+
json.dump(payload, sys.stdout, ensure_ascii=False, indent=1)
|
|
648
|
+
sys.stdout.write("\n")
|
|
649
|
+
sys.stdout.flush()
|
|
650
|
+
return 0
|
|
651
|
+
_stream_live_ticks(is_demo, interval, max_ticks)
|
|
652
|
+
except KeyboardInterrupt:
|
|
653
|
+
print("interrupted", file=sys.stderr)
|
|
654
|
+
return 130
|
|
655
|
+
except BrokenPipeError:
|
|
656
|
+
_silence_broken_pipe()
|
|
657
|
+
return 141
|
|
658
|
+
return 0
|
|
@@ -110,6 +110,10 @@ WORDS: dict[str, str] = {
|
|
|
110
110
|
),
|
|
111
111
|
"fig.demo": "Demo data, not a measurement",
|
|
112
112
|
"fig.gateway": "Bifrost request log: the last {n} calls",
|
|
113
|
+
"fig.kv_ratio.live": "The service's /metrics: live KV cache usage ratio",
|
|
114
|
+
"fig.kv_ratio.none": "KV cache usage ratio not reported by the service",
|
|
115
|
+
"fig.deferred.live": "The service's /metrics: requests deferred waiting for a slot",
|
|
116
|
+
"fig.deferred.none": "Deferred request count not reported by the service",
|
|
113
117
|
"state.undeployed": "not deployed",
|
|
114
118
|
"alert.down": "{names} is not running",
|
|
115
119
|
"alert.down.many": "{names} are not running",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# PolyStrata 0.2.20-poly.
|
|
1
|
+
# PolyStrata 0.2.20-poly.6's Python server (terminal/serve/server.py, MIT) for strata-poly LLM
|
|
2
2
|
# recipes: jinja2 3.1.6 (BSD-3-Clause) with markupsafe 3.0.3 (BSD-3-Clause) renders the chat
|
|
3
3
|
# template, regex 2026.9.10 (Apache-2.0 and CNRI-Python) drives its tokenizer, psutil 7.2.2
|
|
4
4
|
# (BSD-3-Clause) reads memory for its status page, and pillow (MIT-CMU; 13.0.0 on Python 3.11+,
|
|
@@ -339,8 +339,10 @@ def _profile_template(
|
|
|
339
339
|
# strata-<model>.json's default for requests that name none (Strata DETAILS, v0.2.4).
|
|
340
340
|
profile_template["reasoning_budget_tokens"] = options.reasoning_budget
|
|
341
341
|
if r["runtime"] == "strata-poly":
|
|
342
|
-
# PolyStrata's server enables prompt-start warm-up only when opt-in warm_start is true
|
|
342
|
+
# PolyStrata's server enables prompt-start warm-up only when opt-in warm_start is true,
|
|
343
|
+
# and maps parallel: 2 to --batch 2 (WHI-1059 / WHI-1012).
|
|
343
344
|
profile_template.setdefault("warm_start", True)
|
|
345
|
+
profile_template.setdefault("parallel", 2)
|
|
344
346
|
return profile_template
|
|
345
347
|
|
|
346
348
|
|