@simplexai/localmodels-linux-arm64 0.1.0-dev.59 → 0.1.0-dev.60
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 +79 -73
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +104 -43
- package/modules/localmodels/apple_sensors.py +431 -0
- package/modules/localmodels/bifrost_admin.py +30 -0
- package/modules/localmodels/bifrost_checks.py +2 -2
- package/modules/localmodels/bifrost_config.py +132 -9
- package/modules/localmodels/bifrost_models.py +1 -1
- package/modules/localmodels/catalog.json +146 -54
- package/modules/localmodels/catalog.py +20 -3
- package/modules/localmodels/catalog_add.py +42 -11
- package/modules/localmodels/custom_hub.py +983 -0
- package/modules/localmodels/custom_hub_http.py +579 -0
- package/modules/localmodels/custom_probe.py +451 -0
- package/modules/localmodels/deploy.py +27 -5
- package/modules/localmodels/deploy_steps.py +5 -0
- package/modules/localmodels/download-mirrors.json +8 -0
- package/modules/localmodels/engines-prism-b12178-03ec600.json +131 -0
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.6.json +94 -0
- package/modules/localmodels/engines.py +38 -8
- package/modules/localmodels/estimator.py +60 -7
- package/modules/localmodels/gateway.py +48 -3
- package/modules/localmodels/gateway_app_bifrost.py +4 -4
- package/modules/localmodels/gateway_bifrost.py +98 -15
- package/modules/localmodels/gguf.py +6 -0
- package/modules/localmodels/host_sensors.py +704 -0
- package/modules/localmodels/library_cli.py +181 -3
- package/modules/localmodels/library_custom.py +831 -0
- package/modules/localmodels/library_elastic.py +35 -7
- package/modules/localmodels/library_gateway.py +94 -32
- package/modules/localmodels/library_jobs.py +76 -11
- package/modules/localmodels/library_kept.py +50 -6
- package/modules/localmodels/library_model.py +254 -2
- package/modules/localmodels/library_pricing.py +83 -4
- package/modules/localmodels/library_serve.py +112 -50
- package/modules/localmodels/library_smoke.py +315 -0
- package/modules/localmodels/library_state.py +77 -1
- package/modules/localmodels/library_status.py +126 -4
- package/modules/localmodels/nvml_ctypes.py +431 -0
- package/modules/localmodels/plan_envelope.py +14 -6
- package/modules/localmodels/records.py +1 -0
- package/modules/localmodels/remote_ops.py +53 -5
- package/modules/localmodels/remote_ops_download.py +168 -29
- package/modules/localmodels/remote_ops_ranges.py +2 -5
- package/modules/localmodels/remote_ops_service.py +2 -1
- package/modules/localmodels/remote_ops_verify.py +22 -5
- package/modules/localmodels/runtime-lock.json +19 -19
- package/modules/localmodels/service_control.py +32 -1
- package/modules/localmodels/service_wiring.py +2 -3
- package/modules/localmodels/service_worker.py +6 -2
- package/modules/localmodels/services_cli.py +35 -27
- package/modules/localmodels/source_byok.py +3 -5
- package/modules/localmodels/stack_lifecycle.py +2 -2
- package/modules/localmodels/stack_memory.py +1 -0
- package/modules/localmodels/stack_view.py +77 -53
- package/modules/localmodels/stack_view_demo.py +36 -5
- package/modules/localmodels/stack_view_events.py +147 -12
- package/modules/localmodels/stack_view_gpu.py +97 -17
- package/modules/localmodels/stack_view_llm.py +15 -0
- package/modules/localmodels/stack_view_measure.py +4 -1
- package/modules/localmodels/stack_view_schema.py +54 -8
- package/modules/localmodels/stack_view_serve.py +40 -3
- package/modules/localmodels/stack_view_slots.py +89 -10
- package/modules/localmodels/stack_view_telemetry.py +163 -0
- package/modules/localmodels/stack_view_text.py +5 -2
- package/modules/localmodels/stack_view_tick.py +658 -0
- package/modules/localmodels/stack_view_words.py +4 -0
- package/modules/localmodels/{strata-poly-serve-0.2.20-poly.5.txt → strata-poly-serve-0.2.20-poly.6.txt} +1 -1
- package/modules/localmodels/suite.py +3 -1
- package/modules/localmodels/telemetry_math.py +538 -0
- package/modules/localmodels/web/view/view.js +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev60.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev60.dist-info}/RECORD +76 -70
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/localmodels/bifrost_datasheet.py +0 -53
- package/modules/localmodels/bifrost_provider.py +0 -88
- package/modules/localmodels/bifrost_unit.py +0 -99
- package/modules/localmodels/engines-strata-poly-0.2.20-poly.5.json +0 -94
- package/modules/localmodels/gateway_switch.py +0 -51
- package/modules/localmodels/library_floor.py +0 -78
- package/modules/localmodels/service_stop.py +0 -52
- /package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev60.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev60.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev60.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev59.dist-info → simplex_localmodels-0.1.0.dev60.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -14,17 +14,31 @@ from typing import Literal, TypedDict
|
|
|
14
14
|
|
|
15
15
|
STATUS_SCHEMA = "localmodels.library-status/v1"
|
|
16
16
|
EVENT_SCHEMA = "localmodels.library-event/v1"
|
|
17
|
+
CUSTOM_SEARCH_SCHEMA = "localmodels.library-custom-search/v1"
|
|
18
|
+
CUSTOM_PROBE_SCHEMA = "localmodels.library-custom-probe/v1"
|
|
17
19
|
|
|
18
20
|
ModelState = Literal["absent", "downloading", "idle", "loading", "loaded", "failed"]
|
|
19
|
-
Engine = Literal["llama.cpp", "polystrata", "strata"]
|
|
21
|
+
Engine = Literal["llama.cpp", "polystrata", "strata", "mlx"]
|
|
20
22
|
Fit = Literal["gpu", "unified", "system", "none"]
|
|
21
|
-
Phase = Literal["download", "verify", "load", "warm"]
|
|
23
|
+
Phase = Literal["download", "verify", "load", "warm", "smoke_test"]
|
|
22
24
|
MemoryPressure = Literal["normal", "warn", "critical"]
|
|
23
25
|
DownloadSource = Literal["huggingface", "modelscope", "custom", "cache"]
|
|
24
26
|
DOWNLOAD_SOURCES = ("huggingface", "modelscope", "custom", "cache")
|
|
25
27
|
LoadStep = Literal["prepare", "start", "load", "warm"]
|
|
26
28
|
LOAD_STEPS_PUBLIC = ("prepare", "start", "load", "warm")
|
|
27
29
|
|
|
30
|
+
ModelOrigin = Literal["curated", "custom"]
|
|
31
|
+
VerificationStatus = Literal["untested", "running", "verified", "failed"]
|
|
32
|
+
VerificationFailureKind = Literal["oom", "unsupported_arch", "corrupt", "unknown"]
|
|
33
|
+
CustomHub = Literal["huggingface", "modelscope"]
|
|
34
|
+
CustomSearchHub = Literal["all", "huggingface", "modelscope"]
|
|
35
|
+
CustomProbeHub = Literal["auto", "huggingface", "modelscope"]
|
|
36
|
+
CustomFormatFilter = Literal["compatible", "gguf", "mlx", "all"]
|
|
37
|
+
CustomRepoFormat = Literal["gguf", "mlx", "safetensors", "unknown"]
|
|
38
|
+
MemoryEstimateBasis = Literal["gguf_header", "rough_1.2x_plus_0.8gb"]
|
|
39
|
+
MemoryStatus = Literal["comfortable", "tight", "exceeds"]
|
|
40
|
+
CustomIncompatibleReason = Literal["raw_safetensors", "mlx_unsupported", "no_runnable_files"]
|
|
41
|
+
|
|
28
42
|
# Extend only together with the contract (contracts/linger-installer/library-v2.schema.json).
|
|
29
43
|
ERROR_CODES = (
|
|
30
44
|
"MODEL_UNKNOWN",
|
|
@@ -46,6 +60,14 @@ ERROR_CODES = (
|
|
|
46
60
|
"MODEL_FILES_MISSING",
|
|
47
61
|
"GATEWAY_REGISTRATION_FAILED",
|
|
48
62
|
"CANCELLED",
|
|
63
|
+
"INVALID_REPO_SPEC",
|
|
64
|
+
"HUB_UNREACHABLE",
|
|
65
|
+
"HUB_AUTH_REQUIRED",
|
|
66
|
+
"HUB_FORBIDDEN",
|
|
67
|
+
"HUB_REPO_NOT_FOUND",
|
|
68
|
+
"HUB_FORMAT_UNSUPPORTED",
|
|
69
|
+
"UNSUPPORTED_ARCHITECTURE",
|
|
70
|
+
"CORRUPT_WEIGHTS",
|
|
49
71
|
)
|
|
50
72
|
# Refusals: validation or a precondition, decided before anything changed.
|
|
51
73
|
REFUSALS = frozenset(
|
|
@@ -61,6 +83,11 @@ REFUSALS = frozenset(
|
|
|
61
83
|
"RUNTIME_DEPENDENCY_MISSING",
|
|
62
84
|
"LOAD_NO_ROOM",
|
|
63
85
|
"MODEL_FILES_MISSING",
|
|
86
|
+
"INVALID_REPO_SPEC",
|
|
87
|
+
"HUB_AUTH_REQUIRED",
|
|
88
|
+
"HUB_FORBIDDEN",
|
|
89
|
+
"HUB_REPO_NOT_FOUND",
|
|
90
|
+
"HUB_FORMAT_UNSUPPORTED",
|
|
64
91
|
)
|
|
65
92
|
)
|
|
66
93
|
EXIT_OK, EXIT_FAILED, EXIT_REFUSED, EXIT_CANCELLED = 0, 1, 2, 130
|
|
@@ -118,6 +145,7 @@ class Host(_Host, total=False):
|
|
|
118
145
|
gpu_in_use_bytes: int
|
|
119
146
|
wired_headroom_bytes: int
|
|
120
147
|
inactive_anon_bytes: int
|
|
148
|
+
supported_formats: list[str]
|
|
121
149
|
|
|
122
150
|
|
|
123
151
|
class Holder(TypedDict):
|
|
@@ -214,6 +242,8 @@ class _Download(TypedDict):
|
|
|
214
242
|
class Download(_Download, total=False):
|
|
215
243
|
source: DownloadSource
|
|
216
244
|
connections: int
|
|
245
|
+
shard_index: int
|
|
246
|
+
shard_count: int
|
|
217
247
|
|
|
218
248
|
|
|
219
249
|
class Load(TypedDict):
|
|
@@ -248,6 +278,45 @@ class Note(TypedDict):
|
|
|
248
278
|
code: str
|
|
249
279
|
|
|
250
280
|
|
|
281
|
+
class _CustomRowMetaRequired(TypedDict):
|
|
282
|
+
hub: CustomHub
|
|
283
|
+
repo_id: str
|
|
284
|
+
format: Literal["gguf", "mlx"]
|
|
285
|
+
variant_id: str
|
|
286
|
+
shard_count: int
|
|
287
|
+
standby_on_restart: bool
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class CustomRowMeta(_CustomRowMetaRequired, total=False):
|
|
291
|
+
revision: str
|
|
292
|
+
url: str
|
|
293
|
+
mmproj_file: str
|
|
294
|
+
mmproj_bytes: int
|
|
295
|
+
accepted_risk: bool
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
class _VerificationFailureRequired(TypedDict):
|
|
299
|
+
kind: VerificationFailureKind
|
|
300
|
+
code: str
|
|
301
|
+
context_tokens: int
|
|
302
|
+
can_retry_lower_ctx: bool
|
|
303
|
+
can_redownload: bool
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
class VerificationFailure(_VerificationFailureRequired, total=False):
|
|
307
|
+
diagnostic_log: str
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class _VerificationMetaRequired(TypedDict):
|
|
311
|
+
status: VerificationStatus
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
class VerificationMeta(_VerificationMetaRequired, total=False):
|
|
315
|
+
context_tokens: int
|
|
316
|
+
tested_at: str
|
|
317
|
+
failure: VerificationFailure
|
|
318
|
+
|
|
319
|
+
|
|
251
320
|
class _Row(TypedDict):
|
|
252
321
|
id: str
|
|
253
322
|
name: str
|
|
@@ -295,6 +364,9 @@ class Row(_Row, total=False):
|
|
|
295
364
|
memory_pressure_warning: MemoryPressureWarning # present when loaded above soft budget / forced
|
|
296
365
|
oom_retries: int # count of runtime OOM self-healing step-downs performed
|
|
297
366
|
forced: bool # True when loaded via --force override
|
|
367
|
+
origin: ModelOrigin # curated | custom (absent means curated)
|
|
368
|
+
custom: CustomRowMeta # present on custom hub models only
|
|
369
|
+
verification: VerificationMeta # present on custom hub models only
|
|
298
370
|
error: Problem # failed only
|
|
299
371
|
note: Note # idle only, when autoload was skipped
|
|
300
372
|
|
|
@@ -321,6 +393,180 @@ class Status(_Status, total=False):
|
|
|
321
393
|
debug: DebugInfo
|
|
322
394
|
|
|
323
395
|
|
|
396
|
+
class CustomDefaultQuant(TypedDict):
|
|
397
|
+
id: str
|
|
398
|
+
label: str
|
|
399
|
+
size_bytes: int
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class CustomSearchResult(TypedDict):
|
|
403
|
+
hub: CustomHub
|
|
404
|
+
repo_id: str
|
|
405
|
+
url: str
|
|
406
|
+
title: str
|
|
407
|
+
owner: str
|
|
408
|
+
format: CustomRepoFormat
|
|
409
|
+
family: str
|
|
410
|
+
architecture: str | None
|
|
411
|
+
parameter_billions: float | None
|
|
412
|
+
context_tokens: int | None
|
|
413
|
+
downloads: int
|
|
414
|
+
likes: int
|
|
415
|
+
updated_at: str | None
|
|
416
|
+
description: str | None
|
|
417
|
+
license: str | None
|
|
418
|
+
gated: bool
|
|
419
|
+
compatible: bool
|
|
420
|
+
incompatibility_code: CustomIncompatibleReason | None
|
|
421
|
+
quant_count: int | None
|
|
422
|
+
default_quant: CustomDefaultQuant | None
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
class CustomSearchWarning(TypedDict):
|
|
426
|
+
hub: CustomHub
|
|
427
|
+
code: str
|
|
428
|
+
detail: str
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
class CustomSearchDoc(TypedDict):
|
|
432
|
+
schema: str
|
|
433
|
+
ok: bool
|
|
434
|
+
query: str
|
|
435
|
+
hub: CustomSearchHub
|
|
436
|
+
format: CustomFormatFilter
|
|
437
|
+
platform: str
|
|
438
|
+
arch: str
|
|
439
|
+
supported_formats: list[str]
|
|
440
|
+
results: list[CustomSearchResult]
|
|
441
|
+
warnings: list[CustomSearchWarning]
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
class CustomProbeRepo(TypedDict):
|
|
445
|
+
hub: CustomHub
|
|
446
|
+
repo_id: str
|
|
447
|
+
revision: str
|
|
448
|
+
url: str
|
|
449
|
+
title: str
|
|
450
|
+
owner: str
|
|
451
|
+
format: CustomRepoFormat
|
|
452
|
+
family: str
|
|
453
|
+
license: str | None
|
|
454
|
+
gated: bool
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
class CustomGgufMeta(TypedDict):
|
|
458
|
+
architecture: str
|
|
459
|
+
n_ctx_train: int
|
|
460
|
+
n_layer: int
|
|
461
|
+
moe: bool
|
|
462
|
+
has_chat_template: bool
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
class CustomProbeHost(TypedDict):
|
|
466
|
+
platform: str
|
|
467
|
+
arch: str
|
|
468
|
+
supported_formats: list[str]
|
|
469
|
+
disk_free_bytes: int
|
|
470
|
+
target_pool: str
|
|
471
|
+
pool_total_bytes: int
|
|
472
|
+
pool_soft_budget_bytes: int
|
|
473
|
+
pool_hard_ceiling_bytes: int
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
class CustomMmprojCandidate(TypedDict):
|
|
477
|
+
path: str
|
|
478
|
+
size_bytes: int
|
|
479
|
+
sha256: str | None
|
|
480
|
+
recommended: bool
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class CustomVariantFile(TypedDict):
|
|
484
|
+
path: str
|
|
485
|
+
size_bytes: int
|
|
486
|
+
sha256: str | None
|
|
487
|
+
revision: str
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
class CustomQuantVariant(TypedDict):
|
|
491
|
+
id: str
|
|
492
|
+
custom_model_id: str
|
|
493
|
+
label: str
|
|
494
|
+
quant: str
|
|
495
|
+
bits_per_weight: float | None
|
|
496
|
+
sharded: bool
|
|
497
|
+
shard_count: int
|
|
498
|
+
files: list[CustomVariantFile]
|
|
499
|
+
weights_bytes: int
|
|
500
|
+
mmproj_file: str | None
|
|
501
|
+
mmproj_bytes: int
|
|
502
|
+
total_download_bytes: int
|
|
503
|
+
disk_required_bytes: int
|
|
504
|
+
disk_ok: bool
|
|
505
|
+
estimated_memory_bytes: int
|
|
506
|
+
memory_estimate_basis: MemoryEstimateBasis
|
|
507
|
+
memory_status: MemoryStatus
|
|
508
|
+
already_installed: bool
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
class CustomProbeReadyDoc(TypedDict):
|
|
512
|
+
schema: str
|
|
513
|
+
ok: bool
|
|
514
|
+
outcome: Literal["ready"]
|
|
515
|
+
repo: CustomProbeRepo
|
|
516
|
+
metadata_complete: bool
|
|
517
|
+
metadata_note: str | None
|
|
518
|
+
gguf_meta: CustomGgufMeta | None
|
|
519
|
+
host: CustomProbeHost
|
|
520
|
+
mmproj_candidates: list[CustomMmprojCandidate]
|
|
521
|
+
recommended_variant_id: str
|
|
522
|
+
selected_quant_id: str
|
|
523
|
+
quant_variants: list[CustomQuantVariant]
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
class CustomProbeGatedRepo(TypedDict):
|
|
527
|
+
hub: CustomHub
|
|
528
|
+
repo_id: str
|
|
529
|
+
url: str
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
class CustomProbeGatedDoc(TypedDict):
|
|
533
|
+
schema: str
|
|
534
|
+
ok: bool
|
|
535
|
+
outcome: Literal["gated"]
|
|
536
|
+
hub_http_status: Literal[401, 403]
|
|
537
|
+
token_provided: bool
|
|
538
|
+
repo: CustomProbeGatedRepo
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
class CustomProbeIncompatibleRepo(TypedDict):
|
|
542
|
+
hub: CustomHub
|
|
543
|
+
repo_id: str
|
|
544
|
+
url: str
|
|
545
|
+
format: CustomRepoFormat
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
class CustomProbeIncompatibleDoc(TypedDict):
|
|
549
|
+
schema: str
|
|
550
|
+
ok: bool
|
|
551
|
+
outcome: Literal["incompatible"]
|
|
552
|
+
reason: CustomIncompatibleReason
|
|
553
|
+
suggested_search_query: str
|
|
554
|
+
repo: CustomProbeIncompatibleRepo
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
class CustomProbeNotFoundDoc(TypedDict):
|
|
558
|
+
schema: str
|
|
559
|
+
ok: bool
|
|
560
|
+
outcome: Literal["not_found"]
|
|
561
|
+
hub: CustomHub
|
|
562
|
+
repo_id: str
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
CustomProbeDoc = (
|
|
566
|
+
CustomProbeReadyDoc | CustomProbeGatedDoc | CustomProbeIncompatibleDoc | CustomProbeNotFoundDoc
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
|
|
324
570
|
def library_id(catalog_id: str, quant: str) -> str:
|
|
325
571
|
"""The stable library id: the catalog id and its variant."""
|
|
326
572
|
return f"{catalog_id}:{quant}"
|
|
@@ -353,6 +599,8 @@ def progress(
|
|
|
353
599
|
source: str | None = None,
|
|
354
600
|
connections: int | None = None,
|
|
355
601
|
load_step: str | None = None,
|
|
602
|
+
shard_index: int | None = None,
|
|
603
|
+
shard_count: int | None = None,
|
|
356
604
|
) -> None:
|
|
357
605
|
"""One JSONL progress line; counters are clamped to 0 <= done <= total."""
|
|
358
606
|
total = max(0, int(total))
|
|
@@ -371,6 +619,10 @@ def progress(
|
|
|
371
619
|
doc["connections"] = connections
|
|
372
620
|
if load_step in LOAD_STEPS_PUBLIC:
|
|
373
621
|
doc["load_step"] = load_step
|
|
622
|
+
if isinstance(shard_index, int) and not isinstance(shard_index, bool) and shard_index >= 1:
|
|
623
|
+
doc["shard_index"] = shard_index
|
|
624
|
+
if isinstance(shard_count, int) and not isinstance(shard_count, bool) and shard_count >= 1:
|
|
625
|
+
doc["shard_count"] = shard_count
|
|
374
626
|
_line(doc)
|
|
375
627
|
|
|
376
628
|
|
|
@@ -43,6 +43,8 @@ from localmodels.context_policy import AgentPosture
|
|
|
43
43
|
from localmodels.estimator import (
|
|
44
44
|
AGENT_VRAM_RESERVE_BYTES,
|
|
45
45
|
METAL_VRAM_RESERVE_BYTES,
|
|
46
|
+
agent_footprint_bytes,
|
|
47
|
+
eager,
|
|
46
48
|
)
|
|
47
49
|
from localmodels.library_model import LibraryError, Reason, display_name, split_id
|
|
48
50
|
from localmodels.probe import HostFacts
|
|
@@ -86,6 +88,10 @@ def is_chat(entry: cat.CatalogEntry) -> bool:
|
|
|
86
88
|
return entry.runtime == "llama.cpp" and "llm" in entry.tasks
|
|
87
89
|
|
|
88
90
|
|
|
91
|
+
def is_custom_entry(entry: cat.CatalogEntry) -> bool:
|
|
92
|
+
return entry.id.startswith("custom.")
|
|
93
|
+
|
|
94
|
+
|
|
89
95
|
def shown(facts: HostFacts, catalog: Iterable[cat.CatalogEntry]) -> list[Model]:
|
|
90
96
|
"""Validated chat models, library candidates, Mac ladder, Windows fallback, and
|
|
91
97
|
supported PolyStrata LLM recipes."""
|
|
@@ -93,6 +99,7 @@ def shown(facts: HostFacts, catalog: Iterable[cat.CatalogEntry]) -> list[Model]:
|
|
|
93
99
|
Model(e, v)
|
|
94
100
|
for e in catalog
|
|
95
101
|
if is_chat(e)
|
|
102
|
+
and not is_custom_entry(e)
|
|
96
103
|
and (
|
|
97
104
|
cat.validated_here(e, facts["platform"])
|
|
98
105
|
or llm_rank.mac_rung(e, facts)
|
|
@@ -388,6 +395,9 @@ def price(
|
|
|
388
395
|
)
|
|
389
396
|
else:
|
|
390
397
|
facts, _ = metal.pressured(facts)
|
|
398
|
+
effective_catalog = (
|
|
399
|
+
catalog if any(e.id == model.entry.id for e in catalog) else (*catalog, model.entry)
|
|
400
|
+
)
|
|
391
401
|
plan = deploy.build_plan(
|
|
392
402
|
hosts.LOCAL_ID,
|
|
393
403
|
facts,
|
|
@@ -401,10 +411,10 @@ def price(
|
|
|
401
411
|
agent=posture(),
|
|
402
412
|
quant=model.variant.quant,
|
|
403
413
|
),
|
|
404
|
-
entries=
|
|
414
|
+
entries=effective_catalog,
|
|
405
415
|
resolver=deploy.catalog_pins,
|
|
406
416
|
)
|
|
407
|
-
library_elastic.validate_plan_bounds(facts, model, pool, plan,
|
|
417
|
+
library_elastic.validate_plan_bounds(facts, model, pool, plan, effective_catalog)
|
|
408
418
|
return plan
|
|
409
419
|
|
|
410
420
|
|
|
@@ -729,6 +739,75 @@ def recommend(
|
|
|
729
739
|
"""The one model to suggest: the smartest live library pick, when it is among the absent,
|
|
730
740
|
downloadable ``candidates`` that fit live memory now. None when it is already on disk
|
|
731
741
|
or nothing fits now."""
|
|
732
|
-
|
|
742
|
+
curated = [m for m in candidates if not is_custom_entry(m.entry)]
|
|
743
|
+
if not curated or (pick := smartest(facts, base_dir)) is None:
|
|
733
744
|
return None
|
|
734
|
-
return next((m.id for m in
|
|
745
|
+
return next((m.id for m in curated if (m.entry.id, m.variant.quant) == pick), None)
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
def floor_metadata(
|
|
749
|
+
facts: HostFacts,
|
|
750
|
+
model: Model,
|
|
751
|
+
shortfall_bytes: int = 0,
|
|
752
|
+
*,
|
|
753
|
+
memory_kind: str = "",
|
|
754
|
+
) -> tuple[int, int, bool, int]:
|
|
755
|
+
"""Estimated floor memory, context window, vision flag and download bytes when a model does
|
|
756
|
+
not fit this computer's pools (``plan is None``), using the same agent posture.
|
|
757
|
+
|
|
758
|
+
Honors per-entry posture overrides (such as ``ubatch``), accounts for Metal and CUDA UMA
|
|
759
|
+
unified memory, and avoids mixing host RAM shortfalls (``memory_kind == "ram"``) into VRAM
|
|
760
|
+
floor bytes.
|
|
761
|
+
"""
|
|
762
|
+
if library_kept.retired(model.entry): # no recipe left to price; only what was on disk
|
|
763
|
+
return shortfall_bytes, 0, False, sum(f.size_bytes for f in model.variant.files)
|
|
764
|
+
if model.entry.runtime == "strata-poly":
|
|
765
|
+
recipe = suite.recipe(model.entry.id)
|
|
766
|
+
window = int(recipe.get("context") or model.entry.n_ctx_train)
|
|
767
|
+
active = model.entry.agent_posture(context_policy.posture_for(posture(), "cuda"))
|
|
768
|
+
vision_on = bool(recipe.get("vision")) and active.vision != "off"
|
|
769
|
+
download = sum(
|
|
770
|
+
int(f["size_bytes"]) for f in recipe["files"] if vision_on or not f.get("vision")
|
|
771
|
+
)
|
|
772
|
+
floor_bytes = int(recipe.get("min_vram_free_bytes") or recipe.get("vram_bytes") or 0)
|
|
773
|
+
effective_shortfall = 0 if memory_kind == "ram" else shortfall_bytes
|
|
774
|
+
return max(effective_shortfall, floor_bytes), window, vision_on, download
|
|
775
|
+
metal_unified = metal.supported(facts)
|
|
776
|
+
cuda_uma = _cuda_uma(facts) is not None
|
|
777
|
+
active = model.entry.agent_posture(
|
|
778
|
+
context_policy.posture_for(posture(), "metal" if metal_unified else "cuda")
|
|
779
|
+
)
|
|
780
|
+
profile = eager(model.entry.profile(model.variant))
|
|
781
|
+
window = profile.n_ctx_train if 0 < profile.n_ctx_train < active.floor else active.floor
|
|
782
|
+
vision_on = vision.llama_reader_enabled(model.entry.mmproj, active.vision)
|
|
783
|
+
mtp = bool(model.entry.mtp_capable and model.entry.agent_mtp and active.mtp_draft_depth > 0)
|
|
784
|
+
core = agent_footprint_bytes(
|
|
785
|
+
profile,
|
|
786
|
+
window,
|
|
787
|
+
slots=active.slots,
|
|
788
|
+
kv_types=active.kv_types[-1],
|
|
789
|
+
ubatch=active.ubatch,
|
|
790
|
+
mtp=mtp,
|
|
791
|
+
)
|
|
792
|
+
if metal_unified or cuda_uma:
|
|
793
|
+
vision_extra = (
|
|
794
|
+
vision.llama_device_bytes(model.entry.mmproj, "gpu")
|
|
795
|
+
if vision_on and model.entry.mmproj is not None
|
|
796
|
+
else 0
|
|
797
|
+
)
|
|
798
|
+
host_side = (
|
|
799
|
+
context_policy.cache_floor_bytes(active, profile)
|
|
800
|
+
+ context_policy.metal_host_bytes(profile, active)
|
|
801
|
+
if metal_unified
|
|
802
|
+
else 0
|
|
803
|
+
)
|
|
804
|
+
floor_bytes = core + vision_extra + host_side
|
|
805
|
+
else:
|
|
806
|
+
floor_bytes = core
|
|
807
|
+
download = sum(f.size_bytes for f in model.variant.files)
|
|
808
|
+
if vision_on and model.entry.mmproj is not None:
|
|
809
|
+
download += model.entry.mmproj.size_bytes
|
|
810
|
+
if model.entry.mtp_head is not None:
|
|
811
|
+
download += model.entry.mtp_head.size_bytes
|
|
812
|
+
effective_shortfall = 0 if memory_kind == "ram" else shortfall_bytes
|
|
813
|
+
return max(effective_shortfall, floor_bytes), window, vision_on, download
|