@simplexai/localmodels-linux-arm64 0.1.0-dev.110 → 0.1.0-dev.112

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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/bootstrap.identity +1 -1
  3. package/bootstrap.sha256 +52 -52
  4. package/modules/localmodels/__init__.py +1 -1
  5. package/modules/localmodels/catalog.json +482 -103
  6. package/modules/localmodels/catalog_recipes.py +10 -1
  7. package/modules/localmodels/custom_hub.py +66 -2
  8. package/modules/localmodels/custom_hub_http.py +18 -0
  9. package/modules/localmodels/deploy.py +70 -5
  10. package/modules/localmodels/download-mirrors.json +70 -0
  11. package/modules/localmodels/engine_adapters/strata_poly.py +20 -4
  12. package/modules/localmodels/engine_adapters/suite_plan.py +7 -0
  13. package/modules/localmodels/engines-strata-poly-0.2.20-poly.10.json +132 -0
  14. package/modules/localmodels/engines.json +96 -91
  15. package/modules/localmodels/engines.py +9 -2
  16. package/modules/localmodels/http_local.py +46 -0
  17. package/modules/localmodels/library_cli.py +2 -1
  18. package/modules/localmodels/library_custom.py +73 -0
  19. package/modules/localmodels/library_jobs.py +47 -23
  20. package/modules/localmodels/library_model.py +3 -1
  21. package/modules/localmodels/library_poly.py +78 -33
  22. package/modules/localmodels/library_presentation.py +28 -0
  23. package/modules/localmodels/library_pricing.py +125 -20
  24. package/modules/localmodels/library_serve.py +90 -27
  25. package/modules/localmodels/library_smoke.py +1 -1
  26. package/modules/localmodels/library_state.py +23 -1
  27. package/modules/localmodels/library_status.py +57 -56
  28. package/modules/localmodels/mirrors.py +217 -21
  29. package/modules/localmodels/npm_transport.py +46 -35
  30. package/modules/localmodels/plan_envelope.py +8 -1
  31. package/modules/localmodels/region.py +90 -23
  32. package/modules/localmodels/remote_ops_common.py +1 -0
  33. package/modules/localmodels/remote_ops_download.py +583 -126
  34. package/modules/localmodels/remote_ops_prepare.py +8 -2
  35. package/modules/localmodels/remote_ops_ranges.py +80 -44
  36. package/modules/localmodels/remote_ops_redirect.py +3 -1
  37. package/modules/localmodels/remote_ops_remove.py +4 -2
  38. package/modules/localmodels/runtime_index.py +3 -1
  39. package/modules/localmodels/stack.py +1 -6
  40. package/modules/localmodels/stack_suite.py +15 -2
  41. package/modules/localmodels/{strata-poly-serve-0.2.20-poly.9.txt → strata-poly-serve-0.2.20-poly.10.txt} +1 -1
  42. package/modules/localmodels/suite.py +110 -8
  43. package/modules/localmodels/web/view/i18n.js +1 -1
  44. package/modules/localmodels/web/view/view.js +11 -3
  45. package/modules/{simplex_localmodels-0.1.0.dev110.dist-info → simplex_localmodels-0.1.0.dev112.dist-info}/METADATA +1 -1
  46. package/modules/{simplex_localmodels-0.1.0.dev110.dist-info → simplex_localmodels-0.1.0.dev112.dist-info}/RECORD +48 -48
  47. package/package.json +1 -1
  48. package/tool.json +1 -1
  49. package/modules/localmodels/engines-strata-poly-0.2.20-poly.9.json +0 -132
  50. /package/modules/{simplex_localmodels-0.1.0.dev110.dist-info → simplex_localmodels-0.1.0.dev112.dist-info}/WHEEL +0 -0
  51. /package/modules/{simplex_localmodels-0.1.0.dev110.dist-info → simplex_localmodels-0.1.0.dev112.dist-info}/entry_points.txt +0 -0
  52. /package/modules/{simplex_localmodels-0.1.0.dev110.dist-info → simplex_localmodels-0.1.0.dev112.dist-info}/licenses/LICENSE +0 -0
  53. /package/modules/{simplex_localmodels-0.1.0.dev110.dist-info → simplex_localmodels-0.1.0.dev112.dist-info}/licenses/NOTICE +0 -0
  54. /package/modules/{simplex_localmodels-0.1.0.dev110.dist-info → simplex_localmodels-0.1.0.dev112.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -465,6 +465,15 @@ def _draft_spec_problems(model: OptionalModelData) -> list[str]:
465
465
  return found
466
466
 
467
467
 
468
+ def engine_lock_exists(tag: str) -> bool:
469
+ """Whether ``engines-<tag>.json`` is in the catalog directory; a tag naming the default
470
+ lock's own release is engines.json, so the newest release needs no second copy."""
471
+ if CATALOG_PATH.with_name(f"engines-{tag}.json").is_file():
472
+ return True
473
+ default = json.loads(CATALOG_PATH.with_name("engines.json").read_text(encoding="utf-8"))
474
+ return bool(tag) and default.get("tag") == tag
475
+
476
+
468
477
  def problems(value: object) -> list[str]:
469
478
  """Why this catalog is not complete as schema 3, one line per entry and field (never values):
470
479
  every model and component names its license with an https link, status, tasks and evidence;
@@ -479,7 +488,7 @@ def problems(value: object) -> list[str]:
479
488
  if m.get("runtime", "llama.cpp") not in ("llama.cpp", "mlx-lm"):
480
489
  issues.append("runtime is unknown")
481
490
  if (tag := m.get("engine")) is not None:
482
- if not tag or not CATALOG_PATH.with_name(f"engines-{tag}.json").is_file():
491
+ if not tag or not engine_lock_exists(tag):
483
492
  issues.append(f"engine lock engines-{tag}.json does not exist")
484
493
  if (ub := m.get("ubatch")) is not None and ub <= 0:
485
494
  issues.append("ubatch must be positive")
@@ -63,6 +63,9 @@ from localmodels.custom_hub_http import (
63
63
  from localmodels.custom_hub_http import (
64
64
  SafeRedirectHandler as SafeRedirectHandler,
65
65
  )
66
+ from localmodels.custom_hub_http import (
67
+ auto_hub_order as auto_hub_order,
68
+ )
66
69
  from localmodels.custom_hub_http import (
67
70
  build_opener as build_opener,
68
71
  )
@@ -843,10 +846,71 @@ def fetch_ms_repo(
843
846
  )
844
847
 
845
848
 
849
+ def modelscope_mirror_urls(
850
+ repo_id: str,
851
+ files: Sequence[Mapping[str, object]],
852
+ *,
853
+ timeout: float = 2.0,
854
+ ) -> dict[str, str]:
855
+ """ModelScope URLs for ``files`` whose sha256 and size match ``repo_id`` on master.
856
+
857
+ One bounded read-only listing. Any failure, including timeout, returns ``{}``.
858
+ """
859
+ if timeout > 2.0:
860
+ timeout = 2.0
861
+ if "/" not in repo_id or not files:
862
+ return {}
863
+ wanted: dict[tuple[str, int], str] = {}
864
+ for item in files:
865
+ sha = item.get("sha256")
866
+ if not isinstance(sha, str) or len(sha) != 64:
867
+ continue
868
+ size = item.get("size_bytes")
869
+ if isinstance(size, bool) or not isinstance(size, int):
870
+ continue
871
+ wanted[(sha, size)] = str(item.get("path") or "")
872
+ if not wanted:
873
+ return {}
874
+ tree_url = f"{MODELSCOPE_API}/api/v1/models/{repo_id}/repo/files?Revision=master&Recursive=true"
875
+ try:
876
+ doc = http_json(tree_url, timeout=timeout)
877
+ except (OSError, http.client.HTTPException, urllib.error.URLError, ValueError, LibraryError):
878
+ return {}
879
+ if not isinstance(doc, Mapping) or doc.get("Code") != 200:
880
+ return {}
881
+ data = doc.get("Data")
882
+ raw_files = data.get("Files") if isinstance(data, Mapping) else None
883
+ if not isinstance(raw_files, list):
884
+ return {}
885
+ found: dict[str, str] = {}
886
+ for entry in raw_files:
887
+ if not isinstance(entry, Mapping):
888
+ continue
889
+ sha = str(entry.get("Sha256") or "")
890
+ size = _int_or_zero(entry.get("Size"))
891
+ path = wanted.get((sha, size))
892
+ if not path or path in found:
893
+ continue
894
+ file_rev = str(entry.get("Revision") or "master").strip() or "master"
895
+ ms_path = str(entry.get("Path") or path)
896
+ found[path] = (
897
+ f"{MODELSCOPE_API}/models/{repo_id}/resolve/"
898
+ f"{urllib.parse.quote(file_rev, safe='')}/"
899
+ f"{urllib.parse.quote(ms_path, safe='/')}"
900
+ )
901
+ return found
902
+
903
+
846
904
  def fetch_repo(
847
905
  spec: ParsedRepoSpec, *, token: str | None = None, timeout: float = TREE_TIMEOUT_S
848
906
  ) -> FetchOutcome:
849
- """Resolve and fetch a parsed repository spec across explicit or auto-selected hubs."""
907
+ """Resolve and fetch a parsed repository spec across explicit or auto-selected hubs.
908
+
909
+ ``hub="auto"`` uses ``auto_hub_order``, which only reads an explicit region or a saved
910
+ ``region.json``. It does not call ``current_region()``, so search and inspect stay offline
911
+ when nothing is cached. A custom download plan resolves the region itself before attaching
912
+ a ModelScope mirror.
913
+ """
850
914
  hub_explicit = spec.hub is not None
851
915
 
852
916
  def _fetch(hub_name: CustomHub) -> FetchOutcome:
@@ -871,7 +935,7 @@ def fetch_repo(
871
935
  return _fetch(spec.hub)
872
936
  first_error: LibraryError | None = None
873
937
  last_not_found: HubNotFound | None = None
874
- for hub_name in ("huggingface", "modelscope"):
938
+ for hub_name in auto_hub_order():
875
939
  try:
876
940
  outcome = _fetch(cast(CustomHub, hub_name))
877
941
  except LibraryError as exc:
@@ -238,6 +238,24 @@ def _readonly_region(env: Mapping[str, str] | None = None) -> str:
238
238
  return "global"
239
239
 
240
240
 
241
+ def readonly_region(env: Mapping[str, str] | None = None) -> str:
242
+ """Active region without writing ``region.json`` or running a network speed probe."""
243
+ return _readonly_region(env)
244
+
245
+
246
+ def auto_hub_order(env: Mapping[str, str] | None = None) -> tuple[str, str]:
247
+ """Hub try-order for ``hub="auto"``. China tries ModelScope before Hugging Face.
248
+
249
+ Read-only on purpose: search, inspect, and ``fetch_repo`` must not probe or write
250
+ ``region.json``. A cold ``SIMPLEX_REGION=auto`` with no cache therefore still tries
251
+ Hugging Face first here. ``library_custom`` download planning calls ``current_region()``
252
+ before it attaches a ModelScope mirror.
253
+ """
254
+ if _readonly_region(env) == "cn":
255
+ return ("modelscope", "huggingface")
256
+ return ("huggingface", "modelscope")
257
+
258
+
241
259
  def hf_endpoints(
242
260
  explicit_endpoint: str | None = None, *, env: Mapping[str, str] | None = None
243
261
  ) -> list[str]:
@@ -12,6 +12,7 @@ import secrets
12
12
  import time
13
13
  from collections.abc import Callable
14
14
  from dataclasses import dataclass, replace
15
+ from pathlib import Path
15
16
 
16
17
  from localmodels import catalog as cat
17
18
  from localmodels import (
@@ -66,6 +67,8 @@ from localmodels.transport import Executor
66
67
  DEFAULT_BASE_DIR = "~/.local/share/localmodels"
67
68
  DEFAULT_PORT = 18100
68
69
  HF_API = region.HF_API
70
+ STATIC_API_KEY_FILE_ENV = "LOCALMODELS_STATIC_API_KEY_FILE"
71
+ PINNED_API_KEY_NAME = ".pinned-api-key"
69
72
 
70
73
 
71
74
  def hf_endpoint() -> str:
@@ -415,6 +418,63 @@ STEPS: tuple[Action, ...] = ("engine", "download", "install", "start", "verify")
415
418
  SERVICE_ACTIONS: tuple[Action, ...] = ("start", "stop", "status", "remove")
416
419
 
417
420
 
421
+ def _read_key_file(path: Path) -> str | None:
422
+ try:
423
+ key = path.read_text(encoding="utf-8").strip()
424
+ except (OSError, UnicodeError):
425
+ return None
426
+ if not key or "\n" in key or "\r" in key:
427
+ return None
428
+ return key
429
+
430
+
431
+ def saved_api_key_in(deploy_dir: str | Path) -> str | None:
432
+ """Read a local deployment directory's pinned or existing API key without generating one."""
433
+ root = Path(os.path.expanduser(str(deploy_dir)))
434
+ for name in (PINNED_API_KEY_NAME, "api-key"):
435
+ if key := _read_key_file(root / name):
436
+ return key
437
+ return None
438
+
439
+
440
+ def saved_api_key(plan: Plan) -> str | None:
441
+ """Read a local deployment's pinned or existing API key without generating a new one."""
442
+ return saved_api_key_in(plan["service"]["deploy_dir"])
443
+
444
+
445
+ def resolve_api_key(
446
+ plan: Plan,
447
+ *,
448
+ api_key: str | None = None,
449
+ local: bool = True,
450
+ fallback_key: str | None = None,
451
+ ) -> str:
452
+ """Resolve the deployment API key without unexpectedly rotating an existing one.
453
+
454
+ Precedence: explicit ``api_key`` -> ``$LOCALMODELS_STATIC_API_KEY_FILE`` ->
455
+ ``<deploy_dir>/.pinned-api-key`` (local) -> existing ``<deploy_dir>/api-key`` (local) ->
456
+ ``fallback_key`` -> fresh random key.
457
+ """
458
+ if api_key:
459
+ return api_key
460
+ env_file = os.environ.get(STATIC_API_KEY_FILE_ENV, "").strip()
461
+ if env_file:
462
+ if key := _read_key_file(Path(env_file).expanduser()):
463
+ return key
464
+ if local:
465
+ if key := saved_api_key(plan):
466
+ return key
467
+ if fallback_key:
468
+ return fallback_key
469
+ return secrets.token_urlsafe(24)
470
+
471
+
472
+ def _scrub_key(text: str, api_key: str) -> str:
473
+ if len(api_key) >= 8 and api_key in text:
474
+ return text.replace(api_key, "[REDACTED]")
475
+ return text
476
+
477
+
418
478
  def execute(
419
479
  executor: Executor,
420
480
  plan: Plan,
@@ -425,7 +485,11 @@ def execute(
425
485
  on_start: Callable[[FinishedRecord], None] = lambda record: None,
426
486
  ) -> FinishedRecord:
427
487
  """Run until failure; ``on_start`` retains interrupted records without keys."""
428
- api_key = api_key or secrets.token_urlsafe(24)
488
+ api_key = resolve_api_key(
489
+ plan,
490
+ api_key=api_key,
491
+ local=getattr(executor, "target", None) is None,
492
+ )
429
493
  record: FinishedRecord = {"plan": plan, "started_at": utc_now(), "steps": [], "ok": False}
430
494
  on_start(record)
431
495
  for step in STEPS:
@@ -442,19 +506,20 @@ def execute(
442
506
  step_ms = max(0, round((time.monotonic() - step_started) * 1000))
443
507
  outcome = _event(last)
444
508
  ok = result.returncode == 0 and outcome["event"] == "result"
509
+ if not ok and isinstance(msg := outcome.get("message"), str):
510
+ outcome["message"] = _scrub_key(msg, api_key)
445
511
  record["steps"].append(
446
512
  {
447
513
  "step": step,
448
514
  "ok": ok,
449
515
  "result": outcome,
450
- "stderr": result.stderr[-2000:] if not ok else "",
516
+ "stderr": _scrub_key(result.stderr[-2000:], api_key) if not ok else "",
451
517
  "duration_ms": step_ms,
452
518
  }
453
519
  )
454
520
  if not ok:
455
- record["error"] = (
456
- outcome.get("message") or result.stderr.strip()[-500:] or "unknown failure"
457
- )
521
+ raw_error = outcome.get("message") or result.stderr.strip()[-500:] or "unknown failure"
522
+ record["error"] = _scrub_key(str(raw_error), api_key)
458
523
  break
459
524
  else:
460
525
  record["ok"] = True
@@ -489,6 +489,26 @@
489
489
  "6ebb6bb288f20f3ae8d004d3c2ca27697da27c037d75e81a60e2a6a663f95425": {
490
490
  "repo": "luozx123/kokoro-int8-multi-lang-v1_0",
491
491
  "path": "tokens.txt"
492
+ },
493
+ "c70ce391c1a6bb464837e52c5c5648292cb48b7ab38fb01b2238ed0676b97cb8": {
494
+ "repo": "unsloth/Qwen4-35B-A3B-GGUF",
495
+ "path": "UD-Q4_K_XL/Qwen4-35B-A3B-UD-Q4_K_XL-00001-of-00002.gguf"
496
+ },
497
+ "419b93856e79a6f2338160d98d3b6b75042c57786af92c3010405b7b808dc4b4": {
498
+ "repo": "unsloth/Qwen4-35B-A3B-GGUF",
499
+ "path": "UD-Q4_K_XL/Qwen4-35B-A3B-UD-Q4_K_XL-00002-of-00002.gguf"
500
+ },
501
+ "db3ccef727493272bd338ca87a3e186caaf5fe442118de1c561f7e07ac15a70e": {
502
+ "repo": "unsloth/Qwen4-35B-A3B-GGUF",
503
+ "path": "mmproj-BF16.gguf"
504
+ },
505
+ "513d029c8c267ee07c9d6742dd9958629bb73d4046604524ce3a6734b813120c": {
506
+ "repo": "unsloth/Qwen4-35B-A3B-GGUF",
507
+ "path": "UD-IQ4_XS/Qwen4-35B-A3B-UD-IQ4_XS-00001-of-00002.gguf"
508
+ },
509
+ "e726deb276e49404c7f4c9f9b095755f658504fc7a2debd81c23f50be45f7d76": {
510
+ "repo": "unsloth/Qwen4-35B-A3B-GGUF",
511
+ "path": "UD-Q4_K_M/Qwen4-35B-A3B-UD-Q4_K_M-00001-of-00002.gguf"
492
512
  }
493
513
  },
494
514
  "unmirrored": {
@@ -501,6 +521,56 @@
501
521
  "repo": "unsloth/Qwen3.8-27B-GGUF",
502
522
  "path": "Qwen3.8-27B-UD-Q4_K_M.gguf",
503
523
  "reason": "modelscope master has a different sha256/size"
524
+ },
525
+ "5ce89370720f8bf90890f439361282104c1aa1482d4013bb9a50923e758e71a4": {
526
+ "repo": "unsloth/Qwen3.8-Flash-Next-GGUF",
527
+ "path": "UD-IQ4_XS/Qwen3.8-Flash-Next-UD-IQ4_XS-00001-of-00003.gguf",
528
+ "reason": "absent on modelscope master"
529
+ },
530
+ "577a38a2392b40ca2193cea502e1d92f60b8cd370675d308e0ec21885d9daaa7": {
531
+ "repo": "unsloth/Qwen3.8-Flash-Next-GGUF",
532
+ "path": "UD-IQ4_XS/Qwen3.8-Flash-Next-UD-IQ4_XS-00002-of-00003.gguf",
533
+ "reason": "absent on modelscope master"
534
+ },
535
+ "d4634e6d84f0ebb0940be15c90d3790bf6464e3dea3a1cddc567dc0e83ad8833": {
536
+ "repo": "unsloth/Qwen3.8-Flash-Next-GGUF",
537
+ "path": "UD-IQ4_XS/Qwen3.8-Flash-Next-UD-IQ4_XS-00003-of-00003.gguf",
538
+ "reason": "absent on modelscope master"
539
+ },
540
+ "6be8a94e2d94107b7f38fdc957c3460ffeb6ff6302edef92c50738682f9dc0e0": {
541
+ "repo": "ggml-org/Qwen3.8-Flash-Next-GGUF",
542
+ "path": "mtp-Qwen3.8-Flash-Next-Q8_0.gguf",
543
+ "reason": "modelscope master has a different sha256/size"
544
+ },
545
+ "de2fac5230621125f0309046175a17f8cc554ee2fc2a199c0e6528f2e4aadd79": {
546
+ "repo": "Hob-forge/Kolibri-1-GGUF",
547
+ "path": "Kolibri-1-Q2_K.gguf",
548
+ "reason": "repo absent on modelscope"
549
+ },
550
+ "0111b1c86fe647064e2bb3606da63d80f991d8ff56cdb994134a1632439e15a2": {
551
+ "repo": "maternion/Clover-35B-A3B-Preview-GGUF",
552
+ "path": "Diffuspace-Clover-35B-A3B-Preview-Q3_K_M.gguf",
553
+ "reason": "repo absent on modelscope"
554
+ },
555
+ "c729ae6c7bb16dd5b362cdb925c7fb09d744c95601f62b0f45ce51efb55bfe95": {
556
+ "repo": "openbmb/MiniCPM-V-4.7-35B-A3B-gguf",
557
+ "path": "MiniCPM-V-4_7-35B-A3B-Q4_K_M.gguf",
558
+ "reason": "modelscope master has a different sha256/size"
559
+ },
560
+ "5f03b74ffe7513479795ca60a0fd8c40cbb3101769672b2c91b3df01138d9f6d": {
561
+ "repo": "neuralll/GLM-5.3-Flash-GSQ-RCO-3.0bit-Q4Kattn-GGUF",
562
+ "path": "GLM-5.3-Flash-GSQ-RCO-3.0bit-q4kattn.gguf",
563
+ "reason": "repo absent on modelscope"
564
+ },
565
+ "91a04445b42bcd7a99980b9eab3c3b66734efb17093f20d0b6c21a320a6e3218": {
566
+ "repo": "neuralll/GLM-5.3-Flash-GSQ-RCO-3.0bit-Q4Kattn-GGUF",
567
+ "path": "mtp/glm-5.3-flash/draft-block.gguf",
568
+ "reason": "repo absent on modelscope"
569
+ },
570
+ "3ecae346a732f093669d01389afa4f2c3a2cf5cc0642a4fc58e4cc2733050967": {
571
+ "repo": "unsloth/Qwen4-35B-A3B-GGUF",
572
+ "path": "UD-Q3_K_XL/Qwen4-35B-A3B-UD-Q3_K_XL-00001-of-00002.gguf",
573
+ "reason": "absent on modelscope master"
504
574
  }
505
575
  }
506
576
  }
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
 
6
6
  from typing import Any, cast
7
7
 
8
- from localmodels import windows_job
8
+ from localmodels import suite, windows_job
9
9
  from localmodels.engine_adapters.base import EngineAdapter
10
10
  from localmodels.plan_envelope import PlanError
11
11
  from localmodels.probe import HostFacts
@@ -81,10 +81,20 @@ class PolyStrataAdapter(StrataAdapter):
81
81
  # and maps parallel: 2 to --batch 2.
82
82
  profile.setdefault("warm_start", True)
83
83
  profile.setdefault("parallel", 2)
84
+ raw_args = profile.get("args")
85
+ if not isinstance(raw_args, list):
86
+ return
87
+ args = [str(item) for item in raw_args]
84
88
  if facts is not None and facts["platform"] == "darwin":
85
- raw_args = profile.get("args")
86
- if isinstance(raw_args, list):
87
- profile["args"] = _metal_unified_args([str(item) for item in raw_args])
89
+ args = _metal_unified_args(args)
90
+ if suite.sparse_kv(args):
91
+ # BasinKV / --kv-sparse own one shared hot slab: a batched profile would emit
92
+ # --batch >1 over it, so the sparse path is single-slot and drops the native --kv
93
+ # and --kv-resident flags the engine refuses beside it. card_args disable BasinKV
94
+ # (and raise `parallel`) on cards with room for native KV instead.
95
+ profile["parallel"] = 1
96
+ args = suite.drop_flags(args, suite.NATIVE_KV_VALUE_FLAGS)
97
+ profile["args"] = args
88
98
 
89
99
 
90
100
  def _metal_unified_args(args: list[str]) -> list[str]:
@@ -93,6 +103,9 @@ def _metal_unified_args(args: list[str]) -> list[str]:
93
103
  - Drop ``--ram-experts-mib``: unified memory has no separate host-RAM spill pool, so holding
94
104
  spilled experts in CPU RAM competes with Metal VRAM in the same pool and collapses expert
95
105
  residency.
106
+ - Drop ``--basinkv*``, ``--kv-sparse`` and ``--vram-pool``: BasinKV's pinned-host-RAM KV slab
107
+ and the CUDA VMM pool have no Metal build; Metal runs native FP16 KV, and leaving the flags
108
+ in the profile makes the Metal server refuse the serve profile.
96
109
  - Select ``--metal-memory legacy`` unless explicitly overridden: PolyStrata's default
97
110
  ``balanced`` policy budgets against pre-allocation free RAM (ignoring reclaimable macOS
98
111
  file cache), starving Metal expert residency on 24 GB Macs (~4.5 tok/s vs ~34 tok/s with
@@ -114,6 +127,9 @@ def _metal_unified_args(args: list[str]) -> list[str]:
114
127
  if token == "--metal-memory" or token.startswith("--metal-memory="):
115
128
  has_metal_memory = True
116
129
  cleaned.append(token)
130
+ cleaned = suite.drop_flags(
131
+ cleaned, ("--vram-pool", *suite.SPARSE_KV_FLAGS, *suite.SPARSE_KV_VALUE_FLAGS)
132
+ )
117
133
  if not has_metal_memory:
118
134
  cleaned.extend(["--metal-memory", "legacy"])
119
135
  return cleaned
@@ -193,12 +193,19 @@ def _profile_template(
193
193
  extra_args = [a for group in matched_card_args for a in group.get("args", ())]
194
194
  if extra_args:
195
195
  profile_template["args"] = [*cast("list[str]", profile_template["args"]), *extra_args]
196
+ profile_template["args"] = suite.apply_card_args(
197
+ cast("list[str]", profile_template.get("args") or []), matched_card_args
198
+ )
196
199
  if window and window != int(r.get("context") or 0) and "args" in profile_template:
197
200
  profile_template["args"] = _set_flag(
198
201
  cast("list[str]", profile_template["args"]), "--max-context", str(window)
199
202
  )
200
203
  if matched_card_args and any(group.get("parallel") for group in matched_card_args):
201
204
  profile_template["parallel"] = suite.effective_parallel(r, matched_card_args)
205
+ if facts["platform"] == "darwin" and (metal_parallel := r.get("metal_parallel")):
206
+ # A recipe whose CUDA tier is the offload one (parallel: 1, BasinKV's shared hot slab)
207
+ # still runs native Metal KV in parallel on Apple Silicon unified memory.
208
+ profile_template["parallel"] = int(metal_parallel)
202
209
  adapter.finish_profile(profile_template, options, facts)
203
210
  return profile_template
204
211
 
@@ -0,0 +1,132 @@
1
+ {
2
+ "schema": "localmodels.engine-lock/v1",
3
+ "tag": "strata-poly-0.2.20-poly.10",
4
+ "commit": "v0.2.20-poly.10",
5
+ "source": "https://github.com/simplexai-labs/PolyStrata/releases/tag/v0.2.20-poly.10",
6
+ "note": "PolyStrata 0.2.20-poly.10 (MIT, commit df2c3ff300, engine 0.1.66: ENGINE+VISION ba2ae79b8a, ENGINE_ONLY da0e075dee, VISION_ONLY ff10911c24) for CUDA 13 NVIDIA Linux/Windows and Apple Silicon macOS Metal recipes (Inkling 2 Mini, Qwen3.6, LFM2.5, Flint, Kolibri, Groot, Clover, Ornith, Gemma 4, Tiel, MiniCPM-V, GLM 5.3 Flash, DeepSeek V4 Flash). Adds full-platform Qwen4-35B-A3B (qwen4exp, upstream's --family qwen4) on strata-poly: qwen4 tiktoken tokenizer (248,320 vocab), compact thinking, reasoning effort, preserve_thinking, XML tool calling, vision and embedded MTP, opt-in BasinKV (--basinkv, off by default, upstream ships it off), a single-NUMA default CPU thread cap on multi-socket Linux (#428), and the Qwen4 --kv-resident >= 32K and 8 GB lent-prompt MTP fixes, over 0.2.20-poly.9's 128K+ VMM KV growth fix (#394), CUDA stream ordering on expert slot updates (#395), Engine::cover staging reclamation (#373) with VMM rollback, elastic vision reserve reading (#367, #368), Windows DXGI QueryVideoMemoryInfo VRAM guards with cuMemRelease dynamic shrink/rebound and the per-slot phase-aware watchdog, HTTP/1.1 keep-alive and binary token IPC, NVFP4/IQ3 CUDA kernel speedups (#384, #386), Apple Silicon Metal quantized KV (--kv fp8/q8_0/q4_0), native Metal inkling2v vision with zero-copy SHM IPC and Metal --batch concurrency, and Docker overlayfs spill-file fallback (#427). Linux: strata-poly and strata-vision from the release archive with NVIDIA CUDA 13.0.3 runtime libraries (libcublas, libcublasLt, libcudart) reused from 0.1.45-poly.9 under NVIDIA's licence; needs NVIDIA driver for CUDA 13.0 (580 or newer), glibc 2.34, and libstdc++ 12. macOS: arm64 Metal (macOS 15.0 or newer), shipping strata-poly, strata-vision (Metal GPU), and the 12 metal/ kernel sources plus metal/strata-quant-common.h that the engine compiles when it starts (native Metal qwen4.metal and dflash2.metal are new here). Windows: strata-poly.exe and strata-vision.exe (CUDA 13.0) paired with NVIDIA's cuBLAS 13.0.2.14 wheel (nvidia/cu13/bin/x86_64 on lib_dirs). On all three platforms the tag archive supplies PolyStrata's Python server and tokenizer tools under terminal/ (terminal/serve/, terminal/tools/, terminal/strata_control/, terminal/strata_cli/, terminal/data/expert-profile-glm.txt, and LICENSE).",
7
+ "builds": [
8
+ {
9
+ "platform": "linux",
10
+ "arch": "x64",
11
+ "backend": "cuda",
12
+ "min_cuda": "13.0",
13
+ "min_glibc": "2.34",
14
+ "binary": "strata-poly",
15
+ "assets": [
16
+ {
17
+ "name": "strata-poly-linux-x64-cuda13-ba2ae79b8a871167.tar.gz",
18
+ "url": "https://github.com/simplexai-labs/PolyStrata/releases/download/v0.2.20-poly.10/strata-poly-linux-x64-cuda13-ba2ae79b8a871167.tar.gz",
19
+ "sha256": "69a297b4cd44f4220faf582af410f9caf4d2f206c5daefffeb5054bb28362b8b",
20
+ "size_bytes": 91051204,
21
+ "npm_copy": {
22
+ "package": "@simplexai/engine-strata-poly-linux-x64-cuda13-ba2ae79b8a871167",
23
+ "version": "0.0.0-sha256-69a297b4cd44f422"
24
+ }
25
+ },
26
+ {
27
+ "name": "polystrata-0.2.20-poly.10-source.tar.gz",
28
+ "url": "https://github.com/simplexai-labs/PolyStrata/archive/refs/tags/v0.2.20-poly.10.tar.gz",
29
+ "sha256": "7c03844d66618f8f0bcd9d892e4cc423ca365d50635a76edfe796da8e68cddfc",
30
+ "size_bytes": 51191788,
31
+ "members": [
32
+ "terminal/serve/",
33
+ "terminal/tools/",
34
+ "terminal/strata_control/",
35
+ "terminal/strata_cli/",
36
+ "terminal/data/expert-profile-glm.txt",
37
+ "LICENSE"
38
+ ],
39
+ "npm_copy": {
40
+ "package": "@simplexai/engine-polystrata-0.2.20-poly.10-source",
41
+ "version": "0.0.0-sha256-7c03844d66618f8f"
42
+ }
43
+ },
44
+ {
45
+ "name": "cudart-strata-poly-linux-x64-cuda13.0.3.tar.gz",
46
+ "url": "https://releases.heylinger.com/cli/localmodels/engines/strata-poly/0.1.45-poly.9/cudart-strata-poly-linux-x64-cuda13.0.3.tar.gz",
47
+ "sha256": "189c3a9fb5fd5f87331ffcedf03d5469c2a9c91f46379299ee6ea277364f05d2",
48
+ "size_bytes": 422462968
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ "platform": "win32",
54
+ "arch": "x64",
55
+ "backend": "cuda",
56
+ "min_cuda": "13.0",
57
+ "binary": "strata-poly.exe",
58
+ "assets": [
59
+ {
60
+ "name": "strata-poly-windows-x64-ba2ae79b8a871167.zip",
61
+ "url": "https://github.com/simplexai-labs/PolyStrata/releases/download/v0.2.20-poly.10/strata-poly-windows-x64-ba2ae79b8a871167.zip",
62
+ "sha256": "3ed2d4f8dc88f79df1463c501801c6beba810071da4f5a6e63fc3d56982d5914",
63
+ "size_bytes": 90092451,
64
+ "npm_copy": {
65
+ "package": "@simplexai/engine-strata-poly-windows-x64-ba2ae79b8a871167",
66
+ "version": "0.0.0-sha256-3ed2d4f8dc88f79d"
67
+ }
68
+ },
69
+ {
70
+ "name": "polystrata-0.2.20-poly.10-source.tar.gz",
71
+ "url": "https://github.com/simplexai-labs/PolyStrata/archive/refs/tags/v0.2.20-poly.10.tar.gz",
72
+ "sha256": "7c03844d66618f8f0bcd9d892e4cc423ca365d50635a76edfe796da8e68cddfc",
73
+ "size_bytes": 51191788,
74
+ "members": [
75
+ "terminal/serve/",
76
+ "terminal/tools/",
77
+ "terminal/strata_control/",
78
+ "terminal/strata_cli/",
79
+ "terminal/data/expert-profile-glm.txt",
80
+ "LICENSE"
81
+ ],
82
+ "npm_copy": {
83
+ "package": "@simplexai/engine-polystrata-0.2.20-poly.10-source",
84
+ "version": "0.0.0-sha256-7c03844d66618f8f"
85
+ }
86
+ },
87
+ {
88
+ "name": "nvidia_cublas-13.0.2.14-py3-none-win_amd64.whl",
89
+ "url": "https://files.pythonhosted.org/packages/f3/91/bda39230b7a4c102bb724c21b50823efc63544490a885fea0b604911c0ab/nvidia_cublas-13.0.2.14-py3-none-win_amd64.whl",
90
+ "sha256": "5f7a90456b1392db60e28719547ba6e00696bfa81304b6887cf287f9edf2c1d7",
91
+ "size_bytes": 401887280
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "platform": "darwin",
97
+ "arch": "arm64",
98
+ "backend": "metal",
99
+ "binary": "strata-poly",
100
+ "assets": [
101
+ {
102
+ "name": "strata-poly-macos-arm64-ba2ae79b8a871167.tar.gz",
103
+ "url": "https://github.com/simplexai-labs/PolyStrata/releases/download/v0.2.20-poly.10/strata-poly-macos-arm64-ba2ae79b8a871167.tar.gz",
104
+ "sha256": "8fbcf85ea9579d1fe3b72f9574d00fefa5597735578718bbd30a79918f18275f",
105
+ "size_bytes": 1586637,
106
+ "npm_copy": {
107
+ "package": "@simplexai/engine-strata-poly-macos-arm64-ba2ae79b8a871167",
108
+ "version": "0.0.0-sha256-8fbcf85ea9579d1f"
109
+ }
110
+ },
111
+ {
112
+ "name": "polystrata-0.2.20-poly.10-source.tar.gz",
113
+ "url": "https://github.com/simplexai-labs/PolyStrata/archive/refs/tags/v0.2.20-poly.10.tar.gz",
114
+ "sha256": "7c03844d66618f8f0bcd9d892e4cc423ca365d50635a76edfe796da8e68cddfc",
115
+ "size_bytes": 51191788,
116
+ "members": [
117
+ "terminal/serve/",
118
+ "terminal/tools/",
119
+ "terminal/strata_control/",
120
+ "terminal/strata_cli/",
121
+ "terminal/data/expert-profile-glm.txt",
122
+ "LICENSE"
123
+ ],
124
+ "npm_copy": {
125
+ "package": "@simplexai/engine-polystrata-0.2.20-poly.10-source",
126
+ "version": "0.0.0-sha256-7c03844d66618f8f"
127
+ }
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ }