@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
|
@@ -86,6 +86,46 @@ class LoadPosture(_LoadPostureRequired, total=False):
|
|
|
86
86
|
forced: bool
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
class _CustomMetaRequired(TypedDict):
|
|
90
|
+
hub: str # huggingface | modelscope
|
|
91
|
+
repo_id: str
|
|
92
|
+
format: str # gguf | mlx
|
|
93
|
+
variant_id: str
|
|
94
|
+
shard_count: int
|
|
95
|
+
standby_on_restart: bool
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class CustomMeta(_CustomMetaRequired, total=False):
|
|
99
|
+
revision: str
|
|
100
|
+
url: str
|
|
101
|
+
mmproj_file: str
|
|
102
|
+
mmproj_bytes: int
|
|
103
|
+
accepted_risk: bool
|
|
104
|
+
has_chat_template: bool
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class _VerificationFailureRequired(TypedDict):
|
|
108
|
+
kind: str # oom | unsupported_arch | corrupt | unknown
|
|
109
|
+
code: str
|
|
110
|
+
context_tokens: int
|
|
111
|
+
can_retry_lower_ctx: bool
|
|
112
|
+
can_redownload: bool
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class VerificationFailureRecord(_VerificationFailureRequired, total=False):
|
|
116
|
+
diagnostic_log: str
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class _VerificationRequired(TypedDict):
|
|
120
|
+
status: str # untested | running | verified | failed
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class VerificationRecord(_VerificationRequired, total=False):
|
|
124
|
+
context_tokens: int
|
|
125
|
+
tested_at: str
|
|
126
|
+
failure: VerificationFailureRecord
|
|
127
|
+
|
|
128
|
+
|
|
89
129
|
class Record(_RecordRequired, total=False):
|
|
90
130
|
base_dir: str # where it was downloaded: its weights, engine and deployments live there
|
|
91
131
|
memory_bytes: int # the footprint priced at download (on the pool's whole capacity)
|
|
@@ -99,6 +139,9 @@ class Record(_RecordRequired, total=False):
|
|
|
99
139
|
pi_model: str # what pi offers once it is loaded; fixed when the record is made
|
|
100
140
|
load_posture: LoadPosture # elastic posture & warning metadata recorded on load
|
|
101
141
|
baseline_plan: Plan # pristine capacity plan preserved while a degraded/active load runs
|
|
142
|
+
custom: CustomMeta # custom hub model metadata (absent for curated models)
|
|
143
|
+
verification: VerificationRecord # smoke-test verification state (custom models)
|
|
144
|
+
catalog_entry: dict[str, object] # schema-3 entry snapshot for custom models
|
|
102
145
|
|
|
103
146
|
|
|
104
147
|
class _JobSince20261113(TypedDict, total=False):
|
|
@@ -107,8 +150,13 @@ class _JobSince20261113(TypedDict, total=False):
|
|
|
107
150
|
port: int # a load's port, reserved from admission until its record names it
|
|
108
151
|
source: str # download source label: huggingface | modelscope | custom | cache
|
|
109
152
|
connections: int # active parallel download connections
|
|
153
|
+
shard_index: int # 1-based active shard index for multi-shard downloads
|
|
154
|
+
shard_count: int # total shard count for multi-shard downloads
|
|
110
155
|
load_step: str # load sub-step: prepare | start | load | warm
|
|
111
156
|
error: Problem # a download that stopped cleanly: status shows why; cancel discards it
|
|
157
|
+
custom: CustomMeta # custom hub metadata while download is in progress
|
|
158
|
+
catalog_entry: dict[str, object] # provisional catalog entry while custom download runs
|
|
159
|
+
base_dir: str # base directory for an in-progress custom download
|
|
112
160
|
|
|
113
161
|
|
|
114
162
|
class Job(_JobSince20261113):
|
|
@@ -300,6 +348,8 @@ class JobHandle:
|
|
|
300
348
|
source: str | None = None,
|
|
301
349
|
connections: int | None = None,
|
|
302
350
|
load_step: str | None = None,
|
|
351
|
+
shard_index: int | None = None,
|
|
352
|
+
shard_count: int | None = None,
|
|
303
353
|
) -> None:
|
|
304
354
|
import time
|
|
305
355
|
|
|
@@ -308,6 +358,8 @@ class JobHandle:
|
|
|
308
358
|
self.job.get("load_step"),
|
|
309
359
|
self.job.get("source"),
|
|
310
360
|
self.job.get("total"),
|
|
361
|
+
self.job.get("shard_index"),
|
|
362
|
+
self.job.get("shard_count"),
|
|
311
363
|
)
|
|
312
364
|
self.job["phase"], self.job["done"], self.job["total"] = phase, done, total
|
|
313
365
|
self.job["bytes_per_second"] = bytes_per_second
|
|
@@ -320,9 +372,19 @@ class JobHandle:
|
|
|
320
372
|
self.job["connections"] = connections
|
|
321
373
|
else:
|
|
322
374
|
self.job.pop("connections", None)
|
|
375
|
+
if shard_index is not None and shard_index >= 1:
|
|
376
|
+
self.job["shard_index"] = shard_index
|
|
377
|
+
else:
|
|
378
|
+
self.job.pop("shard_index", None)
|
|
379
|
+
if shard_count is not None and shard_count >= 1:
|
|
380
|
+
self.job["shard_count"] = shard_count
|
|
381
|
+
else:
|
|
382
|
+
self.job.pop("shard_count", None)
|
|
323
383
|
else:
|
|
324
384
|
self.job.pop("source", None)
|
|
325
385
|
self.job.pop("connections", None)
|
|
386
|
+
self.job.pop("shard_index", None)
|
|
387
|
+
self.job.pop("shard_count", None)
|
|
326
388
|
if phase in ("load", "warm") and load_step is not None:
|
|
327
389
|
self.job["load_step"] = load_step
|
|
328
390
|
else:
|
|
@@ -332,6 +394,8 @@ class JobHandle:
|
|
|
332
394
|
self.job.get("load_step"),
|
|
333
395
|
self.job.get("source"),
|
|
334
396
|
self.job.get("total"),
|
|
397
|
+
self.job.get("shard_index"),
|
|
398
|
+
self.job.get("shard_count"),
|
|
335
399
|
) != prev
|
|
336
400
|
now = time.monotonic()
|
|
337
401
|
if changed or now - self._written >= JOB_WRITE_EVERY_S or done >= total:
|
|
@@ -368,12 +432,18 @@ def acquire(
|
|
|
368
432
|
needs: list[str] | None = None,
|
|
369
433
|
*,
|
|
370
434
|
port: int = 0,
|
|
435
|
+
custom: CustomMeta | None = None,
|
|
436
|
+
catalog_entry: dict[str, object] | None = None,
|
|
437
|
+
base_dir: str | None = None,
|
|
371
438
|
) -> Job:
|
|
372
439
|
"""Under ``locked()``, after the caller validated the model: claim it for this process.
|
|
373
440
|
The claim is the job and its process-identity receipt; every other library command sees it
|
|
374
441
|
(``refuse_busy``) until ``release``. A load's claim reserves its memory in its pool."""
|
|
375
442
|
become_leader()
|
|
376
443
|
now = utc_now()
|
|
444
|
+
initial_phase = (
|
|
445
|
+
"download" if kind == "download" else "smoke_test" if kind == "smoke_test" else "load"
|
|
446
|
+
)
|
|
377
447
|
job: Job = {
|
|
378
448
|
"schema": JOB_SCHEMA,
|
|
379
449
|
"id": uuid.uuid4().hex,
|
|
@@ -383,7 +453,7 @@ def acquire(
|
|
|
383
453
|
"memory_bytes": memory_bytes,
|
|
384
454
|
"files": files,
|
|
385
455
|
"needs": list(needs if needs is not None else files),
|
|
386
|
-
"phase":
|
|
456
|
+
"phase": initial_phase,
|
|
387
457
|
"done": 0,
|
|
388
458
|
"total": 0,
|
|
389
459
|
"bytes_per_second": 0,
|
|
@@ -392,6 +462,12 @@ def acquire(
|
|
|
392
462
|
}
|
|
393
463
|
if port:
|
|
394
464
|
job["port"] = port
|
|
465
|
+
if custom is not None:
|
|
466
|
+
job["custom"] = custom
|
|
467
|
+
if catalog_entry is not None:
|
|
468
|
+
job["catalog_entry"] = catalog_entry
|
|
469
|
+
if base_dir is not None:
|
|
470
|
+
job["base_dir"] = base_dir
|
|
395
471
|
hosts.save_private(job_path(model), job)
|
|
396
472
|
try:
|
|
397
473
|
process_identity.save(pid_path(model), os.getpid())
|
|
@@ -17,7 +17,6 @@ from localmodels import (
|
|
|
17
17
|
debug_mode,
|
|
18
18
|
hosts,
|
|
19
19
|
library_elastic,
|
|
20
|
-
library_floor,
|
|
21
20
|
library_gateway,
|
|
22
21
|
library_order,
|
|
23
22
|
library_pricing,
|
|
@@ -35,6 +34,8 @@ from localmodels.library_model import (
|
|
|
35
34
|
LOAD_STEPS_PUBLIC,
|
|
36
35
|
STATUS_SCHEMA,
|
|
37
36
|
Availability,
|
|
37
|
+
CustomHub,
|
|
38
|
+
CustomRowMeta,
|
|
38
39
|
DebugInfo,
|
|
39
40
|
DegradationReason,
|
|
40
41
|
Download,
|
|
@@ -54,6 +55,10 @@ from localmodels.library_model import (
|
|
|
54
55
|
Problem,
|
|
55
56
|
Row,
|
|
56
57
|
Status,
|
|
58
|
+
VerificationFailure,
|
|
59
|
+
VerificationFailureKind,
|
|
60
|
+
VerificationMeta,
|
|
61
|
+
VerificationStatus,
|
|
57
62
|
sanitize_problem,
|
|
58
63
|
)
|
|
59
64
|
from localmodels.library_pricing import Model, Priced
|
|
@@ -141,6 +146,14 @@ class Library:
|
|
|
141
146
|
if model_id not in known:
|
|
142
147
|
try:
|
|
143
148
|
rows.append(library_pricing.find(model_id, self.catalog))
|
|
149
|
+
known.add(model_id)
|
|
150
|
+
except (ValueError, LibraryError):
|
|
151
|
+
continue
|
|
152
|
+
for model_id, (job, _alive) in self.jobs.items():
|
|
153
|
+
if model_id not in known and job.get("custom") is not None:
|
|
154
|
+
try:
|
|
155
|
+
rows.append(library_pricing.find(model_id, self.catalog))
|
|
156
|
+
known.add(model_id)
|
|
144
157
|
except (ValueError, LibraryError):
|
|
145
158
|
continue
|
|
146
159
|
return rows
|
|
@@ -161,8 +174,10 @@ class Library:
|
|
|
161
174
|
def _state(lib: Library, model: str, record: Record | None) -> tuple[str, Problem | None]:
|
|
162
175
|
job, alive = lib.jobs.get(model, (None, False))
|
|
163
176
|
if job is not None and alive:
|
|
177
|
+
if job["kind"] == "smoke_test":
|
|
178
|
+
return ("idle" if record is not None else "absent"), None
|
|
164
179
|
return ("downloading" if job["kind"] == "download" else "loading"), None
|
|
165
|
-
if job is not None: #
|
|
180
|
+
if job is not None and job["kind"] != "smoke_test": # process ended or failed with partials
|
|
166
181
|
if isinstance(err := job.get("error"), dict) and isinstance(err.get("code"), str):
|
|
167
182
|
return "failed", sanitize_problem(err)
|
|
168
183
|
code = "DOWNLOAD_FAILED" if job["kind"] == "download" else "ENGINE_START_FAILED"
|
|
@@ -298,6 +313,12 @@ def _downloading(job: Job) -> Download:
|
|
|
298
313
|
conns = job.get("connections")
|
|
299
314
|
if isinstance(conns, int) and not isinstance(conns, bool) and conns >= 0:
|
|
300
315
|
dl["connections"] = conns
|
|
316
|
+
s_idx = job.get("shard_index")
|
|
317
|
+
if isinstance(s_idx, int) and not isinstance(s_idx, bool) and s_idx >= 1:
|
|
318
|
+
dl["shard_index"] = s_idx
|
|
319
|
+
s_cnt = job.get("shard_count")
|
|
320
|
+
if isinstance(s_cnt, int) and not isinstance(s_cnt, bool) and s_cnt >= 1:
|
|
321
|
+
dl["shard_count"] = s_cnt
|
|
301
322
|
return dl
|
|
302
323
|
|
|
303
324
|
|
|
@@ -339,7 +360,11 @@ def _apply_engine_meta(lib: Library, found: Row, model: Model, plan: Plan | None
|
|
|
339
360
|
found["concurrency"] = (
|
|
340
361
|
parsed_slots
|
|
341
362
|
if parsed_slots >= 1
|
|
342
|
-
else (
|
|
363
|
+
else (
|
|
364
|
+
2
|
|
365
|
+
if engine == "polystrata"
|
|
366
|
+
else (1 if engine == "strata" else library_pricing.posture().slots)
|
|
367
|
+
)
|
|
343
368
|
)
|
|
344
369
|
if plan is not None and engine in ("polystrata", "strata"):
|
|
345
370
|
host_ram = library_pricing.host_ram_bytes(plan, lib.catalog)
|
|
@@ -438,6 +463,100 @@ def _apply_record_meta(
|
|
|
438
463
|
found["error"] = sanitize_problem(problem)
|
|
439
464
|
|
|
440
465
|
|
|
466
|
+
def _custom_row_meta(raw: Mapping[str, object]) -> CustomRowMeta:
|
|
467
|
+
hub_val = str(raw.get("hub") or "huggingface")
|
|
468
|
+
hub: CustomHub = "modelscope" if hub_val == "modelscope" else "huggingface"
|
|
469
|
+
fmt_val = str(raw.get("format") or "gguf")
|
|
470
|
+
meta: CustomRowMeta = {
|
|
471
|
+
"hub": hub,
|
|
472
|
+
"repo_id": str(raw.get("repo_id") or ""),
|
|
473
|
+
"format": "mlx" if fmt_val == "mlx" else "gguf",
|
|
474
|
+
"variant_id": str(raw.get("variant_id") or ""),
|
|
475
|
+
"shard_count": max(1, int(str(raw.get("shard_count") or 1))),
|
|
476
|
+
"standby_on_restart": bool(raw.get("standby_on_restart", True)),
|
|
477
|
+
}
|
|
478
|
+
if isinstance(rev := raw.get("revision"), str) and rev:
|
|
479
|
+
meta["revision"] = rev
|
|
480
|
+
if isinstance(url := raw.get("url"), str) and url:
|
|
481
|
+
meta["url"] = url
|
|
482
|
+
if isinstance(mmproj := raw.get("mmproj_file"), str) and mmproj:
|
|
483
|
+
meta["mmproj_file"] = mmproj
|
|
484
|
+
mmproj_b = raw.get("mmproj_bytes")
|
|
485
|
+
if isinstance(mmproj_b, int) and not isinstance(mmproj_b, bool) and mmproj_b >= 0:
|
|
486
|
+
meta["mmproj_bytes"] = mmproj_b
|
|
487
|
+
if isinstance(risk := raw.get("accepted_risk"), bool):
|
|
488
|
+
meta["accepted_risk"] = risk
|
|
489
|
+
return meta
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
def _verification_meta(
|
|
493
|
+
raw: Mapping[str, object] | None, *, smoke_running: bool
|
|
494
|
+
) -> VerificationMeta:
|
|
495
|
+
if smoke_running:
|
|
496
|
+
out: VerificationMeta = {"status": "running"}
|
|
497
|
+
if raw is not None:
|
|
498
|
+
ctx = raw.get("context_tokens")
|
|
499
|
+
if isinstance(ctx, int) and not isinstance(ctx, bool) and ctx > 0:
|
|
500
|
+
out["context_tokens"] = ctx
|
|
501
|
+
return out
|
|
502
|
+
if raw is None:
|
|
503
|
+
return {"status": "untested"}
|
|
504
|
+
raw_status = str(raw.get("status") or "untested")
|
|
505
|
+
status: VerificationStatus = (
|
|
506
|
+
cast(VerificationStatus, raw_status)
|
|
507
|
+
if raw_status in ("untested", "running", "verified", "failed")
|
|
508
|
+
else "untested"
|
|
509
|
+
)
|
|
510
|
+
out = {"status": status}
|
|
511
|
+
ctx = raw.get("context_tokens")
|
|
512
|
+
if isinstance(ctx, int) and not isinstance(ctx, bool) and ctx > 0:
|
|
513
|
+
out["context_tokens"] = ctx
|
|
514
|
+
if isinstance(tested_at := raw.get("tested_at"), str) and tested_at:
|
|
515
|
+
out["tested_at"] = tested_at
|
|
516
|
+
raw_fail = raw.get("failure")
|
|
517
|
+
if isinstance(raw_fail, Mapping):
|
|
518
|
+
raw_kind = str(raw_fail.get("kind") or "unknown")
|
|
519
|
+
kind: VerificationFailureKind = (
|
|
520
|
+
cast(VerificationFailureKind, raw_kind)
|
|
521
|
+
if raw_kind in ("oom", "unsupported_arch", "corrupt", "unknown")
|
|
522
|
+
else "unknown"
|
|
523
|
+
)
|
|
524
|
+
fail_ctx = raw_fail.get("context_tokens")
|
|
525
|
+
failure: VerificationFailure = {
|
|
526
|
+
"kind": kind,
|
|
527
|
+
"code": str(raw_fail.get("code") or "ENGINE_START_FAILED"),
|
|
528
|
+
"context_tokens": int(fail_ctx) if isinstance(fail_ctx, int) and fail_ctx >= 0 else 0,
|
|
529
|
+
"can_retry_lower_ctx": bool(raw_fail.get("can_retry_lower_ctx", False)),
|
|
530
|
+
"can_redownload": bool(raw_fail.get("can_redownload", False)),
|
|
531
|
+
}
|
|
532
|
+
if isinstance(diag := raw_fail.get("diagnostic_log"), str) and diag:
|
|
533
|
+
failure["diagnostic_log"] = diag[:4000]
|
|
534
|
+
out["failure"] = failure
|
|
535
|
+
return out
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
def _apply_custom_meta(
|
|
539
|
+
found: Row,
|
|
540
|
+
record: Record | None,
|
|
541
|
+
job: Job | None,
|
|
542
|
+
alive: bool,
|
|
543
|
+
) -> None:
|
|
544
|
+
raw_custom = (record.get("custom") if record is not None else None) or (
|
|
545
|
+
job.get("custom") if job is not None else None
|
|
546
|
+
)
|
|
547
|
+
if raw_custom is None:
|
|
548
|
+
return
|
|
549
|
+
meta = _custom_row_meta(raw_custom)
|
|
550
|
+
found["origin"] = "custom"
|
|
551
|
+
found["recommended"] = False
|
|
552
|
+
found["custom"] = meta
|
|
553
|
+
if (url := meta.get("url")) and url.startswith("https://"):
|
|
554
|
+
found["source_url"] = url
|
|
555
|
+
smoke_running = job is not None and alive and job["kind"] == "smoke_test"
|
|
556
|
+
raw_ver = record.get("verification") if record is not None else None
|
|
557
|
+
found["verification"] = _verification_meta(raw_ver, smoke_running=smoke_running)
|
|
558
|
+
|
|
559
|
+
|
|
441
560
|
def row(lib: Library, model: Model) -> Row:
|
|
442
561
|
record = lib.records.get(model.id)
|
|
443
562
|
priced = lib.judge(model)
|
|
@@ -445,7 +564,7 @@ def row(lib: Library, model: Model) -> Row:
|
|
|
445
564
|
plan = _plan_of(lib, model, record, priced, state=state)
|
|
446
565
|
job, alive = lib.jobs.get(model.id, (None, False))
|
|
447
566
|
fallback_memory, fallback_window, fallback_vision, fallback_download = (
|
|
448
|
-
|
|
567
|
+
library_pricing.floor_metadata(
|
|
449
568
|
lib.facts, model, priced.need_bytes, memory_kind=priced.memory_kind
|
|
450
569
|
)
|
|
451
570
|
if plan is None
|
|
@@ -500,6 +619,7 @@ def row(lib: Library, model: Model) -> Row:
|
|
|
500
619
|
found.update(card(model, found["vision"]))
|
|
501
620
|
_apply_engine_meta(lib, found, model, plan)
|
|
502
621
|
_apply_record_meta(found, model, record, state, problem)
|
|
622
|
+
_apply_custom_meta(found, record, job, alive)
|
|
503
623
|
return found
|
|
504
624
|
|
|
505
625
|
|
|
@@ -641,6 +761,7 @@ def host(lib: Library) -> Host:
|
|
|
641
761
|
"ram_total_bytes": facts["ram"]["total_bytes"],
|
|
642
762
|
"ram_available_bytes": facts["ram"]["available_bytes"],
|
|
643
763
|
"disk_free_bytes": library_pricing.base_free(lib.base_dir),
|
|
764
|
+
"supported_formats": ["gguf"],
|
|
644
765
|
"gpus": [
|
|
645
766
|
{
|
|
646
767
|
"index": g["index"],
|
|
@@ -678,6 +799,7 @@ def build(lib: Library) -> Status:
|
|
|
678
799
|
if r["state"] == "absent"
|
|
679
800
|
and r["availability"]["downloadable"]
|
|
680
801
|
and r.get("fits_now") is True
|
|
802
|
+
and r.get("origin") != "custom"
|
|
681
803
|
]
|
|
682
804
|
chosen = library_pricing.recommend(now, candidates, lib.base_dir)
|
|
683
805
|
for r in rows:
|