@simplexai/localmodels-darwin-x64 0.1.0-dev.65 → 0.1.0-dev.68
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 +62 -61
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/auth_proxy.py +34 -2
- package/modules/localmodels/bifrost_config.py +11 -6
- package/modules/localmodels/catalog.json +500 -16
- package/modules/localmodels/custom_hub.py +54 -6
- package/modules/localmodels/custom_probe.py +28 -0
- package/modules/localmodels/debug_stub_server.py +34 -1
- package/modules/localmodels/deploy.py +33 -349
- package/modules/localmodels/download-mirrors.json +43 -3
- package/modules/localmodels/draft_spec.py +1 -1
- package/modules/localmodels/engine_adapters/__init__.py +4 -2
- package/modules/localmodels/engine_adapters/auxiliary.py +4 -1
- package/modules/localmodels/engine_adapters/llama_cpp.py +539 -0
- package/modules/localmodels/engines-b11583.json +9 -5
- package/modules/localmodels/engines-b12757-mix-ef2df21.json +85 -1
- package/modules/localmodels/engines.json +9 -5
- package/modules/localmodels/gateway_bifrost.py +2 -1
- package/modules/localmodels/harness_gateway.py +14 -3
- package/modules/localmodels/harness_probe.py +64 -3
- package/modules/localmodels/library_custom.py +9 -7
- package/modules/localmodels/library_elastic.py +5 -4
- package/modules/localmodels/library_jobs.py +138 -25
- package/modules/localmodels/library_model.py +22 -2
- package/modules/localmodels/library_order.py +1 -1
- package/modules/localmodels/library_serve.py +49 -11
- package/modules/localmodels/library_state.py +12 -0
- package/modules/localmodels/library_status.py +10 -0
- package/modules/localmodels/pi_profile.py +1 -1
- package/modules/localmodels/planning/budget.py +8 -3
- package/modules/localmodels/process_identity.py +73 -10
- package/modules/localmodels/remote_ops_mirrors.py +55 -19
- package/modules/localmodels/runtime_io.py +1 -0
- package/modules/localmodels/runtime_windows_acl.py +47 -17
- package/modules/localmodels/service_deployment.py +3 -3
- package/modules/localmodels/setup_inspection.py +28 -1
- package/modules/localmodels/setup_inspection_harness.py +4 -1
- package/modules/localmodels/setup_text.py +6 -0
- package/modules/localmodels/slot_cache.py +1 -3
- package/modules/localmodels/speech_admission.py +16 -4
- package/modules/localmodels/speech_catalog.py +5 -1
- package/modules/localmodels/speech_cli.py +5 -5
- package/modules/localmodels/speech_jobs.py +101 -19
- package/modules/localmodels/speech_server.py +2 -0
- package/modules/localmodels/speech_worker_sensevoice.py +194 -6
- package/modules/localmodels/speech_workers.py +74 -6
- package/modules/localmodels/stack.py +13 -1
- package/modules/localmodels/stack_auto.py +6 -0
- package/modules/localmodels/stack_capacity.py +3 -3
- package/modules/localmodels/stack_cli.py +3 -0
- package/modules/localmodels/stack_compose.py +7 -3
- package/modules/localmodels/stack_ports.py +58 -27
- package/modules/localmodels/stack_suite.py +7 -1
- package/modules/localmodels/suite.py +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev65.dist-info → simplex_localmodels-0.1.0.dev68.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev65.dist-info → simplex_localmodels-0.1.0.dev68.dist-info}/RECORD +59 -58
- package/modules/{simplex_localmodels-0.1.0.dev65.dist-info → simplex_localmodels-0.1.0.dev68.dist-info}/licenses/NOTICE +3 -0
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/{simplex_localmodels-0.1.0.dev65.dist-info → simplex_localmodels-0.1.0.dev68.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev65.dist-info → simplex_localmodels-0.1.0.dev68.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev65.dist-info → simplex_localmodels-0.1.0.dev68.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -15,47 +15,30 @@ from dataclasses import dataclass, replace
|
|
|
15
15
|
from localmodels import catalog as cat
|
|
16
16
|
from localmodels import (
|
|
17
17
|
chat_template,
|
|
18
|
-
draft_spec,
|
|
19
18
|
hf_repo,
|
|
20
19
|
hosts,
|
|
21
|
-
metal,
|
|
22
20
|
plan_envelope,
|
|
23
21
|
region,
|
|
24
22
|
stack_debug,
|
|
25
|
-
vision,
|
|
26
23
|
)
|
|
27
24
|
from localmodels.context_policy import (
|
|
28
|
-
DEFAULT_UBATCH,
|
|
29
25
|
RUNTIME_OVERHEAD_BYTES,
|
|
30
26
|
AgentPosture,
|
|
31
27
|
LaunchPlan,
|
|
32
|
-
WindowDecision,
|
|
33
|
-
agent_launch_args,
|
|
34
|
-
agent_unified_bytes,
|
|
35
28
|
cache_floor_bytes,
|
|
36
29
|
fit_to_free_memory,
|
|
37
|
-
launch_args,
|
|
38
30
|
metal_host_bytes,
|
|
39
31
|
posture_for,
|
|
40
32
|
)
|
|
41
33
|
from localmodels.contracts import decode
|
|
42
34
|
from localmodels.deploy_steps import Action, step_params
|
|
43
|
-
from localmodels.
|
|
44
|
-
|
|
45
|
-
commit_matches,
|
|
46
|
-
engine_lock_commit,
|
|
47
|
-
engine_lock_path,
|
|
48
|
-
host_engine,
|
|
49
|
-
release_engine,
|
|
50
|
-
select_engine_build,
|
|
51
|
-
)
|
|
52
|
-
from localmodels.estimator import PhysicsRefusal, as_loaded, eager
|
|
35
|
+
from localmodels.engine_adapters import llama_cpp
|
|
36
|
+
from localmodels.estimator import PhysicsRefusal, as_loaded
|
|
53
37
|
from localmodels.plan_envelope import (
|
|
54
38
|
HubUnreachableError,
|
|
55
39
|
PlanError,
|
|
56
40
|
catalog_pins,
|
|
57
41
|
deployment,
|
|
58
|
-
hub_url,
|
|
59
42
|
require_disk,
|
|
60
43
|
require_free_port,
|
|
61
44
|
utc_now,
|
|
@@ -76,14 +59,11 @@ from localmodels.records import (
|
|
|
76
59
|
PinnedFile,
|
|
77
60
|
Plan,
|
|
78
61
|
ProgressEvent,
|
|
79
|
-
ReleaseEngine,
|
|
80
|
-
ReusableFile,
|
|
81
62
|
)
|
|
82
63
|
from localmodels.transport import Executor
|
|
83
64
|
|
|
84
65
|
DEFAULT_BASE_DIR = "~/.local/share/localmodels"
|
|
85
66
|
DEFAULT_PORT = 18100
|
|
86
|
-
METAL_DEFAULT_ENGINE = "b12757-mix-ef2df21"
|
|
87
67
|
HF_API = region.HF_API
|
|
88
68
|
|
|
89
69
|
|
|
@@ -93,18 +73,6 @@ def hf_endpoint() -> str:
|
|
|
93
73
|
return os.environ.get("HF_ENDPOINT", "").strip().rstrip("/") or HF_API
|
|
94
74
|
|
|
95
75
|
|
|
96
|
-
CPU_ARGS = (
|
|
97
|
-
"--device",
|
|
98
|
-
"none",
|
|
99
|
-
"--gpu-layers",
|
|
100
|
-
"0",
|
|
101
|
-
"--no-kv-offload",
|
|
102
|
-
"--no-op-offload",
|
|
103
|
-
"--fit",
|
|
104
|
-
"off",
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
|
|
108
76
|
EventSink = Callable[[str, ProgressEvent], None] # (step, event) as each step reports it
|
|
109
77
|
|
|
110
78
|
|
|
@@ -297,76 +265,6 @@ def _llama_entry(
|
|
|
297
265
|
return entry
|
|
298
266
|
|
|
299
267
|
|
|
300
|
-
def _companion_args(
|
|
301
|
-
by_name: dict[str, ReusableFile],
|
|
302
|
-
mmproj: cat.AssetFile | None,
|
|
303
|
-
reader: str,
|
|
304
|
-
draft: cat.AssetFile | None,
|
|
305
|
-
decision: WindowDecision,
|
|
306
|
-
mtp_head: cat.AssetFile | None,
|
|
307
|
-
*,
|
|
308
|
-
is_agent: bool,
|
|
309
|
-
) -> list[str]:
|
|
310
|
-
args: list[str] = []
|
|
311
|
-
if mmproj is not None:
|
|
312
|
-
args += vision.llama_args(by_name[mmproj.path]["dest"], reader)
|
|
313
|
-
if draft is not None:
|
|
314
|
-
args += draft_spec.llama_args(
|
|
315
|
-
by_name[draft.path]["dest"], decision.draft_type, decision.draft_n_max
|
|
316
|
-
)
|
|
317
|
-
if mtp_head is not None and not is_agent:
|
|
318
|
-
args += ["--model-draft", by_name[mtp_head.path]["dest"]]
|
|
319
|
-
return args
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
def drafter_engine_ok(
|
|
323
|
-
spec: draft_spec.DraftSpec, build: str | None, commit: str | None = None
|
|
324
|
-
) -> bool:
|
|
325
|
-
"""Whether llama.cpp ``build`` accepts the drafter's ``--spec-type``: at least its
|
|
326
|
-
``min_engine`` release, from the same fork (``b12757-mix-…`` needs a ``mix`` build), or a
|
|
327
|
-
reused engine that is ``min_engine`` itself: probe reads only ``b12757`` and a commit from
|
|
328
|
-
``--version``, so the commit must be the lock's pinned one or the tag's own suffix."""
|
|
329
|
-
if not spec.min_engine:
|
|
330
|
-
return True
|
|
331
|
-
have, need = cat.build_number(build), cat.build_number(spec.min_engine)
|
|
332
|
-
if have is None or need is None or have < need:
|
|
333
|
-
return False
|
|
334
|
-
tag_commit = spec.min_engine.split("-")[-1] if spec.min_engine.count("-") >= 2 else None
|
|
335
|
-
if commit_matches(engine_lock_commit(spec.min_engine), commit) or commit_matches(
|
|
336
|
-
tag_commit, commit
|
|
337
|
-
):
|
|
338
|
-
return True
|
|
339
|
-
fork = spec.min_engine.split("-")[1:2]
|
|
340
|
-
return not fork or str(build).split("-")[1:2] == fork
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
def asset_dest(base_dir: str, local_name: str) -> str:
|
|
344
|
-
"""Where a plan keeps a companion file (projector, drafter, MTP head) under ``base_dir``."""
|
|
345
|
-
return f"{base_dir.rstrip('/')}/models/assets/{local_name}"
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
def drafter_in_place(entry: cat.CatalogEntry, base_dir: str) -> bool:
|
|
349
|
-
"""Whether ``entry``'s optional external drafter is under ``base_dir`` with the catalog's
|
|
350
|
-
pinned bytes (its SHA256 receipt). A library load plans the drafter only then: it is an
|
|
351
|
-
accelerator, so a model downloaded before its drafter shipped (Inkling 2 Mini before dev64),
|
|
352
|
-
or one whose drafter fails verification, loads without speculation instead of failing."""
|
|
353
|
-
asset = entry.draft
|
|
354
|
-
if asset is None or asset.sha256 is None:
|
|
355
|
-
return False
|
|
356
|
-
pinned = catalog_pins([(asset.repo or entry.repo, asset)], "")[0]
|
|
357
|
-
planned: ReusableFile = {
|
|
358
|
-
"repo": pinned["repo"],
|
|
359
|
-
"path": pinned["path"],
|
|
360
|
-
"revision": pinned["revision"],
|
|
361
|
-
"size_bytes": pinned["size_bytes"],
|
|
362
|
-
"sha256": pinned["sha256"],
|
|
363
|
-
"local_name": pinned["local_name"],
|
|
364
|
-
"url": "",
|
|
365
|
-
"dest": asset_dest(base_dir, pinned["local_name"]),
|
|
366
|
-
}
|
|
367
|
-
return plan_envelope.verified_in_place(planned)
|
|
368
|
-
|
|
369
|
-
|
|
370
268
|
def build_plan(
|
|
371
269
|
host_id: str,
|
|
372
270
|
facts: HostFacts,
|
|
@@ -374,71 +272,35 @@ def build_plan(
|
|
|
374
272
|
entries: tuple[cat.CatalogEntry, ...] | None = None,
|
|
375
273
|
resolver: Callable[[list[tuple[str, cat.AssetFile]], str], list[PinnedFile]] = resolve_files,
|
|
376
274
|
) -> Plan:
|
|
275
|
+
"""The llama.cpp plan for ``options.model_id``; ``llama_cpp`` holds the engine and the
|
|
276
|
+
parts that differ by device."""
|
|
377
277
|
entries = cat.load_catalog_file() if entries is None else entries
|
|
378
278
|
entry = _llama_entry(entries, options.model_id, api=options.hf_api_endpoint)
|
|
379
279
|
variant = stack_debug.variant(entry, options.quant)
|
|
380
280
|
if options.agent is not None:
|
|
381
281
|
placement, launch = _choose_agent_placement(facts, entry, variant, options)
|
|
282
|
+
agent = entry.agent_posture(posture_for(options.agent, placement.backend))
|
|
382
283
|
else:
|
|
383
284
|
placement, launch = _choose_placement(facts, entry, variant, options.placement_id)
|
|
285
|
+
agent = None
|
|
384
286
|
decision = launch.decision
|
|
385
287
|
if isinstance(decision, PhysicsRefusal):
|
|
386
288
|
raise PlanError("placement refused by context policy")
|
|
387
|
-
|
|
388
|
-
|
|
289
|
+
backend = llama_cpp.backend_for(placement.backend)
|
|
290
|
+
extra = llama_cpp.companions(entry, decision, agent=agent is not None)
|
|
389
291
|
base = options.base_dir.rstrip("/")
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
mmproj = entry.mmproj if reader != "off" else None
|
|
393
|
-
draft = entry.draft if options.agent is not None and decision.draft_n_max > 0 else None
|
|
394
|
-
companions = (mmproj, draft) if options.agent is not None else (mmproj, entry.mtp_head)
|
|
395
|
-
assets = [(entry.repo, f) for f in variant.files] + [
|
|
396
|
-
(a.repo or entry.repo, a) for a in companions if a is not None
|
|
397
|
-
]
|
|
398
|
-
pinned = resolver(assets, options.hf_api_endpoint)
|
|
399
|
-
model_names = {f.path for f in variant.files}
|
|
400
|
-
files: list[ReusableFile] = [
|
|
401
|
-
{
|
|
402
|
-
"repo": f["repo"],
|
|
403
|
-
"path": f["path"],
|
|
404
|
-
"revision": f["revision"],
|
|
405
|
-
"size_bytes": f["size_bytes"],
|
|
406
|
-
"sha256": f["sha256"],
|
|
407
|
-
"local_name": f["local_name"],
|
|
408
|
-
"dest": (
|
|
409
|
-
f"{models_dir}/{f['local_name']}"
|
|
410
|
-
if f["path"] in model_names or f["local_name"].startswith("custom/")
|
|
411
|
-
else asset_dest(base, f["local_name"])
|
|
412
|
-
),
|
|
413
|
-
"url": hub_url(options.hf_download_endpoint, f["repo"], f["revision"], f["path"]),
|
|
414
|
-
}
|
|
415
|
-
for f in pinned
|
|
416
|
-
]
|
|
292
|
+
pinned = resolver(llama_cpp.assets(entry, variant, extra), options.hf_api_endpoint)
|
|
293
|
+
files = llama_cpp.plan_files(pinned, variant, base, options.hf_download_endpoint)
|
|
417
294
|
require_disk(facts, files, local=host_id == hosts.LOCAL_ID)
|
|
418
295
|
|
|
419
296
|
where = deployment(entry.id, options.port, base, options.bind, hosts.deployment_dirs(host_id))
|
|
420
|
-
model_path = f"{models_dir}/{files[0]['local_name']}"
|
|
421
|
-
if options.agent is not None:
|
|
422
|
-
agent_eff = entry.agent_posture(posture_for(options.agent, placement.backend))
|
|
423
|
-
args = agent_launch_args(decision, agent_eff)
|
|
424
|
-
else:
|
|
425
|
-
agent_eff = None
|
|
426
|
-
args = launch_args(
|
|
427
|
-
as_loaded(entry.profile(variant), placement.budget),
|
|
428
|
-
decision,
|
|
429
|
-
mtp_capable=entry.mtp_capable,
|
|
430
|
-
mtp_draft_depth=entry.mtp_draft_depth,
|
|
431
|
-
uma=placement.budget.uma,
|
|
432
|
-
mtp_prefill=launch.mtp_prefill,
|
|
433
|
-
ubatch=entry.ubatch,
|
|
434
|
-
)
|
|
435
297
|
argv = [
|
|
436
298
|
options.engine_path or "",
|
|
437
299
|
"-m",
|
|
438
|
-
|
|
300
|
+
f"{base}/models/{files[0]['local_name']}",
|
|
439
301
|
"-a",
|
|
440
302
|
variant.model_id,
|
|
441
|
-
*
|
|
303
|
+
*llama_cpp.server_args(entry, variant, placement, launch, agent),
|
|
442
304
|
"--host",
|
|
443
305
|
options.bind,
|
|
444
306
|
"--port",
|
|
@@ -449,85 +311,32 @@ def build_plan(
|
|
|
449
311
|
"--metrics",
|
|
450
312
|
"--slots",
|
|
451
313
|
"--no-ui",
|
|
314
|
+
*llama_cpp.trailing_args(
|
|
315
|
+
entry, variant, files, extra, decision, backend, agent=agent is not None
|
|
316
|
+
),
|
|
452
317
|
]
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
entry.mtp_head,
|
|
463
|
-
is_agent=options.agent is not None,
|
|
318
|
+
warnings: list[str] = []
|
|
319
|
+
engine = llama_cpp.engine_plan(
|
|
320
|
+
facts,
|
|
321
|
+
entry,
|
|
322
|
+
placement.backend,
|
|
323
|
+
warnings,
|
|
324
|
+
argv,
|
|
325
|
+
base_dir=options.base_dir,
|
|
326
|
+
engine_path=options.engine_path,
|
|
464
327
|
)
|
|
465
|
-
|
|
466
|
-
argv += [f"--{key}", value]
|
|
467
|
-
if placement.backend == "cpu":
|
|
468
|
-
argv += CPU_ARGS
|
|
469
|
-
elif placement.backend == "metal":
|
|
470
|
-
argv += ["--device", "MTL0"]
|
|
471
|
-
engine = engine_plan(facts, options, entry, placement.backend, warnings, argv)
|
|
472
|
-
if (
|
|
473
|
-
draft is not None
|
|
474
|
-
and options.agent is not None
|
|
475
|
-
and entry.draft_spec is not None
|
|
476
|
-
and not drafter_engine_ok(
|
|
477
|
-
entry.draft_spec,
|
|
478
|
-
engine.get("build"),
|
|
479
|
-
next(
|
|
480
|
-
(e.get("commit") for e in facts["engines"] if e["path"] == engine["binary"]),
|
|
481
|
-
None,
|
|
482
|
-
),
|
|
483
|
-
)
|
|
484
|
-
):
|
|
328
|
+
if options.agent is not None and llama_cpp.drafter_refused(entry, extra, engine, facts):
|
|
485
329
|
# The drafter was priced before the engine was known; plan again without it.
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
replace(options, agent=replace(options.agent, draft="off")),
|
|
490
|
-
entries,
|
|
491
|
-
resolver,
|
|
492
|
-
)
|
|
493
|
-
plan["warnings"] = [
|
|
494
|
-
f"speculation: the {entry.draft_spec.spec_type} drafter needs llama.cpp "
|
|
495
|
-
f"{entry.draft_spec.min_engine} or newer; engine {engine.get('build') or 'unknown'} "
|
|
496
|
-
"runs without it",
|
|
497
|
-
*plan["warnings"],
|
|
498
|
-
]
|
|
330
|
+
without = replace(options, agent=replace(options.agent, draft="off"))
|
|
331
|
+
plan = build_plan(host_id, facts, without, entries, resolver)
|
|
332
|
+
plan["warnings"] = [llama_cpp.drafter_warning(entry, engine), *plan["warnings"]]
|
|
499
333
|
return plan
|
|
500
334
|
argv[0] = engine["binary"]
|
|
501
|
-
|
|
502
|
-
gpus = {g["index"]: g for g in facts.get("gpus") or []}
|
|
503
|
-
env = {}
|
|
504
|
-
if placement.backend == "cpu":
|
|
505
|
-
env["CUDA_VISIBLE_DEVICES"] = ""
|
|
506
|
-
elif placement.gpu_indices and not placement.budget.uma:
|
|
507
|
-
env["CUDA_VISIBLE_DEVICES"] = ",".join(gpus[i]["uuid"] for i in placement.gpu_indices)
|
|
508
|
-
# Windows loads a program's DLLs from its own directory; LD_LIBRARY_PATH means nothing there.
|
|
509
|
-
if facts["platform"] != "win32" and (engine["source"] == "release" or not options.engine_path):
|
|
510
|
-
env["LD_LIBRARY_PATH"] = engine.get("dir") or engine["binary"].rsplit("/", 1)[0]
|
|
511
|
-
# Older builds (< b12588) need CUDA graphs disabled on Linux SM 12.0; b12588+ and PrismML
|
|
512
|
-
# prism-b12178+ builds run cleanly with graphs enabled.
|
|
513
|
-
build_num = cat.build_number(engine.get("build"))
|
|
514
|
-
prism_num = cat.prism_build_number(engine.get("build"))
|
|
515
|
-
if (
|
|
516
|
-
facts["platform"] == "linux"
|
|
517
|
-
and placement.backend == "cuda"
|
|
518
|
-
and (build_num is None or build_num < 12588)
|
|
519
|
-
and (prism_num is None or prism_num < 12178)
|
|
520
|
-
and any(
|
|
521
|
-
gpus[i]["vendor"] == "nvidia" and gpus[i].get("compute_capability") == "12.0"
|
|
522
|
-
for i in placement.gpu_indices
|
|
523
|
-
)
|
|
524
|
-
):
|
|
525
|
-
env["GGML_CUDA_DISABLE_GRAPHS"] = "1"
|
|
526
|
-
env = dict(metal.SERVICE_ENV) if facts["platform"] == "darwin" else env
|
|
335
|
+
env = llama_cpp.service_env(facts, placement, engine, backend, reused=bool(options.engine_path))
|
|
527
336
|
|
|
528
337
|
warnings.extend(_placement_warnings(placement, facts))
|
|
529
338
|
warnings.extend(_service_warnings(facts, options, decision.spilled, decision.spill_bytes))
|
|
530
|
-
if
|
|
339
|
+
if agent is not None and entry.mmproj is not None and extra.mmproj is None:
|
|
531
340
|
warnings.append("image input is off (--vision off): the mmproj projector is not loaded")
|
|
532
341
|
require_free_port(facts, options.port, fix="pick a free port with --port")
|
|
533
342
|
service = chat_template.keep_prefix(
|
|
@@ -536,70 +345,15 @@ def build_plan(
|
|
|
536
345
|
local=host_id == hosts.LOCAL_ID,
|
|
537
346
|
agent_posture=options.agent is not None and facts["platform"] != "win32",
|
|
538
347
|
)
|
|
539
|
-
|
|
540
348
|
return build_plan_envelope(
|
|
541
349
|
host_id,
|
|
542
350
|
facts,
|
|
543
351
|
where,
|
|
544
|
-
model=
|
|
545
|
-
"id": entry.id,
|
|
546
|
-
"display_name": entry.display_name,
|
|
547
|
-
"repo": entry.repo,
|
|
548
|
-
"quant": variant.quant,
|
|
549
|
-
"model_id": variant.model_id,
|
|
550
|
-
"validated": variant.validated,
|
|
551
|
-
},
|
|
352
|
+
model=llama_cpp.model_doc(entry, variant),
|
|
552
353
|
files=files,
|
|
553
354
|
engine=engine,
|
|
554
|
-
placement=
|
|
555
|
-
|
|
556
|
-
"label": placement.label,
|
|
557
|
-
"pooled": placement.pooled,
|
|
558
|
-
"gpus": [
|
|
559
|
-
{"index": i, "uuid": gpus[i]["uuid"], "name": gpus[i]["name"]}
|
|
560
|
-
for i in placement.gpu_indices
|
|
561
|
-
if i in gpus
|
|
562
|
-
]
|
|
563
|
-
+ [
|
|
564
|
-
{"index": g["index"], "uuid": g["uuid"], "name": g["name"]}
|
|
565
|
-
for g in [metal.device(facts)]
|
|
566
|
-
if g is not None and placement.backend == "metal"
|
|
567
|
-
],
|
|
568
|
-
},
|
|
569
|
-
launch={
|
|
570
|
-
"window": decision.window,
|
|
571
|
-
"spilled": decision.spilled,
|
|
572
|
-
"spill_bytes": decision.spill_bytes,
|
|
573
|
-
"reasons": decision.reasons,
|
|
574
|
-
"mtp_prefill": launch.mtp_prefill,
|
|
575
|
-
**(
|
|
576
|
-
{
|
|
577
|
-
"slots": decision.slots,
|
|
578
|
-
"kv_types": list(decision.kv_types),
|
|
579
|
-
"mtp_draft_depth": decision.mtp_draft_depth,
|
|
580
|
-
"posture": "agent",
|
|
581
|
-
"vram_bytes": decision.vram_bytes,
|
|
582
|
-
**({"ubatch": decision.ubatch} if decision.ubatch != DEFAULT_UBATCH else {}),
|
|
583
|
-
}
|
|
584
|
-
if options.agent is not None
|
|
585
|
-
else {}
|
|
586
|
-
),
|
|
587
|
-
# Only when on: an older plan rebuilds without these keys, digest unchanged.
|
|
588
|
-
**(vision.launch_keys(mmproj, reader) if options.agent and mmproj else {}),
|
|
589
|
-
**(draft_spec.launch_keys(decision) if options.agent is not None else {}),
|
|
590
|
-
**(
|
|
591
|
-
{
|
|
592
|
-
"unified_bytes": agent_unified_bytes(
|
|
593
|
-
eager(entry.profile(variant)), decision, agent_eff
|
|
594
|
-
),
|
|
595
|
-
"cache_floor_bytes": cache_floor_bytes(
|
|
596
|
-
agent_eff, eager(entry.profile(variant))
|
|
597
|
-
),
|
|
598
|
-
}
|
|
599
|
-
if agent_eff is not None and placement.backend == "metal"
|
|
600
|
-
else {}
|
|
601
|
-
),
|
|
602
|
-
},
|
|
355
|
+
placement=llama_cpp.placement_doc(facts, placement, backend),
|
|
356
|
+
launch=llama_cpp.launch_doc(entry, variant, launch, extra, backend, agent),
|
|
603
357
|
service=service,
|
|
604
358
|
endpoint={"model": variant.model_id},
|
|
605
359
|
warnings=warnings,
|
|
@@ -650,76 +404,6 @@ def _placement_warnings(placement: Placement, facts: HostFacts) -> list[str]:
|
|
|
650
404
|
return warnings
|
|
651
405
|
|
|
652
406
|
|
|
653
|
-
def engine_plan(
|
|
654
|
-
facts: HostFacts,
|
|
655
|
-
options: PlanOptions,
|
|
656
|
-
entry: cat.CatalogEntry,
|
|
657
|
-
backend: str,
|
|
658
|
-
warnings: list[str],
|
|
659
|
-
argv: list[str],
|
|
660
|
-
) -> ReleaseEngine:
|
|
661
|
-
required = entry.min_engine or entry.engine
|
|
662
|
-
lock_commit = engine_lock_commit(entry.engine or entry.min_engine) if required else None
|
|
663
|
-
if options.engine_path:
|
|
664
|
-
known = next((e for e in facts["engines"] if e["path"] == options.engine_path), None)
|
|
665
|
-
tag = known["build"] if known else None
|
|
666
|
-
commit_ok = bool(known and commit_matches(lock_commit, known.get("commit")))
|
|
667
|
-
if not commit_ok and cat.engine_too_old(entry, tag):
|
|
668
|
-
raise PlanError(f"{entry.display_name} needs llama.cpp {required} or newer")
|
|
669
|
-
if commit_ok and (
|
|
670
|
-
not tag
|
|
671
|
-
or (
|
|
672
|
-
cat.prism_build_number(required) is not None and cat.prism_build_number(tag) is None
|
|
673
|
-
)
|
|
674
|
-
):
|
|
675
|
-
tag = required
|
|
676
|
-
if not tag:
|
|
677
|
-
warnings.append("reused engine has no comparable release; model support unconfirmed")
|
|
678
|
-
engine: ReleaseEngine = {"source": "existing", "binary": options.engine_path, "build": tag}
|
|
679
|
-
if backend == "cpu":
|
|
680
|
-
host_engine(
|
|
681
|
-
{**facts, "engines": [known] if known else []},
|
|
682
|
-
argv,
|
|
683
|
-
required or None,
|
|
684
|
-
False,
|
|
685
|
-
EngineUnavailableError(
|
|
686
|
-
"CPU deployment must confirm every reused-engine launch option; "
|
|
687
|
-
"probe again or use the pinned CPU engine"
|
|
688
|
-
),
|
|
689
|
-
[],
|
|
690
|
-
commit=lock_commit,
|
|
691
|
-
)
|
|
692
|
-
else:
|
|
693
|
-
try:
|
|
694
|
-
lock_tag = entry.engine or None
|
|
695
|
-
if lock_tag is None:
|
|
696
|
-
build = select_engine_build(facts, backend)
|
|
697
|
-
lock_tag = entry.min_engine if cat.engine_too_old(entry, build["tag"]) else None
|
|
698
|
-
metal_num = cat.build_number(METAL_DEFAULT_ENGINE) or 0
|
|
699
|
-
if backend == "metal" and (
|
|
700
|
-
lock_tag is None
|
|
701
|
-
or (lock_tag.startswith("b") and (cat.build_number(lock_tag) or 0) < metal_num)
|
|
702
|
-
):
|
|
703
|
-
lock_tag = METAL_DEFAULT_ENGINE
|
|
704
|
-
if lock_tag is not None:
|
|
705
|
-
lock = engine_lock_path(lock_tag)
|
|
706
|
-
if not lock.is_file():
|
|
707
|
-
raise PlanError(
|
|
708
|
-
f"{entry.display_name} needs llama.cpp {lock_tag}; "
|
|
709
|
-
"no pinned engine lock is available"
|
|
710
|
-
)
|
|
711
|
-
build = select_engine_build(facts, backend, lock)
|
|
712
|
-
engine = release_engine(build, options.base_dir)
|
|
713
|
-
except EngineUnavailableError as exc:
|
|
714
|
-
engine = host_engine(
|
|
715
|
-
facts, argv, required or None, False, exc, warnings, commit=lock_commit
|
|
716
|
-
)
|
|
717
|
-
if backend == "cpu" and engine["source"] == "existing":
|
|
718
|
-
if entry.mmproj is not None or entry.mtp_capable:
|
|
719
|
-
raise PlanError("CPU: reused engine vision/draft placement unknown; use pinned engine")
|
|
720
|
-
return engine
|
|
721
|
-
|
|
722
|
-
|
|
723
407
|
STEPS: tuple[Action, ...] = ("engine", "download", "install", "start", "verify")
|
|
724
408
|
SERVICE_ACTIONS: tuple[Action, ...] = ("start", "stop", "status", "remove")
|
|
725
409
|
|
|
@@ -14,6 +14,22 @@
|
|
|
14
14
|
"repo": "Diffuspace/Clover-35B-A3B-Preview",
|
|
15
15
|
"path": "chat_template.jinja"
|
|
16
16
|
},
|
|
17
|
+
"3a94bfe6e8f2741a438c0356fdc6a96ced55d453c3215e7b10a7bedcc470bd26": {
|
|
18
|
+
"repo": "ISTA-DASLab/Inkling-2-Mini-GSQ-RCO-GGUF",
|
|
19
|
+
"path": "Inkling-2-Mini-GSQ-RCO-IQ2_S.gguf"
|
|
20
|
+
},
|
|
21
|
+
"8a3515374c3cd9b65a1677b17e805bb1e32df8e98756e5f0d2fe1837d62aa4cb": {
|
|
22
|
+
"repo": "ISTA-DASLab/Inkling-2-Mini-GSQ-RCO-GGUF",
|
|
23
|
+
"path": "Inkling-2-Mini-GSQ-RCO-IQ3_S.gguf"
|
|
24
|
+
},
|
|
25
|
+
"f6533d05a0f01d6187160a51dc43e136b39dcc69485c2b819fda7ade0f4611ea": {
|
|
26
|
+
"repo": "ISTA-DASLab/Inkling-2-Mini-GSQ-RCO-GGUF",
|
|
27
|
+
"path": "Inkling-2-Mini-GSQ-RCO-IQ3_XXS.gguf"
|
|
28
|
+
},
|
|
29
|
+
"df264db473adf61660f1968726646a73599e295e882d6a120f675363bd8179e0": {
|
|
30
|
+
"repo": "ISTA-DASLab/Inkling-2-Mini-GSQ-RCO-GGUF",
|
|
31
|
+
"path": "Inkling-2-Mini-GSQ-RCO-Q2_K_XL.gguf"
|
|
32
|
+
},
|
|
17
33
|
"e6406238a5cc0043775cd1963b6f9e5b8707400276e38d9fde742304906b1330": {
|
|
18
34
|
"repo": "ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF",
|
|
19
35
|
"path": "Qwen3.8-27B-GSQ-RCO-IQ2_S-mtp.gguf"
|
|
@@ -66,14 +82,38 @@
|
|
|
66
82
|
"repo": "bartowski/GrootTeam_Groot-19B-A3B-261023-GGUF",
|
|
67
83
|
"path": "GrootTeam_Groot-19B-A3B-261023-Q4_K_M.gguf"
|
|
68
84
|
},
|
|
69
|
-
"
|
|
70
|
-
"repo": "
|
|
85
|
+
"c71f0ce00bec95b07744e116345e33d8cbbe08cef896382cf907bf4b51a2cd51": {
|
|
86
|
+
"repo": "pengzhendong/sherpa-onnx-sense-voice-zh-en-ja-ko-yue",
|
|
71
87
|
"path": "model.int8.onnx"
|
|
72
88
|
},
|
|
73
89
|
"f449eb28dc567533d7fa59be34e2abca8784f771850c78a47fb731a31429a1dc": {
|
|
74
|
-
"repo": "
|
|
90
|
+
"repo": "pengzhendong/sherpa-onnx-sense-voice-zh-en-ja-ko-yue",
|
|
75
91
|
"path": "tokens.txt"
|
|
76
92
|
},
|
|
93
|
+
"d22dc4423e0940e49884e903d2ea2f7e5567c14fc1aed97e4e26d6b8f208ef9e": {
|
|
94
|
+
"repo": "jkman2023/sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25",
|
|
95
|
+
"path": "conv_frontend.onnx"
|
|
96
|
+
},
|
|
97
|
+
"4f6885be5959ae26af3089d38ee7972c5fafbeeb1cf8d5e76eab6d8b61ca5771": {
|
|
98
|
+
"repo": "jkman2023/sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25",
|
|
99
|
+
"path": "decoder.int8.onnx"
|
|
100
|
+
},
|
|
101
|
+
"60748d3e6744a57c9c91e1b17424a6c2990567e8adceb0783940c03ed98fa9d9": {
|
|
102
|
+
"repo": "jkman2023/sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25",
|
|
103
|
+
"path": "encoder.int8.onnx"
|
|
104
|
+
},
|
|
105
|
+
"8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5": {
|
|
106
|
+
"repo": "jkman2023/sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25",
|
|
107
|
+
"path": "tokenizer/merges.txt"
|
|
108
|
+
},
|
|
109
|
+
"4942d005604266809309cabc9f4e9cb89ce855d59b14681fdc0e1cc62ea26c4c": {
|
|
110
|
+
"repo": "jkman2023/sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25",
|
|
111
|
+
"path": "tokenizer/tokenizer_config.json"
|
|
112
|
+
},
|
|
113
|
+
"ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910": {
|
|
114
|
+
"repo": "jkman2023/sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25",
|
|
115
|
+
"path": "tokenizer/vocab.json"
|
|
116
|
+
},
|
|
77
117
|
"394221709cd5ad1f40c46e6031ca61bce88931e6e088c188294c6d5a55ffa7e2": {
|
|
78
118
|
"repo": "iceCream2025/whisper.cpp",
|
|
79
119
|
"path": "ggml-large-v3-turbo-q5_0.bin"
|
|
@@ -6,7 +6,7 @@ It is strictly headroom-gated: admitted only after window, KV precision, slots,
|
|
|
6
6
|
vision are chosen, and only when the device still keeps ``METAL_DRAFT_HEADROOM_BYTES`` free. It
|
|
7
7
|
never degrades context length, KV precision, or vision, and never passes ``-devd`` (DSpark borrows
|
|
8
8
|
the target model's embeddings and LM head). Two later gates can still leave it off: deploy drops it
|
|
9
|
-
on an engine older than ``DraftSpec.min_engine`` (
|
|
9
|
+
on an engine older than ``DraftSpec.min_engine`` (engine_adapters.llama_cpp.drafter_engine_ok), and the stack drops it
|
|
10
10
|
when, on unified memory, it would leave ``--cache-ram`` below the full prompt cache
|
|
11
11
|
(planning.llm_ram.drafter_costs_cache)."""
|
|
12
12
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"""Per-engine plan adapters. ``suite_plan.build_plan`` assembles every catalog component's
|
|
2
2
|
deployment plan and asks the adapter for its runtime (``adapter_for``) only where engines differ:
|
|
3
|
-
Strata and PolyStrata (``strata_poly``) or every other server (``auxiliary``).
|
|
4
|
-
``
|
|
3
|
+
Strata and PolyStrata (``strata_poly``) or every other server (``auxiliary``). ``llama_cpp`` holds
|
|
4
|
+
the single-model llama.cpp plan's parts behind ``deploy.build_plan``, with one backend per device
|
|
5
|
+
(CUDA, Metal, CPU). The hooks are in ``base.EngineAdapter`` and ``llama_cpp.LlamaBackend``; see
|
|
6
|
+
docs/local-models/architecture.md#子包."""
|
|
@@ -3,6 +3,7 @@ llama.cpp CUDA (or Metal) engine of a GPU component."""
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
+
from localmodels.engine_adapters import llama_cpp
|
|
6
7
|
from localmodels.engine_adapters.base import EngineAdapter
|
|
7
8
|
from localmodels.records import ReleaseEngine
|
|
8
9
|
|
|
@@ -20,7 +21,9 @@ class AuxAdapter(EngineAdapter):
|
|
|
20
21
|
|
|
21
22
|
def device_args(self, *, apple: bool, on_gpu: bool) -> list[str]:
|
|
22
23
|
if apple and self.runtime in LLAMA_RUNTIMES:
|
|
23
|
-
return
|
|
24
|
+
return list(
|
|
25
|
+
llama_cpp.backend_for("metal").device_args if on_gpu else llama_cpp.NO_DEVICE
|
|
26
|
+
)
|
|
24
27
|
return []
|
|
25
28
|
|
|
26
29
|
def library_path(self, engine: ReleaseEngine, *, on_gpu: bool) -> str | None:
|