@simplexai/localmodels-win32-x64 0.1.0-dev.63 → 0.1.0-dev.64
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 +71 -64
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/app.py +15 -2
- package/modules/localmodels/catalog.json +34 -0
- package/modules/localmodels/catalog.py +26 -4
- package/modules/localmodels/catalog_recipes.py +37 -1
- package/modules/localmodels/context_policy.py +6 -1
- package/modules/localmodels/debug_mode.py +85 -103
- package/modules/localmodels/deploy.py +41 -6
- package/modules/localmodels/download-mirrors.json +126 -6
- package/modules/localmodels/draft_spec.py +122 -0
- package/modules/localmodels/engine_adapters/__init__.py +4 -0
- package/modules/localmodels/engine_adapters/auxiliary.py +27 -0
- package/modules/localmodels/engine_adapters/base.py +40 -0
- package/modules/localmodels/engine_adapters/strata_poly.py +57 -0
- package/modules/localmodels/engine_adapters/suite_plan.py +394 -0
- package/modules/localmodels/engines-prism-b12178-03ec600.json +7 -7
- package/modules/localmodels/install.py +15 -0
- package/modules/localmodels/library_convert.py +2 -8
- package/modules/localmodels/library_elastic.py +2 -118
- package/modules/localmodels/library_jobs.py +1 -2
- package/modules/localmodels/library_poly.py +3 -2
- package/modules/localmodels/library_pricing.py +122 -13
- package/modules/localmodels/library_serve.py +4 -6
- package/modules/localmodels/memcalc_cli.py +2 -2
- package/modules/localmodels/planning/__init__.py +3 -0
- package/modules/localmodels/{memcalc_load.py → planning/memcalc_load.py} +1 -1
- package/modules/localmodels/{sizecalc.py → planning/sizecalc.py} +1 -1
- package/modules/localmodels/service_deployment.py +2 -1
- package/modules/localmodels/sizecalc_cli.py +10 -2
- package/modules/localmodels/speech_worker_sensevoice.py +30 -0
- package/modules/localmodels/stack.py +2 -4
- package/modules/localmodels/stack_arena.py +2 -2
- package/modules/localmodels/stack_auto.py +1 -1
- package/modules/localmodels/stack_aux_gpu.py +4 -2
- package/modules/localmodels/stack_card.py +2 -2
- package/modules/localmodels/stack_cleanup.py +3 -2
- package/modules/localmodels/stack_compose.py +9 -1
- package/modules/localmodels/stack_ledger.py +2 -1
- package/modules/localmodels/stack_mcp.py +1 -1
- package/modules/localmodels/stack_memory.py +3 -3
- package/modules/localmodels/stack_run.py +16 -0
- package/modules/localmodels/stack_suite.py +4 -3
- package/modules/localmodels/stack_try.py +2 -1
- package/modules/localmodels/stack_up.py +15 -30
- package/modules/localmodels/stack_view_llm.py +12 -7
- package/modules/localmodels/stack_warm.py +6 -3
- package/modules/localmodels/stack_whatif.py +1 -1
- package/modules/localmodels/suite.py +6 -334
- package/modules/localmodels/tui_views.py +17 -2
- package/modules/localmodels/web/index.html +595 -226
- package/modules/localmodels/web/sizecalc/app.js +34 -40
- package/modules/localmodels/web/sizecalc/calc.js +3 -3
- package/modules/localmodels/web/sizecalc/page.html +4 -3
- package/modules/localmodels/web/view/fleet.html +18 -3
- package/modules/localmodels/web/view/fleet.js +135 -14
- package/modules/localmodels/web/view/i18n.js +4 -0
- package/modules/localmodels/web/view/index.html +16 -0
- package/modules/localmodels/web/view/nav.js +49 -0
- package/modules/localmodels/web/view/theme.js +1 -1
- package/modules/localmodels/web/view/view.css +51 -15
- package/modules/localmodels/web/view/view.js +22 -4
- package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev64.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev64.dist-info}/RECORD +68 -61
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/localmodels/{memcalc.py → planning/memcalc.py} +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev64.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev64.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev64.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev64.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -9,8 +9,16 @@ from collections.abc import Mapping
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
|
-
from localmodels import catalog, cli_help
|
|
13
|
-
from localmodels.
|
|
12
|
+
from localmodels import catalog, cli_help
|
|
13
|
+
from localmodels.planning import sizecalc
|
|
14
|
+
from localmodels.planning.memcalc import (
|
|
15
|
+
GIB,
|
|
16
|
+
KIB,
|
|
17
|
+
MemcalcError,
|
|
18
|
+
parse_params,
|
|
19
|
+
parse_size,
|
|
20
|
+
parse_tokens,
|
|
21
|
+
)
|
|
14
22
|
|
|
15
23
|
PAGE_DIR = Path(__file__).parent / "web" / "sizecalc"
|
|
16
24
|
_VERDICT = {"fits": "fits", "offload": "fits with system RAM", "no": "-"}
|
|
@@ -11,7 +11,9 @@ from __future__ import annotations
|
|
|
11
11
|
|
|
12
12
|
import argparse
|
|
13
13
|
import array
|
|
14
|
+
import ctypes
|
|
14
15
|
import importlib
|
|
16
|
+
import importlib.util
|
|
15
17
|
import io
|
|
16
18
|
import json
|
|
17
19
|
import os
|
|
@@ -100,10 +102,38 @@ class Recognizer(Protocol):
|
|
|
100
102
|
) -> dict[str, object]: ...
|
|
101
103
|
|
|
102
104
|
|
|
105
|
+
def _preload_windows_onnxruntime() -> None:
|
|
106
|
+
"""Preload sherpa-onnx's bundled onnxruntime.dll on Windows.
|
|
107
|
+
|
|
108
|
+
Electron hosts enable PreferSystem32Images, which otherwise resolves System32's
|
|
109
|
+
older inbox onnxruntime.dll ahead of sherpa_onnx/lib/onnxruntime.dll. Loading the
|
|
110
|
+
bundled DLL by full path pins the process module table before importing sherpa_onnx.
|
|
111
|
+
"""
|
|
112
|
+
if sys.platform != "win32" or "sherpa_onnx" in sys.modules:
|
|
113
|
+
return
|
|
114
|
+
spec = importlib.util.find_spec("sherpa_onnx")
|
|
115
|
+
if spec is None:
|
|
116
|
+
return
|
|
117
|
+
search_roots: list[Path] = []
|
|
118
|
+
if spec.submodule_search_locations:
|
|
119
|
+
search_roots.extend(Path(location) for location in spec.submodule_search_locations)
|
|
120
|
+
elif spec.origin:
|
|
121
|
+
search_roots.append(Path(spec.origin).resolve().parent)
|
|
122
|
+
win_dll = getattr(ctypes, "WinDLL", None)
|
|
123
|
+
if win_dll is None:
|
|
124
|
+
return
|
|
125
|
+
for root in search_roots:
|
|
126
|
+
ort_dll = root / "lib" / "onnxruntime.dll"
|
|
127
|
+
if ort_dll.is_file():
|
|
128
|
+
win_dll(str(ort_dll))
|
|
129
|
+
return
|
|
130
|
+
|
|
131
|
+
|
|
103
132
|
class SenseVoiceRecognizer:
|
|
104
133
|
"""Thread-safe sherpa-onnx OfflineRecognizer wrapper for SenseVoice Small INT8."""
|
|
105
134
|
|
|
106
135
|
def __init__(self, model: Path, tokens: Path, *, threads: int = 4) -> None:
|
|
136
|
+
_preload_windows_onnxruntime()
|
|
107
137
|
sherpa_onnx = importlib.import_module("sherpa_onnx")
|
|
108
138
|
self._recognizer: Any = sherpa_onnx.OfflineRecognizer.from_sense_voice(
|
|
109
139
|
model=str(model),
|
|
@@ -21,11 +21,11 @@ from localmodels import (
|
|
|
21
21
|
gateway,
|
|
22
22
|
harness,
|
|
23
23
|
hosts,
|
|
24
|
+
library_convert,
|
|
24
25
|
stack_events,
|
|
25
26
|
stack_journal,
|
|
26
27
|
stack_preflight,
|
|
27
28
|
stack_run,
|
|
28
|
-
stack_up,
|
|
29
29
|
stack_update,
|
|
30
30
|
)
|
|
31
31
|
from localmodels import stack_decision as decide
|
|
@@ -94,7 +94,7 @@ def build(
|
|
|
94
94
|
resolver = deploy.catalog_pins if options.get("offline") else deploy.resolve_files
|
|
95
95
|
context = approved
|
|
96
96
|
if context is None:
|
|
97
|
-
accepted =
|
|
97
|
+
accepted = stack_run.accepted()
|
|
98
98
|
if (
|
|
99
99
|
accepted
|
|
100
100
|
and Path(accepted["options"]["base_dir"]).expanduser()
|
|
@@ -343,8 +343,6 @@ def _deploy_aux(task: str, part: Plan, key: str, log: Log, do: Effects) -> Compo
|
|
|
343
343
|
|
|
344
344
|
def _sync_library(plan: StackPlan, attempt_id: str | None) -> None:
|
|
345
345
|
"""Keep an already-used model library in step with a newly accepted stack apply."""
|
|
346
|
-
from localmodels import library_convert
|
|
347
|
-
|
|
348
346
|
if library_convert.initialized():
|
|
349
347
|
library_convert.sync_stack(plan, attempt_id=attempt_id, if_initialized=True)
|
|
350
348
|
|
|
@@ -29,7 +29,7 @@ from dataclasses import dataclass, field
|
|
|
29
29
|
from pathlib import Path
|
|
30
30
|
from typing import Literal, TypedDict
|
|
31
31
|
|
|
32
|
-
from localmodels import cli_help, console, hosts, http_local, stack_up, stack_verify
|
|
32
|
+
from localmodels import cli_help, console, hosts, http_local, stack_run, stack_up, stack_verify
|
|
33
33
|
from localmodels.plan_envelope import utc_now
|
|
34
34
|
from localmodels.records import Plan
|
|
35
35
|
from localmodels.stack_plan import StackError, command
|
|
@@ -343,7 +343,7 @@ def _resolve_targets(args: argparse.Namespace) -> tuple[ArenaTarget, ArenaTarget
|
|
|
343
343
|
):
|
|
344
344
|
return _explicit_targets(args)
|
|
345
345
|
by_name = {r["plan"]["name"]: r["plan"] for r in hosts.records(hosts.LOCAL_ID) if r.get("ok")}
|
|
346
|
-
plan =
|
|
346
|
+
plan = stack_run.accepted()
|
|
347
347
|
if plan is not None and plan.get("llm_fast") is not None:
|
|
348
348
|
if stack_up.drift(plan):
|
|
349
349
|
raise StackError(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The caller supplies the resident llama.cpp score and id. The validated recipe order, tie band,
|
|
4
4
|
RAM fit and generated-pack refusals are the same policy formerly in stack_compose; local reads
|
|
5
|
-
are supplied through the planner's readers and
|
|
5
|
+
are supplied through the planner's readers and suite_plan.build_plan. No state is saved or applied.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
@@ -15,6 +15,7 @@ from dataclasses import replace
|
|
|
15
15
|
from localmodels import component, hosts, metal, suite
|
|
16
16
|
from localmodels import stack_decision as decide
|
|
17
17
|
from localmodels.budget import gib
|
|
18
|
+
from localmodels.engine_adapters import suite_plan
|
|
18
19
|
from localmodels.plan_envelope import PlanError
|
|
19
20
|
from localmodels.probe import GPU, HostFacts
|
|
20
21
|
from localmodels.records import Plan
|
|
@@ -61,11 +62,12 @@ def _metal_keep_aux(
|
|
|
61
62
|
aux: list[Plan],
|
|
62
63
|
price_llm: decide.PriceLLM,
|
|
63
64
|
) -> Plan:
|
|
64
|
-
"""Step optional Metal ubatch/MTP back
|
|
65
|
+
"""Step optional Metal ubatch/MTP/draft back when unified-memory auxiliaries need the RAM."""
|
|
65
66
|
launch = llm["launch"]
|
|
66
67
|
if not aux or (
|
|
67
68
|
int(str(launch.get("ubatch") or 512)) <= 512
|
|
68
69
|
and int(str(launch.get("mtp_draft_depth") or 0)) <= 0
|
|
70
|
+
and int(str(launch.get("draft_n_max") or 0)) <= 0
|
|
69
71
|
):
|
|
70
72
|
return llm
|
|
71
73
|
needed = (
|
|
@@ -132,7 +134,7 @@ def place(
|
|
|
132
134
|
out.append(part)
|
|
133
135
|
continue
|
|
134
136
|
try:
|
|
135
|
-
gpu_part =
|
|
137
|
+
gpu_part = suite_plan.build_plan(
|
|
136
138
|
hosts.LOCAL_ID,
|
|
137
139
|
facts,
|
|
138
140
|
recipe,
|
|
@@ -13,7 +13,7 @@ import math
|
|
|
13
13
|
from html import escape
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
|
|
16
|
-
from localmodels import cli_help, stack_up, stack_view_llm, stack_warm, suite
|
|
16
|
+
from localmodels import cli_help, stack_run, stack_up, stack_view_llm, stack_warm, suite
|
|
17
17
|
from localmodels.budget import gib
|
|
18
18
|
from localmodels.stack_plan import StackError, StackPlan
|
|
19
19
|
|
|
@@ -181,7 +181,7 @@ def add_parser(actions: argparse._SubParsersAction[argparse.ArgumentParser]) ->
|
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
def cli(args: argparse.Namespace) -> int:
|
|
184
|
-
plan =
|
|
184
|
+
plan = stack_run.accepted()
|
|
185
185
|
if plan is None or stack_up.drift(plan):
|
|
186
186
|
raise StackError("no unchanged accepted local stack; run stack install or stack up")
|
|
187
187
|
directory = Path(plan["llm"]["service"]["deploy_dir"]).expanduser()
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
An uninstall leaves nothing behind but what was downloaded and verified (the model files and
|
|
4
4
|
the tool and engine archives, so the next install needs no download), the owned manifest that
|
|
5
|
-
lists them (so ``--purge`` can delete them later) and the
|
|
5
|
+
lists them (so ``--purge`` can delete them later) and the permanent empty lock files
|
|
6
|
+
(``tools/owned.lock``, WHI-317, and ``engines/.engine.lock``, WHI-759). stack_lifecycle.remove stops and removes the
|
|
6
7
|
services, the gateway and the tools; ``sweep`` then deletes what only the stack used: the
|
|
7
8
|
engines its deployments ran that no remaining record names (with their download archives), the
|
|
8
9
|
saved stack plans with their run records, the cached host facts, and the tool's own directories
|
|
@@ -204,7 +205,7 @@ def tidy(base_dirs: Iterable[Path], tools_dir: str | Path = hosts.TOOLS_DIR) ->
|
|
|
204
205
|
then the tool's own directories (OWN_DIRS) left empty and each base directory left empty.
|
|
205
206
|
A directory someone else made there stays, empty or not. The manifest's empty
|
|
206
207
|
``owned.lock`` stays: unlinking a lock file lets two writers each hold a "lock" (WHI-317,
|
|
207
|
-
.agents/skills/owned-manifest-lock),
|
|
208
|
+
.agents/skills/owned-manifest-lock), and ``engines/.engine.lock`` stays for the same reason (WHI-759, ``remote_ops_mirrors.engine_lock``)."""
|
|
208
209
|
root = Path(hosts.tools_dir(tools_dir)).expanduser()
|
|
209
210
|
private = root.resolve() / "gateway-home"
|
|
210
211
|
if not hosts.owned_path(tools_dir).exists() and private.is_dir():
|
|
@@ -453,6 +453,10 @@ def _llama_parts(
|
|
|
453
453
|
model and the prompt cache's growth are fitted to the RAM those leave (2026-11-01 user
|
|
454
454
|
decision: ticked foundations win over the cache beyond its floor and over a larger LLM)."""
|
|
455
455
|
posture = agent_posture(options)
|
|
456
|
+
if min_prompt_cache:
|
|
457
|
+
# WHI-898: capacity plans for blocked-now hosts price minimum required RAM, not
|
|
458
|
+
# optional accelerators that greedily expand into synthetic idle memory.
|
|
459
|
+
posture = replace(posture, draft="off")
|
|
456
460
|
aux_notes: list[str] = []
|
|
457
461
|
candidates = stack_suite.aux_plans(
|
|
458
462
|
facts, options, listening, previous, aux_notes, approved=approved
|
|
@@ -494,7 +498,11 @@ def _llama_parts(
|
|
|
494
498
|
base_dir=options["base_dir"],
|
|
495
499
|
hf_download_endpoint=options["hf_endpoint"],
|
|
496
500
|
hf_api_endpoint=options["hf_endpoint"],
|
|
497
|
-
agent=
|
|
501
|
+
agent=(
|
|
502
|
+
posture
|
|
503
|
+
if mtp
|
|
504
|
+
else replace(posture, mtp_draft_depth=0, ubatch_pinned=True, draft="off")
|
|
505
|
+
),
|
|
498
506
|
quant=str(options.get("quant") or ""),
|
|
499
507
|
),
|
|
500
508
|
entries=entries,
|
|
@@ -23,6 +23,7 @@ from localmodels import (
|
|
|
23
23
|
cli_help,
|
|
24
24
|
http_local,
|
|
25
25
|
stack_lifecycle,
|
|
26
|
+
stack_run,
|
|
26
27
|
stack_up,
|
|
27
28
|
stack_verify,
|
|
28
29
|
stack_view_gpu,
|
|
@@ -431,7 +432,7 @@ def add_parser(actions: argparse._SubParsersAction[argparse.ArgumentParser]) ->
|
|
|
431
432
|
def cli(args: argparse.Namespace) -> int:
|
|
432
433
|
if not 0.1 <= args.seconds <= 60 or not 0.1 <= args.interval <= 60:
|
|
433
434
|
raise StackError("--seconds and --interval must be between 0.1 and 60")
|
|
434
|
-
plan =
|
|
435
|
+
plan = stack_run.accepted()
|
|
435
436
|
if plan is None or stack_up.drift(plan):
|
|
436
437
|
raise StackError("no unchanged accepted local stack; run stack install or stack up")
|
|
437
438
|
report = sample(plan, args.seconds, args.interval)
|
|
@@ -31,8 +31,8 @@ from localmodels import (
|
|
|
31
31
|
)
|
|
32
32
|
from localmodels.context_policy import AGENT
|
|
33
33
|
from localmodels.contracts import decode
|
|
34
|
-
from localmodels.memcalc import KV_TYPES, MemcalcError, parse_tokens
|
|
35
34
|
from localmodels.plan_envelope import PlanError
|
|
35
|
+
from localmodels.planning.memcalc import KV_TYPES, MemcalcError, parse_tokens
|
|
36
36
|
from localmodels.probe import HostFacts
|
|
37
37
|
from localmodels.stack_compose import agent_posture, choose_parts, ram_budget
|
|
38
38
|
from localmodels.stack_plan import PREFERENCES, StackError, default_options
|
|
@@ -32,7 +32,8 @@ from localmodels.context_policy import (
|
|
|
32
32
|
posture_for,
|
|
33
33
|
)
|
|
34
34
|
from localmodels.estimator import LayerKind, ModelProfile
|
|
35
|
-
from localmodels.
|
|
35
|
+
from localmodels.plan_envelope import PlanError
|
|
36
|
+
from localmodels.planning.memcalc import (
|
|
36
37
|
KV_TYPES,
|
|
37
38
|
MemcalcError,
|
|
38
39
|
parse_params,
|
|
@@ -40,8 +41,7 @@ from localmodels.memcalc import (
|
|
|
40
41
|
parse_tokens,
|
|
41
42
|
quant_bits,
|
|
42
43
|
)
|
|
43
|
-
from localmodels.memcalc_load import WeightOptions, load_model
|
|
44
|
-
from localmodels.plan_envelope import PlanError
|
|
44
|
+
from localmodels.planning.memcalc_load import WeightOptions, load_model
|
|
45
45
|
from localmodels.stack_plan import RAM_FLOOR
|
|
46
46
|
|
|
47
47
|
SCHEMA = "localmodels.stack-memory/v1"
|
|
@@ -342,6 +342,22 @@ def latest() -> tuple[RunView | None, StackPlan | None]:
|
|
|
342
342
|
return project(run, plan), typed
|
|
343
343
|
|
|
344
344
|
|
|
345
|
+
def accepted(plan_id: str | None = None) -> StackPlan | None:
|
|
346
|
+
"""The plan of the last ``stack apply`` (of ``plan_id`` when given) if that apply passed."""
|
|
347
|
+
for run, saved in reversed(hosts.stack_runs()):
|
|
348
|
+
if plan_id is not None and run.get("plan_id") != plan_id:
|
|
349
|
+
continue
|
|
350
|
+
view = project(run, saved)
|
|
351
|
+
if view is None or not view["ok"] or saved is None:
|
|
352
|
+
return None
|
|
353
|
+
try:
|
|
354
|
+
plan = decode(saved, StackPlan)
|
|
355
|
+
except ValueError:
|
|
356
|
+
return None
|
|
357
|
+
return plan if digest(plan) == plan["plan_id"] == view["plan_id"] else None
|
|
358
|
+
return None
|
|
359
|
+
|
|
360
|
+
|
|
345
361
|
def reapply_command(plan: StackPlan | None) -> str:
|
|
346
362
|
"""How to run the same approved plan again: apply rechecks the host and redoes only what is
|
|
347
363
|
missing, so a deleted provider or a stopped service comes back without a new approval."""
|
|
@@ -19,6 +19,7 @@ from localmodels import stack_gpu_memory as gpu_memory
|
|
|
19
19
|
from localmodels import stack_llm_ram as llm_ram
|
|
20
20
|
from localmodels.budget import busy_cards, gib, holders, host_ram, idle_cards, sharing_cards
|
|
21
21
|
from localmodels.context_policy import AgentPosture
|
|
22
|
+
from localmodels.engine_adapters import suite_plan
|
|
22
23
|
from localmodels.engines import engine_lock_path
|
|
23
24
|
from localmodels.plan_envelope import PlanError
|
|
24
25
|
from localmodels.probe import GPU, HostFacts
|
|
@@ -363,7 +364,7 @@ def strata_parts(
|
|
|
363
364
|
vision_reader=reader,
|
|
364
365
|
reasoning_budget=int(options.get("reasoning_budget") or 0),
|
|
365
366
|
)
|
|
366
|
-
llm = running_llm or
|
|
367
|
+
llm = running_llm or suite_plan.build_plan(hosts.LOCAL_ID, facts, llm_recipe, opts)
|
|
367
368
|
if not running_llm and unified:
|
|
368
369
|
llm = _on_unified_memory(llm, llm_recipe)
|
|
369
370
|
elif not running_llm and facts["platform"] == "win32":
|
|
@@ -464,7 +465,7 @@ def _decide_parking(
|
|
|
464
465
|
budget_mib = int(recipe.get("conversation_cache", {}).get("mib", 0))
|
|
465
466
|
if not running and options["conversation_cache"] == "auto" and budget_mib:
|
|
466
467
|
if room >= budget_mib << 20:
|
|
467
|
-
llm =
|
|
468
|
+
llm = suite_plan.build_plan(
|
|
468
469
|
hosts.LOCAL_ID, facts, recipe, replace(opts, conversation_cache_mib=budget_mib)
|
|
469
470
|
)
|
|
470
471
|
else:
|
|
@@ -617,7 +618,7 @@ def aux_plans(
|
|
|
617
618
|
)
|
|
618
619
|
)
|
|
619
620
|
chosen = replace(opts, port=port)
|
|
620
|
-
part =
|
|
621
|
+
part = suite_plan.build_plan(hosts.LOCAL_ID, facts, r, chosen)
|
|
621
622
|
# No cgroups on macOS or Windows: priced by the estimate, no slice promised.
|
|
622
623
|
if metal.supported(facts) or facts["platform"] == "win32":
|
|
623
624
|
part = suite.unbounded(part)
|
|
@@ -28,6 +28,7 @@ from localmodels import (
|
|
|
28
28
|
gateway_keys,
|
|
29
29
|
harness,
|
|
30
30
|
hosts,
|
|
31
|
+
stack_run,
|
|
31
32
|
stack_suite,
|
|
32
33
|
stack_try_docs,
|
|
33
34
|
stack_up,
|
|
@@ -72,7 +73,7 @@ def _check_image_vision(plan: StackPlan) -> None:
|
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
def _installed(mode: str) -> tuple[Gateway, str | None, StackPlan]:
|
|
75
|
-
plan =
|
|
76
|
+
plan = stack_run.accepted()
|
|
76
77
|
if plan is None:
|
|
77
78
|
raise StackError(f"No accepted stack is installed; run {command()} install.")
|
|
78
79
|
if stack_up.drift(plan):
|
|
@@ -19,9 +19,19 @@ from collections.abc import Callable
|
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
from typing import Literal, TypedDict
|
|
21
21
|
|
|
22
|
-
from localmodels import
|
|
22
|
+
from localmodels import (
|
|
23
|
+
app,
|
|
24
|
+
console,
|
|
25
|
+
deploy,
|
|
26
|
+
gateway,
|
|
27
|
+
harness,
|
|
28
|
+
hosts,
|
|
29
|
+
library_convert,
|
|
30
|
+
stack_hardware,
|
|
31
|
+
stack_run,
|
|
32
|
+
stack_verify,
|
|
33
|
+
)
|
|
23
34
|
from localmodels import stack_lifecycle as lifecycle
|
|
24
|
-
from localmodels.approval import digest
|
|
25
35
|
from localmodels.budget import gpu_conflicts, gpu_users_unknown, unknown_services
|
|
26
36
|
from localmodels.contracts import decode
|
|
27
37
|
from localmodels.records import Plan
|
|
@@ -62,34 +72,11 @@ class UpReport(_UpReportSince20261102):
|
|
|
62
72
|
notes: list[str]
|
|
63
73
|
|
|
64
74
|
|
|
65
|
-
def accepted() -> StackPlan | None:
|
|
66
|
-
"""The plan of the last ``stack apply``, if that apply passed."""
|
|
67
|
-
return _accepted()
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def _accepted(plan_id: str | None = None) -> StackPlan | None:
|
|
71
|
-
"""The plan of the last stack apply (of ``plan_id`` when given) if that apply passed."""
|
|
72
|
-
for run, saved in reversed(hosts.stack_runs()):
|
|
73
|
-
if plan_id is not None and run.get("plan_id") != plan_id:
|
|
74
|
-
continue
|
|
75
|
-
view = stack_run.project(run, saved)
|
|
76
|
-
if view is None or not view["ok"] or saved is None:
|
|
77
|
-
return None
|
|
78
|
-
try:
|
|
79
|
-
plan = decode(saved, StackPlan)
|
|
80
|
-
except ValueError:
|
|
81
|
-
return None
|
|
82
|
-
return plan if digest(plan) == plan["plan_id"] == view["plan_id"] else None
|
|
83
|
-
return None
|
|
84
|
-
|
|
85
|
-
|
|
86
75
|
def library_parts(plan: StackPlan) -> set[str]:
|
|
87
76
|
"""The deployment names of ``plan``'s LLMs the model library adopted (the rule setup binding
|
|
88
77
|
uses, library_convert.adopted_components): the library loads, unloads and removes them, so
|
|
89
78
|
``library unload`` (Linger runs it on quit and before a kit update) deletes their records. They are the library's to start, not ``stack
|
|
90
79
|
up``'s, and their records missing is not drift."""
|
|
91
|
-
from localmodels import library_convert, stack_verify
|
|
92
|
-
|
|
93
80
|
adopted = library_convert.adopted_components(plan)
|
|
94
81
|
return {part["name"] for component, part in stack_verify.parts(plan) if component in adopted}
|
|
95
82
|
|
|
@@ -120,7 +107,7 @@ def installed(
|
|
|
120
107
|
existed) stays installed when the default is Bifrost; a changed default does not move it. A
|
|
121
108
|
stack that still runs the web search service an earlier version installed goes down the whole
|
|
122
109
|
path, whose update plan retires it."""
|
|
123
|
-
plan =
|
|
110
|
+
plan = stack_run.accepted()
|
|
124
111
|
if plan is None or drift(plan):
|
|
125
112
|
return None
|
|
126
113
|
if any(part["endpoint"].get("contract") == stack_run.SEARCH for part in plan["aux"]):
|
|
@@ -202,8 +189,6 @@ def _unstartable(part: Plan, state: str) -> str:
|
|
|
202
189
|
|
|
203
190
|
def _sync_library(plan: StackPlan) -> None:
|
|
204
191
|
"""Keep an already-used model library in step after ``stack up`` revives the stack."""
|
|
205
|
-
from localmodels import library_convert
|
|
206
|
-
|
|
207
192
|
if library_convert.initialized():
|
|
208
193
|
attempt = next(
|
|
209
194
|
(
|
|
@@ -361,7 +346,7 @@ def print_report(report: UpReport, out: Out = print) -> int:
|
|
|
361
346
|
|
|
362
347
|
def cli(args: argparse.Namespace) -> int:
|
|
363
348
|
if args.plan is None:
|
|
364
|
-
plan =
|
|
349
|
+
plan = stack_run.accepted()
|
|
365
350
|
if plan is None:
|
|
366
351
|
raise StackError(
|
|
367
352
|
"no stack apply record that passed full acceptance; "
|
|
@@ -369,7 +354,7 @@ def cli(args: argparse.Namespace) -> int:
|
|
|
369
354
|
)
|
|
370
355
|
else:
|
|
371
356
|
saved = decode(json.loads(Path(args.plan).read_text(encoding="utf-8")), StackPlan)
|
|
372
|
-
plan =
|
|
357
|
+
plan = stack_run.accepted(saved["plan_id"])
|
|
373
358
|
if plan is None or plan != saved:
|
|
374
359
|
raise StackError(
|
|
375
360
|
f"plan {saved['plan_id'][:12]} has no stack apply record that passed full acceptance; "
|
|
@@ -35,14 +35,19 @@ def llm_parts(part: Plan, window: int | None = None) -> dict[str, int]:
|
|
|
35
35
|
if not isinstance(slots, int) or not isinstance(kv_types, list) or len(kv_types) != 2:
|
|
36
36
|
return {}
|
|
37
37
|
profile = eager(entry.profile(variant)) # the agent argv has no --lazy-mode
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
parts = dict(
|
|
39
|
+
agent_footprint_parts(
|
|
40
|
+
profile,
|
|
41
|
+
window or planned,
|
|
42
|
+
slots=slots,
|
|
43
|
+
kv_types=(str(kv_types[0]), str(kv_types[1])),
|
|
44
|
+
ubatch=_int(launch.get("ubatch")) or entry.agent_posture(AGENT).ubatch,
|
|
45
|
+
mtp=_int(launch.get("mtp_draft_depth")) > 0,
|
|
46
|
+
)
|
|
45
47
|
)
|
|
48
|
+
if draft_bytes := _int(launch.get("draft_bytes")):
|
|
49
|
+
parts["draft"] = draft_bytes
|
|
50
|
+
return parts
|
|
46
51
|
|
|
47
52
|
|
|
48
53
|
def active_weight_bytes(part: Plan) -> int | None:
|
|
@@ -41,16 +41,17 @@ import urllib.error
|
|
|
41
41
|
import urllib.request
|
|
42
42
|
from collections.abc import Callable
|
|
43
43
|
from pathlib import Path
|
|
44
|
-
from typing import Literal, TypedDict
|
|
44
|
+
from typing import Literal, TypedDict, cast
|
|
45
45
|
|
|
46
46
|
from localmodels import (
|
|
47
47
|
cli_help,
|
|
48
|
+
debug_mode,
|
|
48
49
|
metal,
|
|
49
50
|
metal_probe,
|
|
50
51
|
probe,
|
|
51
52
|
process_identity,
|
|
52
53
|
process_windows,
|
|
53
|
-
|
|
54
|
+
stack_run,
|
|
54
55
|
stack_verify,
|
|
55
56
|
stack_warm_store,
|
|
56
57
|
)
|
|
@@ -400,6 +401,8 @@ def prompt_speed(part: Plan, chat: Prefill = _chat) -> float | None:
|
|
|
400
401
|
def warm_llm(part: Plan, chat: Chat = _chat) -> LlmWarm:
|
|
401
402
|
"""Two short requests at the stack's LLM. The first takes whatever is cold; the second is
|
|
402
403
|
the speed a user gets."""
|
|
404
|
+
if (simulated := debug_mode.simulating()) is not None:
|
|
405
|
+
return cast(LlmWarm, debug_mode.simulated_warm(simulated))
|
|
403
406
|
seen: LlmWarm = {
|
|
404
407
|
"name": part["name"],
|
|
405
408
|
"ok": False,
|
|
@@ -629,7 +632,7 @@ def add_parser(actions: argparse._SubParsersAction[argparse.ArgumentParser]) ->
|
|
|
629
632
|
|
|
630
633
|
|
|
631
634
|
def cli(args: argparse.Namespace) -> int:
|
|
632
|
-
plan = None if args.host_only else
|
|
635
|
+
plan = None if args.host_only else stack_run.accepted()
|
|
633
636
|
report = warm(allow_sudo=args.sudo, host_only=args.host_only, plan=plan)
|
|
634
637
|
if args.json:
|
|
635
638
|
json.dump(report, sys.stdout, ensure_ascii=False, indent=1)
|
|
@@ -29,8 +29,8 @@ from localmodels import (
|
|
|
29
29
|
from localmodels import stack_hardware as hardware
|
|
30
30
|
from localmodels.context_policy import posture_for, window_k
|
|
31
31
|
from localmodels.contracts import decode
|
|
32
|
-
from localmodels.memcalc import parse_size
|
|
33
32
|
from localmodels.plan_envelope import PlanError
|
|
33
|
+
from localmodels.planning.memcalc import parse_size
|
|
34
34
|
from localmodels.probe import GPU, HostFacts, Services
|
|
35
35
|
from localmodels.stack_compose import agent_posture, choose_parts, ram_budget
|
|
36
36
|
from localmodels.stack_memory import Machine
|