@simplexai/localmodels-linux-arm64 0.1.0-dev.104 → 0.1.0-dev.106

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 (85) hide show
  1. package/README.md +1 -1
  2. package/bootstrap.identity +1 -1
  3. package/bootstrap.sha256 +84 -82
  4. package/modules/localmodels/__init__.py +1 -1
  5. package/modules/localmodels/__main__.py +204 -86
  6. package/modules/localmodels/apple_sensors.py +23 -0
  7. package/modules/localmodels/approval.py +25 -2
  8. package/modules/localmodels/catalog.json +454 -31
  9. package/modules/localmodels/catalog.py +11 -0
  10. package/modules/localmodels/catalog_recipes.py +61 -3
  11. package/modules/localmodels/cli_help.py +10 -0
  12. package/modules/localmodels/cli_parser.py +313 -230
  13. package/modules/localmodels/component.py +20 -2
  14. package/modules/localmodels/custom_probe.py +4 -2
  15. package/modules/localmodels/deploy.py +11 -1
  16. package/modules/localmodels/engine_adapters/suite_plan.py +21 -21
  17. package/modules/localmodels/host_sensors.py +25 -2
  18. package/modules/localmodels/hosts.py +26 -5
  19. package/modules/localmodels/library_cli.py +34 -16
  20. package/modules/localmodels/library_custom.py +9 -1
  21. package/modules/localmodels/library_direct.py +41 -1
  22. package/modules/localmodels/library_jobs.py +23 -4
  23. package/modules/localmodels/library_model.py +146 -1
  24. package/modules/localmodels/library_order.py +175 -69
  25. package/modules/localmodels/library_poly.py +42 -11
  26. package/modules/localmodels/library_presentation.py +485 -0
  27. package/modules/localmodels/library_pricing.py +3 -1
  28. package/modules/localmodels/library_serve.py +208 -3
  29. package/modules/localmodels/library_state.py +47 -10
  30. package/modules/localmodels/library_status.py +29 -16
  31. package/modules/localmodels/llm_rank.py +9 -3
  32. package/modules/localmodels/plan_envelope.py +11 -2
  33. package/modules/localmodels/probe.py +34 -7
  34. package/modules/localmodels/quant_formats.py +9 -2
  35. package/modules/localmodels/records.py +19 -2
  36. package/modules/localmodels/remote_ops_verify.py +91 -24
  37. package/modules/localmodels/runtime_index.py +303 -0
  38. package/modules/localmodels/setup_inspection.py +22 -3
  39. package/modules/localmodels/sidecar_http.py +6 -2
  40. package/modules/localmodels/speech_cli.py +23 -17
  41. package/modules/localmodels/speech_jobs.py +4 -0
  42. package/modules/localmodels/speech_model.py +1 -1
  43. package/modules/localmodels/speech_serve.py +9 -2
  44. package/modules/localmodels/speech_server.py +3 -0
  45. package/modules/localmodels/stack_args.py +270 -139
  46. package/modules/localmodels/stack_auto.py +90 -5
  47. package/modules/localmodels/stack_cli.py +117 -116
  48. package/modules/localmodels/stack_compose.py +5 -1
  49. package/modules/localmodels/stack_debug.py +14 -4
  50. package/modules/localmodels/stack_down.py +2 -0
  51. package/modules/localmodels/stack_hardware.py +14 -12
  52. package/modules/localmodels/stack_mlx.py +8 -1
  53. package/modules/localmodels/stack_picks.py +19 -20
  54. package/modules/localmodels/stack_plan.py +3 -2
  55. package/modules/localmodels/stack_review.py +28 -7
  56. package/modules/localmodels/stack_suite.py +11 -9
  57. package/modules/localmodels/stack_up.py +2 -0
  58. package/modules/localmodels/stack_view.py +180 -35
  59. package/modules/localmodels/stack_view_demo.py +2 -0
  60. package/modules/localmodels/stack_view_gpu.py +36 -2
  61. package/modules/localmodels/stack_view_schema.py +26 -3
  62. package/modules/localmodels/stack_view_slots.py +3 -1
  63. package/modules/localmodels/stack_view_telemetry.py +90 -4
  64. package/modules/localmodels/stack_view_tick.py +246 -40
  65. package/modules/localmodels/stack_view_words.py +7 -0
  66. package/modules/localmodels/stack_whatif_html.py +9 -12
  67. package/modules/localmodels/suite.py +129 -2
  68. package/modules/localmodels/telemetry_math.py +458 -18
  69. package/modules/localmodels/transport.py +8 -1
  70. package/modules/localmodels/tts_cli.py +29 -25
  71. package/modules/localmodels/tts_jobs.py +5 -0
  72. package/modules/localmodels/tts_serve.py +9 -2
  73. package/modules/localmodels/tts_sidecar.py +3 -0
  74. package/modules/localmodels/web/whatif/app.js +1 -1
  75. package/modules/localmodels/web/whatif/sim.js +8 -14
  76. package/modules/localmodels/win_probe.py +89 -16
  77. package/modules/{simplex_localmodels-0.1.0.dev104.dist-info → simplex_localmodels-0.1.0.dev106.dist-info}/METADATA +1 -1
  78. package/modules/{simplex_localmodels-0.1.0.dev104.dist-info → simplex_localmodels-0.1.0.dev106.dist-info}/RECORD +80 -78
  79. package/package.json +1 -1
  80. package/tool.json +1 -1
  81. /package/modules/{simplex_localmodels-0.1.0.dev104.dist-info → simplex_localmodels-0.1.0.dev106.dist-info}/WHEEL +0 -0
  82. /package/modules/{simplex_localmodels-0.1.0.dev104.dist-info → simplex_localmodels-0.1.0.dev106.dist-info}/entry_points.txt +0 -0
  83. /package/modules/{simplex_localmodels-0.1.0.dev104.dist-info → simplex_localmodels-0.1.0.dev106.dist-info}/licenses/LICENSE +0 -0
  84. /package/modules/{simplex_localmodels-0.1.0.dev104.dist-info → simplex_localmodels-0.1.0.dev106.dist-info}/licenses/NOTICE +0 -0
  85. /package/modules/{simplex_localmodels-0.1.0.dev104.dist-info → simplex_localmodels-0.1.0.dev106.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
@@ -19,9 +19,10 @@ import subprocess
19
19
  from collections.abc import Sequence
20
20
  from dataclasses import dataclass, field
21
21
  from pathlib import Path
22
- from typing import TypedDict
22
+ from typing import TypedDict, cast
23
23
 
24
24
  from localmodels import catalog as cat
25
+ from localmodels import catalog_recipes, decode_calibration, gpu_specs
25
26
  from localmodels.contracts import decode
26
27
  from localmodels.engines import (
27
28
  EngineUnavailableError,
@@ -87,6 +88,7 @@ class CardArgs(TypedDict, total=False):
87
88
  platforms: list[str] # only on these (facts["platform"]); every platform when absent
88
89
  args: list[str]
89
90
  context: int # optional larger context window (--max-context and launch.window) on this card
91
+ parallel: int # optional higher slot concurrency (--batch / profile.parallel) on this card
90
92
 
91
93
 
92
94
  class SuiteRecipe(cat.ComponentRecipe, total=False):
@@ -138,7 +140,12 @@ class SuiteRecipe(cat.ComponentRecipe, total=False):
138
140
  parameters: str
139
141
  active_parameters: str
140
142
  moe: bool
141
- decode_fraction: float
143
+ library: bool # list candidate in library status without entering --llm auto
144
+ decode_fraction: float # active weight fraction per decoded token when full VRAM-resident
145
+ embd_table_bytes: int # host-RAM-resident embedding table bytes excluded from GPU weights
146
+ capabilities: list[str]
147
+ quant_fidelity: str
148
+ bits_per_weight: float
142
149
  # Optional KV geometry and Metal overhead for compositional Apple Silicon unified-memory pricing.
143
150
  full_layers: int
144
151
  swa_layers: int
@@ -265,6 +272,126 @@ def size_bytes(text: str) -> int:
265
272
  return int(float(text[:-1]) * units[text[-1]]) if text[-1] in units else int(text)
266
273
 
267
274
 
275
+ # Measured non-expert VRAM overhead (KV cache + compute buffers + CUDA context) for PolyStrata
276
+ # recipes when experts fit in VRAM: SP219 inkling-2-mini-q3-poly on 16 GB peaked at 14,498 MiB
277
+ # for 12.69 GiB of weights (~1.47 GiB overhead); 2 GiB keeps a conservative safety margin when
278
+ # the recipe does not declare an explicit measured ``vram_before_cache_mib``.
279
+ VRAM_NON_EXPERT_BYTES = 2 << 30
280
+
281
+
282
+ def poly_weight_bytes(r: SuiteRecipe) -> int:
283
+ """Total byte size of non-vision weight files in a suite recipe."""
284
+ return sum(int(f["size_bytes"]) for f in r["files"] if not f.get("vision"))
285
+
286
+
287
+ def matched_card_args(
288
+ facts: HostFacts, r: SuiteRecipe, gpu: GPU | None, vram_reserve_mib: int
289
+ ) -> list[CardArgs]:
290
+ """``card_args`` entries matching ``gpu``'s total/free room less ``vram_reserve_mib``."""
291
+ if not gpu or not r.get("card_args"):
292
+ return []
293
+ # Under --gpu-memory the reserve also holds what the share leaves out of the real card
294
+ # (stack_gpu_memory.LEFT_OUT, stack_suite.poly_reserve_mib), so the room is counted on it.
295
+ left_out = int(cast("dict[str, int]", gpu).get("share_left_out_bytes", 0))
296
+ reserve = vram_reserve_mib << 20
297
+ room = gpu["total_bytes"] + left_out - reserve
298
+ free_room = gpu["free_bytes"] + left_out - reserve
299
+ return [
300
+ group
301
+ for group in r["card_args"]
302
+ if room >= group["at_least_bytes"]
303
+ and free_room >= group.get("at_least_free_bytes", 0)
304
+ and facts["platform"] in group.get("platforms", [facts["platform"]])
305
+ ]
306
+
307
+
308
+ def effective_context(r: SuiteRecipe, matched: Sequence[CardArgs]) -> int:
309
+ base = int(r.get("context") or 0)
310
+ return max((base, *(int(group.get("context") or 0) for group in matched)), default=base)
311
+
312
+
313
+ def effective_parallel(r: SuiteRecipe, matched: Sequence[CardArgs]) -> int:
314
+ profile = r.get("profile")
315
+ default = 2 if r.get("runtime") == "strata-poly" else 1
316
+ base = (
317
+ int(str(profile.get("parallel") or default))
318
+ if isinstance(profile, dict) and profile.get("parallel") is not None
319
+ else default
320
+ )
321
+ return max((base, *(int(group.get("parallel") or 0) for group in matched)), default=base)
322
+
323
+
324
+ def poly_gpu_resident(
325
+ r: SuiteRecipe,
326
+ gpu: GPU | None,
327
+ *,
328
+ reserve_mib: int | None = None,
329
+ use_free: bool = False,
330
+ ) -> bool:
331
+ """True when a ``strata-poly`` recipe holds all routed experts in ``gpu`` VRAM without CPU
332
+ expert offloading (using measured ``vram_before_cache_mib`` when declared, else 2 GiB)."""
333
+ if r.get("runtime") != "strata-poly" or gpu is None:
334
+ return False
335
+ weight_bytes = poly_weight_bytes(r)
336
+ if weight_bytes <= 0:
337
+ return False
338
+ gpu_weights = max(0, weight_bytes - int(r.get("embd_table_bytes") or 0))
339
+ profile = r.get("profile")
340
+ raw_before = profile.get("vram_before_cache_mib") if isinstance(profile, dict) else None
341
+ non_expert = (
342
+ int(str(raw_before)) << 20
343
+ if isinstance(raw_before, int) and not isinstance(raw_before, bool) and raw_before > 0
344
+ else VRAM_NON_EXPERT_BYTES
345
+ )
346
+ reserve = (int(r.get("vram_reserve_mib") or 0) if reserve_mib is None else reserve_mib) << 20
347
+ avail = gpu["free_bytes"] if use_free else gpu["total_bytes"]
348
+ need = gpu_weights + non_expert + (0 if use_free else reserve)
349
+ return avail >= need
350
+
351
+
352
+ def strata_smart_tie(r: SuiteRecipe) -> float:
353
+ """Deterministic tie-breaker for Strata/PolyStrata recipes within an equal quality band.
354
+
355
+ Higher is better: ``prefer_over_llama`` recipes outrank non-preferred ones; within those,
356
+ higher ``quant_fidelity`` wins (so 24-48 GB GPUs stay on near-lossless Q4 over Q3); within
357
+ equal fidelity, smaller weight footprint wins (compact-first) instead of larger VRAM floor.
358
+ """
359
+ base = 1e9 if r.get("prefer_over_llama") else -1e9
360
+ f_rank = catalog_recipes.fidelity_rank(
361
+ str(r.get("quant_fidelity") or ""), str(r.get("version") or "")
362
+ )
363
+ fidelity_bonus = (len(catalog_recipes.QUANT_FIDELITIES) - 1 - f_rank) * 1e6
364
+ weight_gib = poly_weight_bytes(r) / (1 << 30)
365
+ return base + fidelity_bonus - weight_gib
366
+
367
+
368
+ def poly_decode_estimate(
369
+ r: SuiteRecipe, gpu: GPU | None, *, reserve_mib: int | None = None
370
+ ) -> cat.DecodeEstimate | None:
371
+ """Bandwidth-based decode tok/s estimate for a full-VRAM-resident ``strata-poly`` recipe.
372
+
373
+ Returns ``None`` for non-PolyStrata recipes, when ``decode_fraction`` is undeclared, or
374
+ whenever routed experts spill to host RAM (``not poly_gpu_resident``).
375
+ """
376
+ raw_df = r.get("decode_fraction")
377
+ if r.get("runtime") != "strata-poly" or gpu is None or raw_df is None:
378
+ return None
379
+ if not poly_gpu_resident(r, gpu, reserve_mib=reserve_mib):
380
+ return None
381
+ gpu_weights = max(0, poly_weight_bytes(r) - int(r.get("embd_table_bytes") or 0))
382
+ if gpu_weights <= 0:
383
+ return None
384
+ bytes_per_token = max(1.0, gpu_weights * float(raw_df))
385
+ spec_bw = gpu_specs.bandwidth_gb_s(gpu["name"])
386
+ if spec_bw:
387
+ basis, bandwidth = "gpu-spec", spec_bw
388
+ else:
389
+ basis, bandwidth = "discrete-class", 1000.0
390
+ return decode_calibration.DecodeEstimate(
391
+ bandwidth * 1e9 / bytes_per_token, basis, bandwidth, bytes_per_token
392
+ )
393
+
394
+
268
395
  def catalog_file(name: str) -> Path:
269
396
  return cat.CATALOG_PATH.parent / name
270
397