@simplexai/localmodels-win32-x64 0.1.0-dev.56 → 0.1.0-dev.58
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 +54 -52
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/bifrost_admin.py +2 -1
- package/modules/localmodels/bifrost_checks.py +11 -8
- package/modules/localmodels/bifrost_models.py +2 -1
- package/modules/localmodels/budget.py +161 -1
- package/modules/localmodels/catalog.json +10 -8
- package/modules/localmodels/catalog.py +5 -2
- package/modules/localmodels/gateway_accept.py +4 -3
- package/modules/localmodels/gateway_bifrost.py +2 -1
- package/modules/localmodels/gateway_cli.py +4 -3
- package/modules/localmodels/gateway_server.py +3 -1
- package/modules/localmodels/gpu_specs.py +38 -13
- package/modules/localmodels/harness.py +2 -2
- package/modules/localmodels/hf_repo.py +27 -4
- package/modules/localmodels/library_cli.py +8 -1
- package/modules/localmodels/library_elastic.py +720 -0
- package/modules/localmodels/library_model.py +101 -4
- package/modules/localmodels/library_pricing.py +31 -39
- package/modules/localmodels/library_serve.py +238 -42
- package/modules/localmodels/library_state.py +31 -0
- package/modules/localmodels/library_status.py +95 -2
- package/modules/localmodels/llm_rank.py +16 -5
- package/modules/localmodels/metal.py +141 -0
- package/modules/localmodels/metal_probe.py +167 -0
- package/modules/localmodels/probe.py +2 -2
- package/modules/localmodels/recommend.py +6 -1
- package/modules/localmodels/remote_ops_download.py +36 -261
- package/modules/localmodels/remote_ops_ranges.py +447 -0
- package/modules/localmodels/runtime_auth.py +2 -1
- package/modules/localmodels/runtime_cli.py +1 -1
- package/modules/localmodels/runtime_install.py +5 -2
- package/modules/localmodels/runtime_io.py +3 -2
- package/modules/localmodels/runtime_pi.py +2 -1
- package/modules/localmodels/runtime_windows_acl.py +39 -0
- package/modules/localmodels/source_byok_probe.py +2 -1
- package/modules/localmodels/stack.py +13 -3
- package/modules/localmodels/stack_cli.py +1 -0
- package/modules/localmodels/stack_compose.py +6 -1
- package/modules/localmodels/stack_events.py +15 -0
- package/modules/localmodels/stack_hardware.py +3 -1
- package/modules/localmodels/stack_picks.py +16 -2
- package/modules/localmodels/stack_plan.py +5 -1
- package/modules/localmodels/stack_progress.py +30 -5
- package/modules/localmodels/stack_run.py +117 -0
- package/modules/localmodels/transport.py +1 -0
- package/modules/{simplex_localmodels-0.1.0.dev56.dist-info → simplex_localmodels-0.1.0.dev58.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev56.dist-info → simplex_localmodels-0.1.0.dev58.dist-info}/RECORD +51 -49
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/{simplex_localmodels-0.1.0.dev56.dist-info → simplex_localmodels-0.1.0.dev58.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev56.dist-info → simplex_localmodels-0.1.0.dev58.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev56.dist-info → simplex_localmodels-0.1.0.dev58.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev56.dist-info → simplex_localmodels-0.1.0.dev58.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -440,13 +440,13 @@
|
|
|
440
440
|
"quant": "GSQ-RCO-IQ2_XS",
|
|
441
441
|
"files": [
|
|
442
442
|
{
|
|
443
|
-
"path": "Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf",
|
|
443
|
+
"path": "IQ2_XS/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf",
|
|
444
444
|
"size_bytes": 39225954592,
|
|
445
445
|
"revision": "ed59f92082b1e93c0e96d60a8b11aab089b52f09",
|
|
446
446
|
"sha256": "92cee27ae5bbadcd732416a0f7a7f0acc092399dbbe8f5a5efa707c2ec0a49d7"
|
|
447
447
|
},
|
|
448
448
|
{
|
|
449
|
-
"path": "Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf",
|
|
449
|
+
"path": "IQ2_XS/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf",
|
|
450
450
|
"size_bytes": 28800138432,
|
|
451
451
|
"revision": "ed59f92082b1e93c0e96d60a8b11aab089b52f09",
|
|
452
452
|
"sha256": "316b46f3a2dbd68c900f43136ab9449f9dcc3725dfd8c794847c204bc161e113"
|
|
@@ -466,6 +466,7 @@
|
|
|
466
466
|
"architecture": "qwen4exp",
|
|
467
467
|
"mtp_draft_depth": 3,
|
|
468
468
|
"mmproj": {
|
|
469
|
+
"repo": "unsloth/Qwen3.8-Flash-Next-GGUF",
|
|
469
470
|
"path": "mmproj-BF16.gguf",
|
|
470
471
|
"size_bytes": 907542944,
|
|
471
472
|
"local": "mmproj-Qwen3.8-Flash-Next-BF16.gguf",
|
|
@@ -530,13 +531,13 @@
|
|
|
530
531
|
"quant": "GSQ-RCO-IQ3_S",
|
|
531
532
|
"files": [
|
|
532
533
|
{
|
|
533
|
-
"path": "Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf",
|
|
534
|
+
"path": "IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf",
|
|
534
535
|
"size_bytes": 54817524224,
|
|
535
536
|
"revision": "ed59f92082b1e93c0e96d60a8b11aab089b52f09",
|
|
536
537
|
"sha256": "4c1eb2ceb4915e1192f4f386021897bde56a97f40a0bb78bb86465e0f7d2aca3"
|
|
537
538
|
},
|
|
538
539
|
{
|
|
539
|
-
"path": "Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf",
|
|
540
|
+
"path": "IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf",
|
|
540
541
|
"size_bytes": 28800138432,
|
|
541
542
|
"revision": "ed59f92082b1e93c0e96d60a8b11aab089b52f09",
|
|
542
543
|
"sha256": "316b46f3a2dbd68c900f43136ab9449f9dcc3725dfd8c794847c204bc161e113"
|
|
@@ -556,6 +557,7 @@
|
|
|
556
557
|
"architecture": "qwen4exp",
|
|
557
558
|
"mtp_draft_depth": 3,
|
|
558
559
|
"mmproj": {
|
|
560
|
+
"repo": "unsloth/Qwen3.8-Flash-Next-GGUF",
|
|
559
561
|
"path": "mmproj-BF16.gguf",
|
|
560
562
|
"size_bytes": 907542944,
|
|
561
563
|
"local": "mmproj-Qwen3.8-Flash-Next-BF16.gguf",
|
|
@@ -3106,18 +3108,18 @@
|
|
|
3106
3108
|
"memory_estimate_bytes": 36507222016,
|
|
3107
3109
|
"files": [
|
|
3108
3110
|
{
|
|
3109
|
-
"path": "Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf",
|
|
3111
|
+
"path": "IQ2_XS/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf",
|
|
3110
3112
|
"local_name": "Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf",
|
|
3111
3113
|
"size_bytes": 39225954592,
|
|
3112
3114
|
"sha256": "92cee27ae5bbadcd732416a0f7a7f0acc092399dbbe8f5a5efa707c2ec0a49d7",
|
|
3113
|
-
"url": "{hf}/{repo}/resolve/{revision}/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf"
|
|
3115
|
+
"url": "{hf}/{repo}/resolve/{revision}/IQ2_XS/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00001-of-00002.gguf"
|
|
3114
3116
|
},
|
|
3115
3117
|
{
|
|
3116
|
-
"path": "Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf",
|
|
3118
|
+
"path": "IQ2_XS/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf",
|
|
3117
3119
|
"local_name": "Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf",
|
|
3118
3120
|
"size_bytes": 28800138432,
|
|
3119
3121
|
"sha256": "316b46f3a2dbd68c900f43136ab9449f9dcc3725dfd8c794847c204bc161e113",
|
|
3120
|
-
"url": "{hf}/{repo}/resolve/{revision}/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf"
|
|
3122
|
+
"url": "{hf}/{repo}/resolve/{revision}/IQ2_XS/Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS-00002-of-00002.gguf"
|
|
3121
3123
|
},
|
|
3122
3124
|
{
|
|
3123
3125
|
"path": "packs/iq2_xs/conversions.json",
|
|
@@ -284,6 +284,9 @@ _DISCRETE_BANDWIDTH_GB_S = 1000.0
|
|
|
284
284
|
_UMA_BANDWIDTH_GB_S = 210.0
|
|
285
285
|
_HOST_BANDWIDTH_GB_S = 80.0
|
|
286
286
|
PLEASANT_FLOOR_TOK_S = 20.0
|
|
287
|
+
# Below this decode rate a model is practically unusable for interactive agent loops, so automatic
|
|
288
|
+
# selection prefers any fitting candidate at or above this floor over a higher-scored model below it.
|
|
289
|
+
USABLE_FLOOR_TOK_S = 5.0
|
|
287
290
|
# What each speed estimate rests on; every one but measured-decode is an estimate.
|
|
288
291
|
DECODE_BASES = {
|
|
289
292
|
"discrete-class": f"a discrete-GPU class constant, {_DISCRETE_BANDWIDTH_GB_S:g} GB/s",
|
|
@@ -344,10 +347,10 @@ def decode_estimate(
|
|
|
344
347
|
basis, bandwidth = "host-measured", budget.host_bandwidth_gb_s
|
|
345
348
|
elif spilled:
|
|
346
349
|
basis, bandwidth = "host-class", _HOST_BANDWIDTH_GB_S
|
|
347
|
-
elif budget.uma:
|
|
348
|
-
basis, bandwidth = "uma-class", _UMA_BANDWIDTH_GB_S
|
|
349
350
|
elif budget.gpu_bandwidth_gb_s:
|
|
350
351
|
basis, bandwidth = "gpu-spec", budget.gpu_bandwidth_gb_s
|
|
352
|
+
elif budget.uma:
|
|
353
|
+
basis, bandwidth = "uma-class", _UMA_BANDWIDTH_GB_S
|
|
351
354
|
else:
|
|
352
355
|
basis, bandwidth = "discrete-class", _DISCRETE_BANDWIDTH_GB_S
|
|
353
356
|
effective_backend = hardware_key(budget, backend)[1]
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import csv
|
|
6
|
+
import http.client
|
|
6
7
|
import io
|
|
7
8
|
import subprocess
|
|
8
9
|
import tempfile
|
|
@@ -45,7 +46,7 @@ def check_decision(
|
|
|
45
46
|
key,
|
|
46
47
|
timeout,
|
|
47
48
|
)
|
|
48
|
-
except (urllib.error.URLError, OSError, ValueError) as exc:
|
|
49
|
+
except (urllib.error.URLError, OSError, http.client.HTTPException, ValueError) as exc:
|
|
49
50
|
return {"check": name, "ok": False, "detail": f"{type(exc).__name__}: {exc}"}
|
|
50
51
|
answers = resp.get("answers")
|
|
51
52
|
answer = answers.get("outage") if isinstance(answers, dict) else None
|
|
@@ -154,7 +155,7 @@ def accept(
|
|
|
154
155
|
)
|
|
155
156
|
answer = text(resp)
|
|
156
157
|
check(f"gateway group/{gw['group']}", TOUCH_EXPECT in answer.lower(), answer.strip()[:200])
|
|
157
|
-
except (urllib.error.URLError, OSError, ValueError) as exc:
|
|
158
|
+
except (urllib.error.URLError, OSError, http.client.HTTPException, ValueError) as exc:
|
|
158
159
|
check(f"gateway group/{gw['group']}", False, f"{type(exc).__name__}: {exc}")
|
|
159
160
|
if routed:
|
|
160
161
|
after = after_fn(plan, decider, "routing", before)
|
|
@@ -170,7 +171,7 @@ def accept(
|
|
|
170
171
|
try:
|
|
171
172
|
harness_gateway.require_target(plan)
|
|
172
173
|
check(name, *aux_answer(gw["addr"], ep, f"{pid}/{ep['model']}", timeout))
|
|
173
|
-
except (urllib.error.URLError, OSError, ValueError) as exc:
|
|
174
|
+
except (urllib.error.URLError, OSError, http.client.HTTPException, ValueError) as exc:
|
|
174
175
|
check(name, False, f"{type(exc).__name__}: {exc}")
|
|
175
176
|
continue
|
|
176
177
|
after = after_fn(plan, pid, None, before)
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import contextlib
|
|
6
|
+
import http.client
|
|
6
7
|
import os
|
|
7
8
|
import secrets
|
|
8
9
|
import shutil
|
|
@@ -328,7 +329,7 @@ def healthy(addr: str, timeout: float = 5) -> bool:
|
|
|
328
329
|
try:
|
|
329
330
|
with opener().open(f"http://{addr}/health", timeout=timeout) as r:
|
|
330
331
|
return bool(r.status == 200)
|
|
331
|
-
except (urllib.error.URLError, OSError, ValueError):
|
|
332
|
+
except (urllib.error.URLError, OSError, http.client.HTTPException, ValueError):
|
|
332
333
|
return False
|
|
333
334
|
|
|
334
335
|
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import argparse
|
|
6
6
|
import errno
|
|
7
7
|
import hashlib
|
|
8
|
+
import http.client
|
|
8
9
|
import json
|
|
9
10
|
import os
|
|
10
11
|
import secrets
|
|
@@ -228,7 +229,7 @@ def status(root: Path) -> dict[str, Any]:
|
|
|
228
229
|
authenticated=live.get("authenticated") is True,
|
|
229
230
|
models=live.get("models", []),
|
|
230
231
|
)
|
|
231
|
-
except (OSError, ValueError, urllib.error.URLError):
|
|
232
|
+
except (OSError, ValueError, urllib.error.URLError, http.client.HTTPException):
|
|
232
233
|
pass
|
|
233
234
|
return result
|
|
234
235
|
|
|
@@ -251,14 +252,14 @@ def _stop(root: Path) -> dict[str, Any]:
|
|
|
251
252
|
while True:
|
|
252
253
|
try:
|
|
253
254
|
live = _request(root, state, "status")
|
|
254
|
-
except (OSError, ValueError, urllib.error.URLError):
|
|
255
|
+
except (OSError, ValueError, urllib.error.URLError, http.client.HTTPException):
|
|
255
256
|
live = None
|
|
256
257
|
if live is not None:
|
|
257
258
|
if live.get("instance") != state["instance"]:
|
|
258
259
|
raise ValueError("Gateway ownership mismatch")
|
|
259
260
|
try:
|
|
260
261
|
_request(root, state, "stop", method="POST")
|
|
261
|
-
except (OSError, ValueError, urllib.error.URLError):
|
|
262
|
+
except (OSError, ValueError, urllib.error.URLError, http.client.HTTPException):
|
|
262
263
|
pass # The server may have closed between its status and stop requests.
|
|
263
264
|
if worker_idle(root):
|
|
264
265
|
if state.get("kind") == "bifrost":
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import argparse
|
|
6
6
|
import hmac
|
|
7
|
+
import http.client
|
|
7
8
|
import http.server
|
|
8
9
|
import json
|
|
9
10
|
import os
|
|
@@ -293,7 +294,7 @@ def ingress_handler(
|
|
|
293
294
|
if self.path == "/_localmodels/status" and self.command == "GET":
|
|
294
295
|
try:
|
|
295
296
|
models = model_ids(state["upstreamPort"])
|
|
296
|
-
except (OSError, ValueError, urllib.error.URLError):
|
|
297
|
+
except (OSError, ValueError, urllib.error.URLError, http.client.HTTPException):
|
|
297
298
|
models = []
|
|
298
299
|
ready = False
|
|
299
300
|
else:
|
|
@@ -327,6 +328,7 @@ def ingress_handler(
|
|
|
327
328
|
_, current["authenticated"] = configure(root, state)
|
|
328
329
|
except (
|
|
329
330
|
OSError,
|
|
331
|
+
http.client.HTTPException,
|
|
330
332
|
ValueError,
|
|
331
333
|
TypeError,
|
|
332
334
|
AttributeError,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
"""What a
|
|
2
|
-
bandwidth
|
|
1
|
+
"""What a GPU or Apple Silicon SoC model name and compute capability say about it: the
|
|
2
|
+
architecture, and the memory bandwidth the vendor publishes for that model.
|
|
3
3
|
|
|
4
|
-
Decode reads the resident weights once per token, so
|
|
5
|
-
|
|
6
|
-
vendor spec-sheet figures, not measurements of any host, and only names that pin one
|
|
7
|
-
configuration:
|
|
8
|
-
RTX 3060 Ti and RTX 4070 in GDDR6 and GDDR6X)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
Decode reads the resident weights once per token, so memory bandwidth bounds decode speed; two
|
|
5
|
+
devices with the same capacity but different memory buses do not decode alike (product.md). The
|
|
6
|
+
table holds vendor spec-sheet figures, not measurements of any host, and only names that pin one
|
|
7
|
+
memory configuration: NVIDIA parts sold with two memory setups (RTX 3060 8/12 GB, RTX 3080
|
|
8
|
+
10/12 GB, RTX 3060 Ti and RTX 4070 in GDDR6 and GDDR6X), laptop NVIDIA parts, and Apple Silicon
|
|
9
|
+
Max chips sold with two bus widths (M3 Max 300/400 GB/s, M4 Max 410/546 GB/s, M5 Max 460/614 GB/s)
|
|
10
|
+
are left out unless a known host fact (such as Apple M6's 16 GB vs 24/32 GB memory tier)
|
|
11
|
+
disambiguates them, so unlisted names keep their class constant. On qwen3.8-27b UD-Q4_K_M without
|
|
12
|
+
speculation the repository measured 43–47.6 tok/s on an RTX 4090 D and 14.8 tok/s on an L4
|
|
13
|
+
(catalog/model-matrix/pending/llm.qwen.json): a ratio of 3.2 against 3.4 between their spec
|
|
14
|
+
bandwidths, where the old single 1000 GB/s class constant priced both alike.
|
|
13
15
|
"""
|
|
14
16
|
|
|
15
17
|
from __future__ import annotations
|
|
@@ -56,7 +58,27 @@ _BANDWIDTH_GB_S: tuple[tuple[str, float], ...] = (
|
|
|
56
58
|
(r"h200", 4800.0),
|
|
57
59
|
(r"t4", 320.0),
|
|
58
60
|
(r"v100 (sxm2|pcie) (16|32)gb", 900.0),
|
|
61
|
+
# Apple Silicon unified memory bandwidth (vendor published specs).
|
|
62
|
+
# Omitted: M3 Max (300/400 GB/s), M4 Max (410/546 GB/s), M5 Max (460/614 GB/s) vary by core
|
|
63
|
+
# tier; base M6 varies by RAM capacity and is resolved when total_bytes is provided.
|
|
64
|
+
(r"apple m1", 68.25),
|
|
65
|
+
(r"apple m1 pro", 200.0),
|
|
66
|
+
(r"apple m1 max", 400.0),
|
|
67
|
+
(r"apple m1 ultra", 800.0),
|
|
68
|
+
(r"apple m2", 100.0),
|
|
69
|
+
(r"apple m2 pro", 200.0),
|
|
70
|
+
(r"apple m2 max", 400.0),
|
|
71
|
+
(r"apple m2 ultra", 800.0),
|
|
72
|
+
(r"apple m3", 100.0),
|
|
73
|
+
(r"apple m3 pro", 150.0),
|
|
74
|
+
(r"apple m3 ultra", 819.0),
|
|
75
|
+
(r"apple m4", 120.0),
|
|
76
|
+
(r"apple m4 pro", 273.0),
|
|
77
|
+
(r"apple m5", 153.0),
|
|
78
|
+
(r"apple m5 pro", 307.0),
|
|
79
|
+
(r"apple m5 ultra", 1200.0),
|
|
59
80
|
)
|
|
81
|
+
_GIB = 1 << 30
|
|
60
82
|
_DROPPED = re.compile(r"\b(nvidia|geforce|tesla|quadro)\b")
|
|
61
83
|
|
|
62
84
|
# Compute capability major (and minor where one major spans two) → architecture.
|
|
@@ -89,9 +111,12 @@ def device_class(name: str) -> str:
|
|
|
89
111
|
return key
|
|
90
112
|
|
|
91
113
|
|
|
92
|
-
def bandwidth_gb_s(name: str) -> float | None:
|
|
93
|
-
"""The published memory bandwidth of the
|
|
114
|
+
def bandwidth_gb_s(name: str, *, total_bytes: int | None = None) -> float | None:
|
|
115
|
+
"""The published memory bandwidth of the GPU or Apple Silicon SoC ``name``; None: not listed."""
|
|
94
116
|
key = normalized(name)
|
|
117
|
+
if key == "apple m6" and total_bytes is not None and total_bytes > 0:
|
|
118
|
+
# Base Apple M6 ships with 153 GB/s at 16 GB and 170 GB/s at 24/32 GB.
|
|
119
|
+
return 153.0 if total_bytes <= 16 * _GIB else 170.0
|
|
95
120
|
return next((bw for pattern, bw in _BANDWIDTH_GB_S if re.fullmatch(pattern, key)), None)
|
|
96
121
|
|
|
97
122
|
|
|
@@ -51,7 +51,7 @@ from localmodels.npm_transport import ToolBuild as ToolBuild
|
|
|
51
51
|
from localmodels.npm_transport import fetch_bifrost
|
|
52
52
|
from localmodels.remote_ops import Archive, fetch
|
|
53
53
|
from localmodels.remote_ops_download import npm_copies
|
|
54
|
-
from localmodels.runtime_io import Event, error_cause
|
|
54
|
+
from localmodels.runtime_io import Event, error_cause, rename_with_retry
|
|
55
55
|
from localmodels.stack_events import CombinedEvents as _CombinedEvents
|
|
56
56
|
from localmodels.stack_events import ToolEvents
|
|
57
57
|
from localmodels.tool_archive import (
|
|
@@ -606,7 +606,7 @@ def _install_tree(tools_dir: Path, name: str, unpack: Callable[[Path], None], ma
|
|
|
606
606
|
(staging / ".complete").write_text(marker + "\n", encoding="utf-8")
|
|
607
607
|
if final.exists():
|
|
608
608
|
shutil.rmtree(final)
|
|
609
|
-
staging
|
|
609
|
+
rename_with_retry(staging, final)
|
|
610
610
|
finally:
|
|
611
611
|
if staging.exists():
|
|
612
612
|
shutil.rmtree(staging)
|
|
@@ -15,6 +15,7 @@ Because the Hub is queried, ``--offline`` plans refuse repo specs and keep takin
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
import difflib
|
|
18
|
+
import http.client
|
|
18
19
|
import io
|
|
19
20
|
import json
|
|
20
21
|
import re
|
|
@@ -193,6 +194,26 @@ def close_ids(name: str, ids: Sequence[str]) -> list[str]:
|
|
|
193
194
|
return [i for score, i in scored[:3] if score >= max(0.6, best - 0.1)]
|
|
194
195
|
|
|
195
196
|
|
|
197
|
+
def _hub_call(repo: str, call: Callable[[], object]) -> object:
|
|
198
|
+
try:
|
|
199
|
+
return call()
|
|
200
|
+
except http.client.HTTPException as exc:
|
|
201
|
+
raise PlanError(
|
|
202
|
+
f"Hub HTTP error reading {repo} ({type(exc).__name__})",
|
|
203
|
+
cause_code="HUB_UNREACHABLE",
|
|
204
|
+
) from exc
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _hub_header(repo: str, url: str, read_range: FetchBytes) -> GGUFHeader:
|
|
208
|
+
try:
|
|
209
|
+
return _repo_header(url, read_range)
|
|
210
|
+
except http.client.HTTPException as exc:
|
|
211
|
+
raise PlanError(
|
|
212
|
+
f"Hub HTTP error reading {repo} ({type(exc).__name__})",
|
|
213
|
+
cause_code="HUB_UNREACHABLE",
|
|
214
|
+
) from exc
|
|
215
|
+
|
|
216
|
+
|
|
196
217
|
def entry_for(
|
|
197
218
|
spec: str,
|
|
198
219
|
entries: tuple[cat.CatalogEntry, ...],
|
|
@@ -234,7 +255,7 @@ def entry_for(
|
|
|
234
255
|
f"/revision/{urllib.parse.quote(revision)}" if revision else ""
|
|
235
256
|
)
|
|
236
257
|
try:
|
|
237
|
-
doc = decode(hf_get(first), ModelInfo)
|
|
258
|
+
doc = decode(_hub_call(repo, lambda: hf_get(first)), ModelInfo)
|
|
238
259
|
except urllib.error.HTTPError:
|
|
239
260
|
raise
|
|
240
261
|
except OSError as exc:
|
|
@@ -244,7 +265,7 @@ def entry_for(
|
|
|
244
265
|
commit = doc.get("sha")
|
|
245
266
|
if not commit:
|
|
246
267
|
raise PlanError(f"{repo} does not resolve on the Hub")
|
|
247
|
-
raw_tree = hf_get(f"{api}/api/models/{repo}/tree/{commit}")
|
|
268
|
+
raw_tree = _hub_call(repo, lambda: hf_get(f"{api}/api/models/{repo}/tree/{commit}"))
|
|
248
269
|
if not isinstance(raw_tree, list):
|
|
249
270
|
raise PlanError("Hub tree must be an array")
|
|
250
271
|
tree = [
|
|
@@ -256,8 +277,10 @@ def entry_for(
|
|
|
256
277
|
if not groups:
|
|
257
278
|
raise PlanError(f"{repo} has no .gguf model file")
|
|
258
279
|
stem, files = _pick(groups, quant, repo)
|
|
259
|
-
header =
|
|
260
|
-
|
|
280
|
+
header = _hub_header(
|
|
281
|
+
repo,
|
|
282
|
+
f"{api}/{repo}/resolve/{commit}/{urllib.parse.quote(files[0]['path'])}",
|
|
283
|
+
read_range,
|
|
261
284
|
)
|
|
262
285
|
card = doc.get("cardData") or {}
|
|
263
286
|
license_name, license_link = _license(card)
|
|
@@ -96,6 +96,13 @@ def add_parser(sub: argparse._SubParsersAction[argparse.ArgumentParser]) -> None
|
|
|
96
96
|
metavar="MODEL",
|
|
97
97
|
help="unload this model first (repeatable); refused before any unload without room",
|
|
98
98
|
)
|
|
99
|
+
load.add_argument(
|
|
100
|
+
"--force",
|
|
101
|
+
"--allow-overcommit",
|
|
102
|
+
dest="force",
|
|
103
|
+
action="store_true",
|
|
104
|
+
help="load at the compact floor posture even when live memory is below headroom guards (still refuses critical OS memory pressure)",
|
|
105
|
+
)
|
|
99
106
|
load.add_argument("--jsonl", action="store_true", help="accepted; output is JSONL")
|
|
100
107
|
cli_help.document(
|
|
101
108
|
load,
|
|
@@ -158,7 +165,7 @@ def cli(args: argparse.Namespace) -> int:
|
|
|
158
165
|
load=lambda m, b, u: library_serve.load(m, b, u),
|
|
159
166
|
)
|
|
160
167
|
elif verb == "load":
|
|
161
|
-
row = library_serve.load(args.model, args.base_dir, args.unload)
|
|
168
|
+
row = library_serve.load(args.model, args.base_dir, args.unload, force=args.force)
|
|
162
169
|
elif verb == "unload":
|
|
163
170
|
row = library_serve.unload(args.model, args.base_dir)
|
|
164
171
|
elif verb == "remove":
|