@simplexai/localmodels-linux-x64 0.1.0-dev.32.build.git0f60eee490864cf83e343f8db13a335676a19dd8 → 0.1.0-dev.35
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 +138 -97
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +4 -0
- package/modules/localmodels/app.py +7 -2
- package/modules/localmodels/approval.py +4 -4
- package/modules/localmodels/bifrost_checks.py +121 -3
- package/modules/localmodels/bifrost_provider.py +53 -0
- package/modules/localmodels/bifrost_unit.py +32 -1
- package/modules/localmodels/budget.py +5 -1
- package/modules/localmodels/catalog.json +51 -10
- package/modules/localmodels/catalog.py +30 -29
- package/modules/localmodels/catalog_add.py +1 -0
- package/modules/localmodels/cli_parser.py +10 -2
- package/modules/localmodels/component.py +7 -1
- package/modules/localmodels/decode_calibration.json +6 -0
- package/modules/localmodels/decode_calibration.py +104 -0
- package/modules/localmodels/deploy.py +44 -7
- package/modules/localmodels/deploy_steps.py +10 -1
- package/modules/localmodels/engines-strata-0.1.49.2.json +31 -0
- package/modules/localmodels/engines.json +57 -1
- package/modules/localmodels/engines.py +6 -2
- package/modules/localmodels/estimator.py +21 -7
- package/modules/localmodels/frontend.py +4 -4
- package/modules/localmodels/gateway.py +14 -4
- package/modules/localmodels/gateway_app_bifrost.py +4 -3
- package/modules/localmodels/gateway_bifrost.py +70 -57
- package/modules/localmodels/gateway_probe.py +3 -4
- package/modules/localmodels/gguf.py +7 -0
- package/modules/localmodels/harness.py +24 -25
- package/modules/localmodels/harness_gateway.py +19 -10
- package/modules/localmodels/harness_probe.py +33 -6
- package/modules/localmodels/hosts.py +73 -9
- package/modules/localmodels/install.py +36 -6
- package/modules/localmodels/library_cli.py +179 -0
- package/modules/localmodels/library_convert.py +132 -0
- package/modules/localmodels/library_gateway.py +471 -0
- package/modules/localmodels/library_jobs.py +314 -0
- package/modules/localmodels/library_model.py +246 -0
- package/modules/localmodels/library_pricing.py +347 -0
- package/modules/localmodels/library_serve.py +348 -0
- package/modules/localmodels/library_state.py +373 -0
- package/modules/localmodels/library_status.py +349 -0
- package/modules/localmodels/llm_rank.py +16 -2
- package/modules/localmodels/memcalc.py +7 -30
- package/modules/localmodels/metal.py +26 -0
- package/modules/localmodels/plan_envelope.py +4 -1
- package/modules/localmodels/preparation.py +49 -0
- package/modules/localmodels/probe.py +8 -8
- package/modules/localmodels/process_identity.py +536 -9
- package/modules/localmodels/quant_formats.py +123 -0
- package/modules/localmodels/recommend_cli.py +8 -4
- package/modules/localmodels/records.py +1 -0
- package/modules/localmodels/remote_ops.py +104 -6
- package/modules/localmodels/remote_ops_download.py +17 -2
- package/modules/localmodels/remote_ops_prepare.py +406 -0
- package/modules/localmodels/remote_ops_remove.py +40 -7
- package/modules/localmodels/remote_ops_service.py +110 -8
- package/modules/localmodels/remote_ops_verify.py +15 -2
- package/modules/localmodels/runtime_auth.py +31 -1
- package/modules/localmodels/runtime_cli.py +3 -4
- package/modules/localmodels/runtime_io.py +50 -6
- package/modules/localmodels/service_autostart.py +45 -1
- package/modules/localmodels/service_control.py +13 -0
- package/modules/localmodels/service_deployment.py +12 -3
- package/modules/localmodels/service_jobs.py +33 -4
- package/modules/localmodels/service_probe.py +67 -13
- package/modules/localmodels/service_stop.py +152 -0
- package/modules/localmodels/service_worker.py +9 -1
- package/modules/localmodels/services_cli.py +50 -6
- package/modules/localmodels/setup_inspection.py +34 -25
- package/modules/localmodels/setup_text.py +118 -0
- package/modules/localmodels/sizecalc.py +625 -0
- package/modules/localmodels/sizecalc_cli.py +249 -0
- package/modules/localmodels/stack.py +69 -17
- package/modules/localmodels/stack_args.py +91 -19
- package/modules/localmodels/stack_auto.py +78 -0
- package/modules/localmodels/stack_binding.py +23 -35
- package/modules/localmodels/stack_card.py +195 -0
- package/modules/localmodels/stack_cleanup.py +379 -0
- package/modules/localmodels/stack_clients.py +4 -1
- package/modules/localmodels/stack_compose.py +150 -194
- package/modules/localmodels/stack_console.py +2 -0
- package/modules/localmodels/stack_decision.py +3 -2
- package/modules/localmodels/stack_down.py +189 -0
- package/modules/localmodels/stack_events.py +54 -0
- package/modules/localmodels/stack_hardware.py +22 -23
- package/modules/localmodels/stack_journal.py +29 -8
- package/modules/localmodels/stack_ledger.py +411 -0
- package/modules/localmodels/stack_lifecycle.py +162 -167
- package/modules/localmodels/stack_llm_ram.py +57 -5
- package/modules/localmodels/stack_memory.py +721 -0
- package/modules/localmodels/stack_picks.py +139 -0
- package/modules/localmodels/stack_plan.py +140 -22
- package/modules/localmodels/stack_ports.py +22 -0
- package/modules/localmodels/stack_preflight.py +699 -0
- package/modules/localmodels/stack_review.py +123 -5
- package/modules/localmodels/stack_rollback.py +2 -0
- package/modules/localmodels/stack_route.py +256 -0
- package/modules/localmodels/stack_run.py +11 -0
- package/modules/localmodels/stack_suite.py +102 -17
- package/modules/localmodels/stack_summary.py +65 -4
- package/modules/localmodels/stack_try.py +354 -0
- package/modules/localmodels/stack_try_client.py +194 -0
- package/modules/localmodels/stack_try_docs.py +139 -0
- package/modules/localmodels/stack_up.py +8 -1
- package/modules/localmodels/stack_update.py +29 -4
- package/modules/localmodels/stack_verify.py +3 -1
- package/modules/localmodels/stack_view.py +10 -11
- package/modules/localmodels/stack_view_apply.py +4 -2
- package/modules/localmodels/stack_view_events.py +2 -1
- package/modules/localmodels/stack_view_serve.py +3 -0
- package/modules/localmodels/stack_view_text.py +1 -1
- package/modules/localmodels/stack_view_words.py +4 -1
- package/modules/localmodels/stack_warm.py +574 -0
- package/modules/localmodels/stack_whatif.py +558 -0
- package/modules/localmodels/suite.py +48 -39
- package/modules/localmodels/tool_archive.py +40 -0
- package/modules/localmodels/tools.json +8 -0
- package/modules/localmodels/transport.py +1 -0
- package/modules/localmodels/vision.py +8 -1
- package/modules/localmodels/web/sizecalc/app.js +431 -0
- package/modules/localmodels/web/sizecalc/calc.js +269 -0
- package/modules/localmodels/web/sizecalc/page.html +362 -0
- package/modules/localmodels/web/view/ASSET-SOURCES.md +11 -0
- package/modules/localmodels/web/view/i18n.js +1 -1
- package/modules/localmodels/web/view/logo-claude.svg +3 -0
- package/modules/localmodels/web/view/logo-codex.png +0 -0
- package/modules/localmodels/web/view/logo-pi.svg +6 -0
- package/modules/localmodels/web/view/view.css +4 -0
- package/modules/localmodels/web/view/view.js +15 -6
- package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/METADATA +1 -1
- package/modules/simplex_localmodels-0.1.0.dev35.dist-info/RECORD +241 -0
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/simplex_localmodels-0.1.0.dev32.dist-info/RECORD +0 -200
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev32.dist-info → simplex_localmodels-0.1.0.dev35.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -27,6 +27,7 @@ from localmodels.gateway_bifrost import (
|
|
|
27
27
|
AUX_PROVIDERS,
|
|
28
28
|
CALLER_KEY,
|
|
29
29
|
COMPLEX_RULE,
|
|
30
|
+
FAST_PROVIDER,
|
|
30
31
|
PI_MODEL,
|
|
31
32
|
admin_password,
|
|
32
33
|
healthy,
|
|
@@ -85,10 +86,12 @@ def logged_after(addr: str, provider: str, before: int | None) -> int | None:
|
|
|
85
86
|
return after
|
|
86
87
|
|
|
87
88
|
|
|
88
|
-
def _routed_log(addr: str, provider: str, since: str) -> dict[str, Any] | None:
|
|
89
|
+
def _routed_log(addr: str, provider: str | None, since: str) -> dict[str, Any] | None:
|
|
89
90
|
for _ in range(10):
|
|
90
91
|
with contextlib.suppress(urllib.error.URLError, OSError, ValueError):
|
|
91
|
-
for row in logs(
|
|
92
|
+
for row in logs(
|
|
93
|
+
addr, objects="chat_completion", **({"providers": provider} if provider else {})
|
|
94
|
+
):
|
|
92
95
|
if str(row.get("timestamp", "")) >= since and row.get("routing_rule_id") in (
|
|
93
96
|
COMPLEX_RULE,
|
|
94
97
|
AGENT_RULE,
|
|
@@ -98,6 +101,115 @@ def _routed_log(addr: str, provider: str, since: str) -> dict[str, Any] | None:
|
|
|
98
101
|
return None
|
|
99
102
|
|
|
100
103
|
|
|
104
|
+
def tier_routes(gw: harness.GatewayPlan, timeout: float) -> list[Check]:
|
|
105
|
+
"""Each fresh turn must hit the target for the tier the installed classifier returned."""
|
|
106
|
+
fast = gw.get("llm_fast")
|
|
107
|
+
if fast is None:
|
|
108
|
+
return []
|
|
109
|
+
checks: list[Check] = []
|
|
110
|
+
targets = {
|
|
111
|
+
"SIMPLE": (FAST_PROVIDER, fast["model"], AGENT_RULE),
|
|
112
|
+
"MEDIUM": (FAST_PROVIDER, fast["model"], AGENT_RULE),
|
|
113
|
+
"COMPLEX": (gw["llm_provider"], gw["llm"]["model"], COMPLEX_RULE),
|
|
114
|
+
}
|
|
115
|
+
for label, prompt in (
|
|
116
|
+
("easy", "Hello! What is the capital of France?"),
|
|
117
|
+
(
|
|
118
|
+
"hard",
|
|
119
|
+
"Design a distributed database architecture with serializable transactions across "
|
|
120
|
+
"regions. Prove correctness under network partitions and derive its consistency "
|
|
121
|
+
"and availability tradeoffs, with a detailed multi-step failure analysis.",
|
|
122
|
+
),
|
|
123
|
+
):
|
|
124
|
+
try:
|
|
125
|
+
before = {
|
|
126
|
+
json.dumps(row, sort_keys=True)
|
|
127
|
+
for row in logs(gw["addr"], objects="chat_completion")
|
|
128
|
+
}
|
|
129
|
+
gateway_requests.post(
|
|
130
|
+
f"http://{gw['addr']}/v1/chat/completions",
|
|
131
|
+
{
|
|
132
|
+
"model": AGENT_MODEL,
|
|
133
|
+
"messages": [
|
|
134
|
+
{"role": "user", "content": f"{prompt} (check {uuid.uuid4().hex})"}
|
|
135
|
+
],
|
|
136
|
+
"max_tokens": 512,
|
|
137
|
+
"temperature": 0,
|
|
138
|
+
},
|
|
139
|
+
CALLER_KEY,
|
|
140
|
+
timeout,
|
|
141
|
+
)
|
|
142
|
+
matched = None
|
|
143
|
+
for _ in range(10):
|
|
144
|
+
matched = next(
|
|
145
|
+
(
|
|
146
|
+
row
|
|
147
|
+
for row in logs(gw["addr"], objects="chat_completion")
|
|
148
|
+
if json.dumps(row, sort_keys=True) not in before
|
|
149
|
+
and row.get("status") == "success"
|
|
150
|
+
and row.get("complexity_mechanism") == "decision"
|
|
151
|
+
and targets.get(str(row.get("complexity_tier")))
|
|
152
|
+
== (row.get("provider"), row.get("model"), row.get("routing_rule_id"))
|
|
153
|
+
),
|
|
154
|
+
None,
|
|
155
|
+
)
|
|
156
|
+
if matched is not None:
|
|
157
|
+
break
|
|
158
|
+
time.sleep(1)
|
|
159
|
+
checks.append(
|
|
160
|
+
{
|
|
161
|
+
"check": f"gateway {label} tier target",
|
|
162
|
+
"ok": matched is not None,
|
|
163
|
+
"detail": (
|
|
164
|
+
f"Bifrost log confirmed {matched['complexity_tier']} → "
|
|
165
|
+
f"{matched['provider']}/{matched['model']} via {matched['routing_rule_id']}"
|
|
166
|
+
if matched
|
|
167
|
+
else "no fresh successful decision tier mapped to its approved target"
|
|
168
|
+
),
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
except (urllib.error.URLError, OSError, ValueError) as exc:
|
|
172
|
+
checks.append(
|
|
173
|
+
{
|
|
174
|
+
"check": f"gateway {label} tier target",
|
|
175
|
+
"ok": False,
|
|
176
|
+
"detail": f"{type(exc).__name__}: tier request or request log unavailable",
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
return checks
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def direct_targets(gw: harness.GatewayPlan, timeout: float) -> list[Check]:
|
|
183
|
+
"""Both chat services must answer directly, even when all classified turns pick one tier."""
|
|
184
|
+
fast = gw.get("llm_fast")
|
|
185
|
+
if fast is None:
|
|
186
|
+
return []
|
|
187
|
+
checks: list[Check] = []
|
|
188
|
+
for role, endpoint, path in (
|
|
189
|
+
("primary", gw["llm"], gw.get("llm_key_file", "")),
|
|
190
|
+
("fastest", fast, gw["llm_fast_key_file"]),
|
|
191
|
+
):
|
|
192
|
+
try:
|
|
193
|
+
secret = Path(path).expanduser().read_text(encoding="utf-8").strip()
|
|
194
|
+
answer = gateway_requests.post(
|
|
195
|
+
endpoint["url"].rstrip("/") + "/chat/completions",
|
|
196
|
+
{
|
|
197
|
+
"model": endpoint["model"],
|
|
198
|
+
"messages": [{"role": "user", "content": TOUCH_PROMPT}],
|
|
199
|
+
"max_tokens": 512,
|
|
200
|
+
"temperature": 0,
|
|
201
|
+
},
|
|
202
|
+
secret,
|
|
203
|
+
timeout,
|
|
204
|
+
)
|
|
205
|
+
ok = TOUCH_EXPECT in gateway_requests.text(answer).lower()
|
|
206
|
+
detail = f"{endpoint['model']} {'answered' if ok else 'failed its readiness question'}"
|
|
207
|
+
except (OSError, ValueError) as exc:
|
|
208
|
+
ok, detail = False, f"{type(exc).__name__}: direct LLM readiness unavailable"
|
|
209
|
+
checks.append({"check": f"LLM {role} readiness", "ok": ok, "detail": detail})
|
|
210
|
+
return checks
|
|
211
|
+
|
|
212
|
+
|
|
101
213
|
def searched_calls(addr: str) -> int | None:
|
|
102
214
|
"""Runs of the injected search in Bifrost's MCP tool log (no arguments are kept); None when
|
|
103
215
|
the log cannot be read. A run counts whether or not its engines found anything: the log
|
|
@@ -203,6 +315,7 @@ def accept(
|
|
|
203
315
|
checks.append({"check": name, "ok": ok, "detail": detail[-300:]})
|
|
204
316
|
|
|
205
317
|
check("bifrost health", healthy(addr), f"http://{addr}/health")
|
|
318
|
+
checks += direct_targets(gw, timeout)
|
|
206
319
|
try:
|
|
207
320
|
with opener().open(f"http://{addr}/v1/models", timeout=60) as r:
|
|
208
321
|
listed = json.loads(r.read() or b"{}").get("data") or []
|
|
@@ -214,6 +327,8 @@ def accept(
|
|
|
214
327
|
# the LLM, and the names pi, Codex and Claude Code are given (bifrost_models)
|
|
215
328
|
llm_ids = [f"{gw['llm_provider']}/{name}" for name in (gw["llm"]["model"], AGENT_MODEL)]
|
|
216
329
|
wanted = list(llm_ids)
|
|
330
|
+
if fast := gw.get("llm_fast"):
|
|
331
|
+
wanted.append(f"{FAST_PROVIDER}/{fast['model']}")
|
|
217
332
|
routed = gw["decision"] is not None and decision_key is not None
|
|
218
333
|
if routed and gw["decision"] is not None:
|
|
219
334
|
wanted.append(f"{gw['decision_provider']}/{gw['decision']['model']}")
|
|
@@ -250,7 +365,7 @@ def accept(
|
|
|
250
365
|
check(f"gateway {AGENT_MODEL}", TOUCH_EXPECT in answer.lower(), answer.strip()[:200])
|
|
251
366
|
except (urllib.error.URLError, OSError, ValueError) as exc:
|
|
252
367
|
check(f"gateway {AGENT_MODEL}", False, f"{type(exc).__name__}: {exc}")
|
|
253
|
-
row = _routed_log(addr, gw["llm_provider"], since)
|
|
368
|
+
row = _routed_log(addr, None if gw.get("llm_fast") else gw["llm_provider"], since)
|
|
254
369
|
check(
|
|
255
370
|
"gateway routed the agent model",
|
|
256
371
|
row is not None,
|
|
@@ -266,6 +381,7 @@ def accept(
|
|
|
266
381
|
f"complexity {mechanism or 'none'}, "
|
|
267
382
|
f"tier {row.get('complexity_tier') if row else 'none'}",
|
|
268
383
|
)
|
|
384
|
+
checks += tier_routes(gw, timeout)
|
|
269
385
|
for ep in aux:
|
|
270
386
|
if ep["contract"] == SEARCH:
|
|
271
387
|
try:
|
|
@@ -392,6 +508,8 @@ def inspect(doc: hosts.Owned, plan: Any, reapply: str) -> list[Finding]:
|
|
|
392
508
|
g = plan["harness"]["gateway"]
|
|
393
509
|
llm_provider = g["llm_provider"]
|
|
394
510
|
expected[g["llm_provider"]] = (g["llm"]["url"], g["llm"]["model"])
|
|
511
|
+
if fast := g.get("llm_fast"):
|
|
512
|
+
expected[FAST_PROVIDER] = (fast["url"], fast["model"])
|
|
395
513
|
if g["decision"] is not None:
|
|
396
514
|
expected[g["decision_provider"]] = (g["decision"]["url"], g["decision"]["model"])
|
|
397
515
|
for part in plan.get("aux", []):
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Bifrost provider configuration shared by stack and standalone app gateways."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from localmodels import harness
|
|
8
|
+
|
|
9
|
+
# What each provider may be asked: everything else Bifrost refuses before it reaches the
|
|
10
|
+
# service. The LLM speaks chat only, so Bifrost turns Responses (Codex) and Anthropic Messages
|
|
11
|
+
# (Claude Code) requests into chat completions instead of calling /v1/responses upstream.
|
|
12
|
+
_ALLOWED = {
|
|
13
|
+
"llm": {"list_models": True, "chat_completion": True, "chat_completion_stream": True},
|
|
14
|
+
"decision": {"list_models": True, "decisions": True},
|
|
15
|
+
"embedding": {"list_models": True, "embedding": True},
|
|
16
|
+
# Bifrost's openai-type rerank sends documents as {"text": ...} objects, which llama-server
|
|
17
|
+
# refuses; its cohere type sends the plain strings llama-server reads.
|
|
18
|
+
"rerank": {"rerank": True},
|
|
19
|
+
"stt": {"list_models": True, "transcription": True, "transcription_stream": True},
|
|
20
|
+
}
|
|
21
|
+
_BASE_TYPE = {"decision": "typesafe", "rerank": "cohere"}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def render(role: str, url: str, model: str, key: str, pid: str) -> dict[str, Any]:
|
|
25
|
+
custom: dict[str, Any] = {
|
|
26
|
+
"base_provider_type": _BASE_TYPE.get(role, "openai"),
|
|
27
|
+
"allowed_requests": _ALLOWED[role],
|
|
28
|
+
}
|
|
29
|
+
if role == "rerank":
|
|
30
|
+
custom["request_path_overrides"] = {"rerank": "/v1/rerank"}
|
|
31
|
+
entry: dict[str, Any] = {"id": pid, "name": pid, "value": key, "models": [model], "weight": 1}
|
|
32
|
+
if role == "llm":
|
|
33
|
+
# Bifrost v2.3.0 lists (/v1/models as <pid>/<name>, /anthropic/v1/models bare) and routes
|
|
34
|
+
# a name only when the key has it in both ``models`` and ``aliases``; either alone does not.
|
|
35
|
+
entry["models"] = [model, harness.GROUP]
|
|
36
|
+
entry["aliases"] = {harness.GROUP: model}
|
|
37
|
+
return {
|
|
38
|
+
"keys": [entry],
|
|
39
|
+
"network_config": {
|
|
40
|
+
"base_url": origin(url),
|
|
41
|
+
"allow_private_network": True,
|
|
42
|
+
"max_retries": 0,
|
|
43
|
+
"default_request_timeout_in_seconds": 600,
|
|
44
|
+
"stream_idle_timeout_in_seconds": 600,
|
|
45
|
+
},
|
|
46
|
+
"custom_provider_config": custom,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def origin(url: str) -> str:
|
|
51
|
+
"""Bifrost appends the API path (/v1/...) to a provider's base URL itself."""
|
|
52
|
+
url = url.rstrip("/")
|
|
53
|
+
return url[: -len("/v1")] if url.endswith("/v1") else url
|
|
@@ -44,7 +44,8 @@ def text(binary: str, app: Path, addr: str) -> str:
|
|
|
44
44
|
f"ExecStart={binary} -app-dir {app} -host {host} -port {port} -log-style json "
|
|
45
45
|
"-log-level warn\n"
|
|
46
46
|
"Restart=on-failure\n"
|
|
47
|
-
"RestartSec=5\n
|
|
47
|
+
"RestartSec=5\n"
|
|
48
|
+
"UMask=0077\n\n"
|
|
48
49
|
"[Install]\n"
|
|
49
50
|
"WantedBy=default.target\n"
|
|
50
51
|
)
|
|
@@ -66,3 +67,33 @@ def retire_legacy(name: str, app: Path, systemctl: Systemctl) -> None:
|
|
|
66
67
|
raise HarnessError(f"systemctl --user disable --now {LEGACY_UNIT} failed")
|
|
67
68
|
old.unlink()
|
|
68
69
|
systemctl("daemon-reload")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def require_owned(record: hosts.OwnedBifrost, path: Path, systemctl: Systemctl) -> None:
|
|
73
|
+
"""Require both the private unit's exact content and systemd's loaded fragment."""
|
|
74
|
+
try:
|
|
75
|
+
info = path.lstat()
|
|
76
|
+
expected = text(record["binary"], Path(record["app_dir"]), record["addr"])
|
|
77
|
+
fragment = systemctl("show", "-p", "FragmentPath", "--value", unit(record) + ".service")
|
|
78
|
+
if (
|
|
79
|
+
path.is_symlink()
|
|
80
|
+
or info.st_uid != os.getuid()
|
|
81
|
+
or info.st_mode & 0o022
|
|
82
|
+
or path.read_text() != expected
|
|
83
|
+
or fragment.returncode
|
|
84
|
+
or os.path.realpath(fragment.stdout.strip()) != os.path.realpath(path)
|
|
85
|
+
):
|
|
86
|
+
raise HarnessError("cannot verify ownership of the Bifrost unit; left untouched")
|
|
87
|
+
except OSError:
|
|
88
|
+
raise HarnessError("cannot verify ownership of the Bifrost unit; left untouched") from None
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def pause(record: hosts.OwnedBifrost, path: Path, systemctl: Systemctl) -> None:
|
|
92
|
+
"""Stop the verified unit and confirm that systemd no longer has its process."""
|
|
93
|
+
require_owned(record, path, systemctl)
|
|
94
|
+
name = unit(record) + ".service"
|
|
95
|
+
if systemctl("stop", name).returncode:
|
|
96
|
+
raise HarnessError("Bifrost unit could not stop")
|
|
97
|
+
pid = systemctl("show", "-p", "MainPID", "--value", name)
|
|
98
|
+
if pid.returncode or pid.stdout.strip() != "0":
|
|
99
|
+
raise HarnessError("Bifrost unit did not stop")
|
|
@@ -164,9 +164,13 @@ def holders(facts: HostFacts) -> dict[str, list[str]]:
|
|
|
164
164
|
own that runs there (gpu_conflicts). A card missing from the map is free."""
|
|
165
165
|
conflicts = gpu_conflicts(facts)
|
|
166
166
|
found: dict[str, list[str]] = {}
|
|
167
|
+
# A Windows (WDDM) desktop always draws on the card; with no compute service there, that
|
|
168
|
+
# memory is the desktop's, and the plan prices only what is free.
|
|
169
|
+
desktop = facts.get("platform") == "win32" and facts.get("services") is not None
|
|
167
170
|
for g in facts.get("gpus") or []:
|
|
168
171
|
taken = max(g["used_bytes"], g["total_bytes"] - g["free_bytes"])
|
|
169
|
-
|
|
172
|
+
idle_desktop = desktop and not conflicts.get(g["uuid"])
|
|
173
|
+
reasons = [f"in use: {gib(taken)}"] if held(g) and not idle_desktop else []
|
|
170
174
|
if conflicts.get(g["uuid"]):
|
|
171
175
|
reasons.append(
|
|
172
176
|
"runs services this tool does not own: " + ", ".join(conflicts[g["uuid"]])
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{
|
|
5
5
|
"id": "qwen3.8-27b",
|
|
6
6
|
"display_name": "Qwen3.8 27B",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "The best all-round model for agent work: strong with tools and code, reads images, and stays fast in long conversations.",
|
|
8
8
|
"repo": "unsloth/Qwen3.8-27B-GGUF",
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"license_url": "https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/LICENSE",
|
|
@@ -161,7 +161,8 @@
|
|
|
161
161
|
{
|
|
162
162
|
"id": "qwen3.8-27b-iq3s",
|
|
163
163
|
"display_name": "Qwen3.8 27B",
|
|
164
|
-
"description": "Qwen3.8 27B
|
|
164
|
+
"description": "A smaller build of Qwen3.8 27B for 16 GB graphics cards and 32 GB Macs; reads images and answers nearly as well.",
|
|
165
|
+
"note": "Qwen3.8 27B at UD-IQ3_S for 32 GB unified-memory Macs and 16 GB NVIDIA cards, LLM only at 64K. On CUDA the stack CLI install passed on a 16 GB share of a 96 GB card (I16); a real 16 GB card and the five-layer product acceptance remain unverified",
|
|
165
166
|
"repo": "unsloth/Qwen3.8-27B-GGUF",
|
|
166
167
|
"license": "Apache-2.0",
|
|
167
168
|
"license_url": "https://huggingface.co/Qwen/Qwen3.8-27B/blob/main/LICENSE",
|
|
@@ -399,7 +400,8 @@
|
|
|
399
400
|
{
|
|
400
401
|
"id": "qwen3.8-flash-next-iq2xs",
|
|
401
402
|
"display_name": "Qwen3.8 Flash Next",
|
|
402
|
-
"description": "
|
|
403
|
+
"description": "A large, fast model for Macs with 96 GB of memory or more, for demanding agent and coding work.",
|
|
404
|
+
"note": "Qwen3.8 Flash Next GSQ-RCO IQ2_XS on plain llama.cpp for unified-memory Macs of 96 GB and more: a 125B MoE with about 6B active, every expert resident",
|
|
403
405
|
"repo": "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF",
|
|
404
406
|
"license": "qwen-community-1.0",
|
|
405
407
|
"license_url": "https://huggingface.co/Qwen/Qwen3.8-Flash-Next/blob/main/LICENSE",
|
|
@@ -484,7 +486,8 @@
|
|
|
484
486
|
{
|
|
485
487
|
"id": "qwen3.8-flash-next-iq3s",
|
|
486
488
|
"display_name": "Qwen3.8 Flash Next",
|
|
487
|
-
"description": "Qwen3.8 Flash Next
|
|
489
|
+
"description": "A more accurate build of Qwen3.8 Flash Next for Macs with 128 GB of memory or more.",
|
|
490
|
+
"note": "Qwen3.8 Flash Next GSQ-RCO IQ3_S on plain llama.cpp for unified-memory Macs of 128 GB and more: a 125B MoE with about 6B active, every expert resident; smaller than UD-IQ4_XS and scored higher (publisher retention)",
|
|
488
491
|
"repo": "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF",
|
|
489
492
|
"license": "qwen-community-1.0",
|
|
490
493
|
"license_url": "https://huggingface.co/Qwen/Qwen3.8-Flash-Next/blob/main/LICENSE",
|
|
@@ -569,7 +572,8 @@
|
|
|
569
572
|
{
|
|
570
573
|
"id": "qwen3.6-35b-a3b",
|
|
571
574
|
"display_name": "Qwen3.6 35B-A3B",
|
|
572
|
-
"description": "
|
|
575
|
+
"description": "A fast model for everyday agent tasks that reads images and handles long conversations.",
|
|
576
|
+
"note": "Mixture-of-experts with multi-token prediction; sees images. On a 24GB card the IQ4_XS build holds a 128K window for three concurrent requests beside a GPU decision model",
|
|
573
577
|
"repo": "unsloth/Qwen3.6-35B-A3B-MTP-GGUF",
|
|
574
578
|
"license": "Apache-2.0",
|
|
575
579
|
"license_url": "https://huggingface.co/Qwen/Qwen3.6-35B-A3B/blob/main/LICENSE",
|
|
@@ -1291,7 +1295,8 @@
|
|
|
1291
1295
|
{
|
|
1292
1296
|
"id": "ling-3.0-tiny",
|
|
1293
1297
|
"display_name": "Ling 3.0 tiny",
|
|
1294
|
-
"description": "
|
|
1298
|
+
"description": "A small, quick model for Macs with little memory, for simple everyday tasks.",
|
|
1299
|
+
"note": "Ling 3.0 tiny (2026-08, 7.9B MoE, 1.3B active, MLA + linear attention) at Q4_K_M as an explicit alternative on small unified-memory Macs, and for 32 GB ones whose user picked embedding and reranker",
|
|
1295
1300
|
"repo": "inclusionAI/Ling-3.0-tiny-GGUF",
|
|
1296
1301
|
"license": "MIT",
|
|
1297
1302
|
"license_url": "https://huggingface.co/inclusionAI/Ling-3.0-tiny-GGUF/blob/01b850e29ed5b44e2b810160ff980a9bb353296f/README.md",
|
|
@@ -2749,7 +2754,7 @@
|
|
|
2749
2754
|
"vision": true
|
|
2750
2755
|
}
|
|
2751
2756
|
],
|
|
2752
|
-
"engine": "strata-0.1.49.
|
|
2757
|
+
"engine": "strata-0.1.49.2",
|
|
2753
2758
|
"alias": "swift-1.5-iq3_s",
|
|
2754
2759
|
"contract": "chat",
|
|
2755
2760
|
"context": 131072,
|
|
@@ -2845,7 +2850,25 @@
|
|
|
2845
2850
|
"30"
|
|
2846
2851
|
],
|
|
2847
2852
|
"verify_timeout_s": 4800,
|
|
2848
|
-
"note": "Swift 1.5 IQ3_S on Strata 0.2.2 (engine 0.1.47), 128K window: ST2 measured 19.9 GiB VRAM beside d3-nano, 44 GiB RAM ceiling, 64-84 tok/s decode.\nThe pack and MTP draft files are
|
|
2853
|
+
"note": "Swift 1.5 IQ3_S on Strata 0.2.2 (engine 0.1.47), 128K window: ST2 measured 19.9 GiB VRAM beside d3-nano, 44 GiB RAM ceiling, 64-84 tok/s decode.\nThe pack and MTP draft files are generated from pinned inputs by the bundled Strata tools during installation, with exact size and SHA256 checks before publication; existing matching files are reused. Preparation reserves 9 GiB for raw MTP tensors, their intermediate GGUF and gguf-py sources, in addition to the staged output group. GPU acceptance evidence below predates this fresh-install path.\nA cold first start under the 46G ceiling fills the VRAM expert cache from disk at 30-70 MB/s and page-locks ~36 GiB; it took ~15 min on lab-12020, past Strata's default 900 s engine-ready limit, so STRATA_ENGINE_READY_S is raised.\nOn lab-12021 (62 GiB, 2026-10-22) the 256K window with 8 GiB resident headroom pushed the engine's page-locked memory past the 44G MemoryHigh after a 244K-token conversation (shmem 42.3 GiB + anon 3.5 GiB); every later request was throttled (follow-up turns 269-1229 s). The window is 128K and the headroom 10 GiB so the locked set leaves room to grow.\nConversation parking (--conversation-cache-*) is planned by stack plan --conversation-cache: auto turns it on only when the whole suite still fits, and adds the budget to this service's cgroup ceilings. ST5 (lab-12020, 2026-10-23) measured a parked conversation at ~340 MB plus ~14 KB per token (415-560 MB at 5.3K-6.7K tokens), a park in 2.6-5.1 s and a restore in 1.0-1.3 s, so the 4 GiB / 4-slot budget holds four such conversations; more alternating conversations than slots evict each other oldest-first; the 512 MiB floor follows Strata's advice for an engine near its cap, and 2048 minimum tokens keeps short side requests (classification, quick replies) from evicting a long agent conversation. Without parking, a request whose prompt does not continue the live conversation drops it, so clients that alternate re-read their whole prompt.\nSTRATA_ROUTE_TAIL_SKIP=0 turns off Strata's lossy CUDA default that skips missed low-rank experts. X2 (evidence/2026-10-26-strata-tailskip-x2-lab12021, lab-12021 GPU3, IQ2_XS at the production 10132 slots) measured teacher-forced KL 0.045 and top-1 agreement 93.5% for the default against it off (agent transcripts: KL 0.12, 91.0%), for +6.6% decode and -3.4% on the fixed agent workload. Not measured on Swift, which caches fewer experts on the card and so misses more.",
|
|
2854
|
+
"preparation": {
|
|
2855
|
+
"kind": "strata-qwen4exp-v1",
|
|
2856
|
+
"engine_dir": "{engine_dir}",
|
|
2857
|
+
"model_dir": "{model_dir}",
|
|
2858
|
+
"gguf": "{model}",
|
|
2859
|
+
"pack": "packs/iq3_s",
|
|
2860
|
+
"experts_bin": false,
|
|
2861
|
+
"gguf_py": {
|
|
2862
|
+
"name": "llama.cpp-3cf03257f219afbe7334045ff7c6a06ac68c627d.tar.gz",
|
|
2863
|
+
"url": "https://codeload.github.com/ggml-org/llama.cpp/tar.gz/3cf03257f219afbe7334045ff7c6a06ac68c627d",
|
|
2864
|
+
"size_bytes": 37513049,
|
|
2865
|
+
"sha256": "c076d7534afa0e5d0ec2a0d425b11e791c16f3de0d727221aea071cef156a280"
|
|
2866
|
+
},
|
|
2867
|
+
"mtp_revision": "de4b8e4d43b917e7706784d8bb445c9af86a3540",
|
|
2868
|
+
"download_bytes": 5260203353,
|
|
2869
|
+
"scratch_bytes": 9663676416,
|
|
2870
|
+
"hf_endpoint": "{hf_endpoint}"
|
|
2871
|
+
}
|
|
2849
2872
|
},
|
|
2850
2873
|
{
|
|
2851
2874
|
"id": "flash-next-iq2xs",
|
|
@@ -3016,7 +3039,7 @@
|
|
|
3016
3039
|
"vision": true
|
|
3017
3040
|
}
|
|
3018
3041
|
],
|
|
3019
|
-
"engine": "strata-0.1.49.
|
|
3042
|
+
"engine": "strata-0.1.49.2",
|
|
3020
3043
|
"alias": "qwen3.8-flash-next-iq2_xs",
|
|
3021
3044
|
"contract": "chat",
|
|
3022
3045
|
"context": 262144,
|
|
@@ -3120,7 +3143,7 @@
|
|
|
3120
3143
|
"30"
|
|
3121
3144
|
],
|
|
3122
3145
|
"verify_timeout_s": 4800,
|
|
3123
|
-
"note": "Flash-Next IQ2_XS 256K on Strata 0.2.2 (engine 0.1.47), the fallback when the computer's memory cannot hold Swift 1.5 IQ3_S: ST2/ST3 measured 20.0 GiB VRAM beside d3-nano, 32 GiB RAM ceiling, 128-168 tok/s decode (engine 0.1.43).\nThe pack and MTP draft files are
|
|
3146
|
+
"note": "Flash-Next IQ2_XS 256K on Strata 0.2.2 (engine 0.1.47), the fallback when the computer's memory cannot hold Swift 1.5 IQ3_S: ST2/ST3 measured 20.0 GiB VRAM beside d3-nano, 32 GiB RAM ceiling, 128-168 tok/s decode (engine 0.1.43).\nThe pack and MTP draft files are generated from pinned inputs by the bundled Strata tools during installation, with exact size and SHA256 checks before publication; existing matching files are reused. Preparation reserves 9 GiB for raw MTP tensors, their intermediate GGUF and gguf-py sources, in addition to the staged output group. GPU acceptance evidence below predates this fresh-install path.\nConversation parking (--conversation-cache-*) is planned by stack plan --conversation-cache: auto turns it on only when the whole suite still fits, and adds the budget to this service's cgroup ceilings. ST5 (lab-12020, 2026-10-23) measured a parked conversation at ~340 MB plus ~14 KB per token (415-560 MB at 5.3K-6.7K tokens), a park in 2.6-5.1 s and a restore in 1.0-1.3 s, so the 4 GiB / 4-slot budget holds four such conversations; more alternating conversations than slots evict each other oldest-first; the 512 MiB floor follows Strata's advice for an engine near its cap, and 2048 minimum tokens keeps short side requests (classification, quick replies) from evicting a long agent conversation. Without parking, a request whose prompt does not continue the live conversation drops it, so clients that alternate re-read their whole prompt.\nA fixed --expert-cache slot count is sized from the card (expert_cache_sizing) instead of auto: lab241-rsi (2026-10-23, lab-12021 GPU3 x16) cut the fixed agent workload by 13.4% (decode 118 -> 156 tok/s). --prefill auto:16384 gained another 8.6% under the 36 GiB parking ceiling but was killed by systemd-oomd at start under 34 GiB without parking: its prompt buffers take the RAM parking is priced for, so it is not in this recipe.\nSTRATA_ROUTE_TAIL_SKIP=0 turns off Strata's lossy CUDA default that skips missed low-rank experts. X2 (evidence/2026-10-26-strata-tailskip-x2-lab12021, lab-12021 GPU3, IQ2_XS at the production 10132 slots) measured teacher-forced KL 0.045 and top-1 agreement 93.5% for the default against it off (agent transcripts: KL 0.12, 91.0%), for +6.6% decode and -3.4% on the fixed agent workload.",
|
|
3124
3147
|
"quality": {
|
|
3125
3148
|
"score": 57,
|
|
3126
3149
|
"sources": [
|
|
@@ -3130,6 +3153,24 @@
|
|
|
3130
3153
|
"date": "2026-11-04"
|
|
3131
3154
|
}
|
|
3132
3155
|
]
|
|
3156
|
+
},
|
|
3157
|
+
"preparation": {
|
|
3158
|
+
"kind": "strata-qwen4exp-v1",
|
|
3159
|
+
"engine_dir": "{engine_dir}",
|
|
3160
|
+
"model_dir": "{model_dir}",
|
|
3161
|
+
"gguf": "{model}",
|
|
3162
|
+
"pack": "packs/iq2_xs",
|
|
3163
|
+
"experts_bin": true,
|
|
3164
|
+
"gguf_py": {
|
|
3165
|
+
"name": "llama.cpp-3cf03257f219afbe7334045ff7c6a06ac68c627d.tar.gz",
|
|
3166
|
+
"url": "https://codeload.github.com/ggml-org/llama.cpp/tar.gz/3cf03257f219afbe7334045ff7c6a06ac68c627d",
|
|
3167
|
+
"size_bytes": 37513049,
|
|
3168
|
+
"sha256": "c076d7534afa0e5d0ec2a0d425b11e791c16f3de0d727221aea071cef156a280"
|
|
3169
|
+
},
|
|
3170
|
+
"mtp_revision": "de4b8e4d43b917e7706784d8bb445c9af86a3540",
|
|
3171
|
+
"download_bytes": 5260203353,
|
|
3172
|
+
"scratch_bytes": 9663676416,
|
|
3173
|
+
"hf_endpoint": "{hf_endpoint}"
|
|
3133
3174
|
}
|
|
3134
3175
|
},
|
|
3135
3176
|
{
|
|
@@ -20,7 +20,7 @@ from dataclasses import dataclass, field
|
|
|
20
20
|
from pathlib import Path, PurePosixPath
|
|
21
21
|
from typing import TypedDict, cast
|
|
22
22
|
|
|
23
|
-
from localmodels import vision
|
|
23
|
+
from localmodels import decode_calibration, vision
|
|
24
24
|
from localmodels.context_policy import (
|
|
25
25
|
FLOOR,
|
|
26
26
|
RUNTIME_OVERHEAD_BYTES,
|
|
@@ -30,6 +30,7 @@ from localmodels.context_policy import (
|
|
|
30
30
|
plan_launch,
|
|
31
31
|
)
|
|
32
32
|
from localmodels.contracts import decode
|
|
33
|
+
from localmodels.decode_calibration import DecodeEstimate as DecodeEstimate
|
|
33
34
|
from localmodels.estimator import (
|
|
34
35
|
HardwareBudget,
|
|
35
36
|
LayerKind,
|
|
@@ -76,9 +77,8 @@ class QuantVariant:
|
|
|
76
77
|
files: tuple[AssetFile, ...]
|
|
77
78
|
validated: bool = False
|
|
78
79
|
lazy_bytes: int = 0
|
|
79
|
-
# From the
|
|
80
|
-
#
|
|
81
|
-
# footprint then prices them on the card, never below the truth.
|
|
80
|
+
# From the header (catalog add): token_embd.weight, host-mapped only when untied, and the MTP
|
|
81
|
+
# blocks llama.cpp skips without MTP; 0 = unknown, priced on the card (never below the truth).
|
|
82
82
|
embd_table_bytes: int = 0
|
|
83
83
|
mtp_layer_bytes: int = 0
|
|
84
84
|
|
|
@@ -125,6 +125,7 @@ class CatalogEntry:
|
|
|
125
125
|
ssm_dt_rank: int = 0
|
|
126
126
|
n_embd: int = 0 # hidden width; scales the agent compute buffer
|
|
127
127
|
tied_embeddings: bool = False # no output.weight: token_embd stays on the GPU too
|
|
128
|
+
kv_k_only: bool = False # MLA: per_layer_f16 is the K latent alone; -ctv does not apply
|
|
128
129
|
mmproj: AssetFile | None = None
|
|
129
130
|
draft: AssetFile | None = None
|
|
130
131
|
mtp_head: AssetFile | None = None
|
|
@@ -155,11 +156,9 @@ class CatalogEntry:
|
|
|
155
156
|
return sum(a.size_bytes for a in (self.mmproj, self.mtp_head) if a is not None)
|
|
156
157
|
|
|
157
158
|
def profile(self, variant: QuantVariant) -> ModelProfile:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
+ [(LayerKind.RECURRENT, 0)] * self.recurrent_layers
|
|
162
|
-
)
|
|
159
|
+
full, window = (LayerKind.FULL, self.per_layer_f16), (LayerKind.SWA, self.per_layer_f16)
|
|
160
|
+
layers = [full] * self.full_layers + [window] * self.swa_layers
|
|
161
|
+
layers += [(LayerKind.RECURRENT, 0)] * self.recurrent_layers
|
|
163
162
|
return ModelProfile(
|
|
164
163
|
name=variant.model_id,
|
|
165
164
|
weights_bytes=variant.weights_bytes,
|
|
@@ -177,6 +176,7 @@ class CatalogEntry:
|
|
|
177
176
|
ssm_dt_rank=self.ssm_dt_rank,
|
|
178
177
|
n_embd=self.n_embd,
|
|
179
178
|
tied_embeddings=self.tied_embeddings,
|
|
179
|
+
kv_k_only=self.kv_k_only,
|
|
180
180
|
kv_scale=1.2 if self.mtp_capable else 1.0,
|
|
181
181
|
lazy_bytes=variant.lazy_bytes,
|
|
182
182
|
mtp_layer_bytes=variant.mtp_layer_bytes,
|
|
@@ -233,13 +233,8 @@ def select_variant(entry: CatalogEntry, budget: HardwareBudget) -> VariantChoice
|
|
|
233
233
|
return VariantChoice(variant, zero_spill=True, reason_key=reason)
|
|
234
234
|
|
|
235
235
|
|
|
236
|
-
#
|
|
237
|
-
#
|
|
238
|
-
# SPEED is physics per machine: decode is memory-bound, so predicted tok/s ≈ bandwidth /
|
|
239
|
-
# bytes-read-per-token. Class constants, not measurements of this machine, except spilled weights
|
|
240
|
-
# on a host whose facts carry a measured host-memory bandwidth, and resident weights on a card
|
|
241
|
-
# whose model has a published bandwidth (gpu_specs), which is a spec figure, not a measurement.
|
|
242
|
-
|
|
236
|
+
# Decode uses bandwidth / active bytes with retained-run efficiency factors.
|
|
237
|
+
# Same-device decode measurements precede the formula; spec bandwidth is not measured speed.
|
|
243
238
|
_DISCRETE_BANDWIDTH_GB_S = 1000.0
|
|
244
239
|
_UMA_BANDWIDTH_GB_S = 210.0
|
|
245
240
|
_HOST_BANDWIDTH_GB_S = 80.0
|
|
@@ -272,14 +267,6 @@ def hardware_key(budget: HardwareBudget, backend: str) -> tuple[str, str, str]:
|
|
|
272
267
|
return (budget.platform, effective_backend, gpu_name)
|
|
273
268
|
|
|
274
269
|
|
|
275
|
-
@dataclass(frozen=True)
|
|
276
|
-
class DecodeEstimate:
|
|
277
|
-
tok_s: float
|
|
278
|
-
basis: str # a DECODE_BASES key
|
|
279
|
-
bandwidth_gb_s: float | None # None: a measured decode speed, not a bandwidth
|
|
280
|
-
bytes_per_token: float
|
|
281
|
-
|
|
282
|
-
|
|
283
270
|
def decode_estimate(
|
|
284
271
|
entry: CatalogEntry,
|
|
285
272
|
variant: QuantVariant,
|
|
@@ -287,6 +274,7 @@ def decode_estimate(
|
|
|
287
274
|
*,
|
|
288
275
|
spilled: bool = False,
|
|
289
276
|
backend: str = "auto",
|
|
277
|
+
calibrated: bool = True,
|
|
290
278
|
) -> DecodeEstimate:
|
|
291
279
|
bytes_per_token = max(1.0, variant.size_bytes * entry.decode_fraction)
|
|
292
280
|
key = (*hardware_key(budget, backend), entry.id, variant.quant, entry.mtp_draft_depth)
|
|
@@ -307,7 +295,17 @@ def decode_estimate(
|
|
|
307
295
|
basis, bandwidth = "gpu-spec", budget.gpu_bandwidth_gb_s
|
|
308
296
|
else:
|
|
309
297
|
basis, bandwidth = "discrete-class", _DISCRETE_BANDWIDTH_GB_S
|
|
310
|
-
|
|
298
|
+
effective_backend = hardware_key(budget, backend)[1]
|
|
299
|
+
if backend == "auto" and budget.uma and budget.platform == "darwin":
|
|
300
|
+
effective_backend = "metal"
|
|
301
|
+
factor = (
|
|
302
|
+
decode_calibration.efficiency(decode_calibration.category(entry, effective_backend))
|
|
303
|
+
if calibrated and not spilled
|
|
304
|
+
else 1.0
|
|
305
|
+
)
|
|
306
|
+
return DecodeEstimate(
|
|
307
|
+
factor * bandwidth * 1e9 / bytes_per_token, basis, bandwidth, bytes_per_token
|
|
308
|
+
)
|
|
311
309
|
|
|
312
310
|
|
|
313
311
|
def predicted_decode_tok_s(
|
|
@@ -323,11 +321,12 @@ def predicted_decode_tok_s(
|
|
|
323
321
|
|
|
324
322
|
def validated_here(entry: CatalogEntry, platform: str) -> bool:
|
|
325
323
|
"""``stack plan --llm auto`` may pick the entry on ``platform`` (a probe's sys.platform):
|
|
326
|
-
it is validated, by evidence from this platform when ``validated_on`` narrows it
|
|
324
|
+
it is validated, by evidence from this platform when ``validated_on`` narrows it; Windows
|
|
325
|
+
runs Linux's llama.cpp CUDA kernels, so Linux evidence counts there too (decision 48)."""
|
|
327
326
|
if entry.status != "validated":
|
|
328
327
|
return False
|
|
329
|
-
key = "linux" if platform.startswith("linux") else platform
|
|
330
|
-
return not
|
|
328
|
+
key, scope = ("linux" if platform.startswith("linux") else platform), entry.validated_on
|
|
329
|
+
return not scope or key in scope or (key == "win32" and "linux" in scope)
|
|
331
330
|
|
|
332
331
|
|
|
333
332
|
# ── catalog data ──
|
|
@@ -335,7 +334,7 @@ def validated_here(entry: CatalogEntry, platform: str) -> bool:
|
|
|
335
334
|
_SCHEMA_VERSION = 3
|
|
336
335
|
_READABLE_SCHEMAS = (2, 3) # schema 2: bare quality integers and no provenance fields
|
|
337
336
|
STATUSES = ("candidate", "validated", "deprecated")
|
|
338
|
-
PLATFORMS = ("linux", "darwin") # validated_on
|
|
337
|
+
PLATFORMS = ("linux", "darwin", "win32") # validated_on: Linux, Apple Silicon Macs, Windows
|
|
339
338
|
EFFORT_LEVELS = ("low", "medium", "high") # reasoning_effort values a gateway may send, in order
|
|
340
339
|
TASKS = tuple("llm vision decision embedding reranker stt tts search privacy-span".split())
|
|
341
340
|
# intelligence_score: the installed SimplexAI score (decisions 26, 33); make check keeps it equal
|
|
@@ -427,6 +426,7 @@ class OptionalModelData(ModelData, ProvenanceData, total=False):
|
|
|
427
426
|
ssm_dt_rank: int
|
|
428
427
|
n_embd: int
|
|
429
428
|
tied_embeddings: bool
|
|
429
|
+
kv_k_only: bool
|
|
430
430
|
mmproj: OptionalAssetData | None
|
|
431
431
|
draft: OptionalAssetData | None
|
|
432
432
|
mtp_head: OptionalAssetData | None
|
|
@@ -704,6 +704,7 @@ def load_catalog(value: object) -> tuple[CatalogEntry, ...]:
|
|
|
704
704
|
ssm_dt_rank=m.get("ssm_dt_rank", 0),
|
|
705
705
|
n_embd=m.get("n_embd", 0),
|
|
706
706
|
tied_embeddings=bool(m.get("tied_embeddings", False)),
|
|
707
|
+
kv_k_only=bool(m.get("kv_k_only", False)),
|
|
707
708
|
license=m.get("license", ""),
|
|
708
709
|
license_url=m.get("license_url", ""),
|
|
709
710
|
status=m.get("status", ""),
|
|
@@ -111,6 +111,7 @@ def entry_from_header(
|
|
|
111
111
|
"architecture": profile.architecture,
|
|
112
112
|
"n_embd": profile.n_embd,
|
|
113
113
|
"tied_embeddings": profile.tied_embeddings,
|
|
114
|
+
**({"kv_k_only": True} if profile.kv_k_only else {}),
|
|
114
115
|
"sampling": header.sampling_defaults,
|
|
115
116
|
"quality": {
|
|
116
117
|
"score": quality,
|