quantprobe 1.34.0__tar.gz → 1.35.1__tar.gz

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 (41) hide show
  1. {quantprobe-1.34.0/quantprobe.egg-info → quantprobe-1.35.1}/PKG-INFO +12 -1
  2. {quantprobe-1.34.0 → quantprobe-1.35.1}/README.md +11 -0
  3. {quantprobe-1.34.0 → quantprobe-1.35.1}/pyproject.toml +1 -1
  4. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/__init__.py +1 -1
  5. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/auto.py +64 -0
  6. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/cli.py +3 -1
  7. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/fetch.py +35 -0
  8. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes.py +40 -13
  9. {quantprobe-1.34.0 → quantprobe-1.35.1/quantprobe.egg-info}/PKG-INFO +12 -1
  10. {quantprobe-1.34.0 → quantprobe-1.35.1}/LICENSE +0 -0
  11. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/__main__.py +0 -0
  12. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/branding.py +0 -0
  13. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/calibrate.py +0 -0
  14. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/dashboard.py +0 -0
  15. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/detect.py +0 -0
  16. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/ollama.py +0 -0
  17. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/optimize.py +0 -0
  18. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/plan.py +0 -0
  19. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/probe.py +0 -0
  20. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/deepseek-v2-lite.json +0 -0
  21. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/mistral-7b.json +0 -0
  22. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/qwen2.5-7b.json +0 -0
  23. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/qwen3-30b.json +0 -0
  24. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/qwen3.5-35b.json +0 -0
  25. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/qwen3.5-4b.json +0 -0
  26. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/qwen3.6-35b.json +0 -0
  27. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/recipes/qwen3.8-27b.json +0 -0
  28. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/report.py +0 -0
  29. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/runtime.py +0 -0
  30. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/spec.py +0 -0
  31. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe/target.py +0 -0
  32. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe.egg-info/SOURCES.txt +0 -0
  33. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe.egg-info/dependency_links.txt +0 -0
  34. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe.egg-info/entry_points.txt +0 -0
  35. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe.egg-info/requires.txt +0 -0
  36. {quantprobe-1.34.0 → quantprobe-1.35.1}/quantprobe.egg-info/top_level.txt +0 -0
  37. {quantprobe-1.34.0 → quantprobe-1.35.1}/setup.cfg +0 -0
  38. {quantprobe-1.34.0 → quantprobe-1.35.1}/tests/test_engine.py +0 -0
  39. {quantprobe-1.34.0 → quantprobe-1.35.1}/tests/test_evaluator.py +0 -0
  40. {quantprobe-1.34.0 → quantprobe-1.35.1}/tests/test_pipeline.py +0 -0
  41. {quantprobe-1.34.0 → quantprobe-1.35.1}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.34.0
3
+ Version: 1.35.1
4
4
  Summary: Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, and emit ready-to-run llama.cpp recipes.
5
5
  Author: Federico Sciuca
6
6
  License: MIT
@@ -87,6 +87,17 @@ quantprobe auto
87
87
 
88
88
  Detects your machine, asks which model you want, picks the best quant for it, downloads it, and launches. No flags to learn.
89
89
 
90
+ Or skip straight to a model we already did the surgery on — the 35B whose depth-aware build loses
91
+ **29.2% less quality at byte-identical size** ([the numbers](#measured-results)):
92
+
93
+ ```bash
94
+ quantprobe fetch qwen3.6-35b ./models
95
+ ```
96
+
97
+ Every model in the [fragility atlas](quantprobe/recipes/) answers to its own name. Ask `auto` about
98
+ one and it tells you where that model breaks and what proved it, whether or not it can build it for
99
+ you.
100
+
90
101
  ## What it does
91
102
 
92
103
  One pipeline, end to end — most tools ship the first line only:
@@ -65,6 +65,17 @@ quantprobe auto
65
65
 
66
66
  Detects your machine, asks which model you want, picks the best quant for it, downloads it, and launches. No flags to learn.
67
67
 
68
+ Or skip straight to a model we already did the surgery on — the 35B whose depth-aware build loses
69
+ **29.2% less quality at byte-identical size** ([the numbers](#measured-results)):
70
+
71
+ ```bash
72
+ quantprobe fetch qwen3.6-35b ./models
73
+ ```
74
+
75
+ Every model in the [fragility atlas](quantprobe/recipes/) answers to its own name. Ask `auto` about
76
+ one and it tells you where that model breaks and what proved it, whether or not it can build it for
77
+ you.
78
+
68
79
  ## What it does
69
80
 
70
81
  One pipeline, end to end — most tools ship the first line only:
@@ -4,7 +4,7 @@ requires = [ "setuptools>=68" ]
4
4
 
5
5
  [project]
6
6
  name = "quantprobe"
7
- version = "1.34.0"
7
+ version = "1.35.1"
8
8
  description = """\
9
9
  Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, \
10
10
  and emit ready-to-run llama.cpp recipes.\
@@ -9,4 +9,4 @@ Every constant in `plan` is fitted from measurements published in the repo, incl
9
9
  pre-registered hardware predictions confirmed within 8%.
10
10
  """
11
11
 
12
- __version__ = "1.34.0"
12
+ __version__ = "1.35.1"
@@ -222,6 +222,24 @@ def _wizard(a):
222
222
  ModelSpec = namedtuple("ModelSpec", "repo total active always_active moe n_layer")
223
223
 
224
224
 
225
+ def atlas_lines(rec):
226
+ """The two facts a measured recipe carries: where the fragile band is, and what proved it.
227
+
228
+ `auto`'s preset table and the measured recipe atlas grew as separate lists, so the command
229
+ that spends the hours never asked whether the answer was already recorded. Both callers below
230
+ print these; keeping the wording in one place stops the two paths from drifting apart."""
231
+ from . import recipes as recmod
232
+
233
+ lo, hi = rec["probe"]["fragile_band"]
234
+ return [
235
+ (
236
+ f" fragile band: layers {lo}-{hi} ({rec['probe']['shape']}-fragile, "
237
+ f"{rec['probe']['fragility_ratio']}x the median band)"
238
+ ),
239
+ f" evidence: {recmod.evidence_url(rec)}",
240
+ ]
241
+
242
+
225
243
  def resolve_model(a, target):
226
244
  """Resolve the model once: preset if we know it, explicit parameters otherwise."""
227
245
  if target in MODEL_REPOS:
@@ -229,6 +247,32 @@ def resolve_model(a, target):
229
247
  else:
230
248
  repo = target
231
249
  if not getattr(a, "total", None):
250
+ # Before refusing: is this a model we have MEASURED? The fragility atlas and the
251
+ # `auto` preset table are separate lists, so `auto qwen3.6-35b` used to dead-end on
252
+ # the one model we published a build of - the exact name someone arrives with after
253
+ # reading its HuggingFace card. A recipe cannot drive `auto` (it carries no fetchable
254
+ # high-precision source repo), but answering "not a preset" while holding a measured
255
+ # band and a finished GGUF is the tool withholding what it knows.
256
+ from . import recipes as recmod
257
+
258
+ rec = recmod.find(key=target)
259
+ if rec:
260
+ msg = [
261
+ f"'{target}' is not an `auto` preset - but quantprobe HAS MEASURED it.",
262
+ "",
263
+ *atlas_lines(rec),
264
+ ]
265
+ built = recmod.prebuilt_notice(rec)
266
+ if built:
267
+ msg += ["", built.replace("[quantprobe] ", " ")]
268
+ msg += [
269
+ "",
270
+ " build it yourself from a high-precision source (f16/bf16/Q8_0):",
271
+ f" quantprobe quantize --gguf <source.gguf> --recipe {target}",
272
+ "",
273
+ " `auto` needs a fetchable source repo, which this recipe does not carry yet.",
274
+ ]
275
+ raise SystemExit("\n".join(msg))
232
276
  raise SystemExit(
233
277
  f"'{target}' is not a preset ({', '.join(MODEL_REPOS)}) - for a raw HF "
234
278
  "repo also pass --total (B params) and, for MoE, --active/--always-active"
@@ -423,6 +467,26 @@ def run(a):
423
467
  if getattr(a, "no_imatrix", False)
424
468
  else "calibrate (importance matrix)"
425
469
  )
470
+ # Say this BEFORE the hours, not after them. A preset can also be a model we already
471
+ # probed, and re-deriving a band that is sitting in our own repo is the most expensive
472
+ # thing this command can silently do.
473
+ from . import recipes as recmod
474
+
475
+ known = recmod.find(key=target)
476
+ if known:
477
+ print(f"\n[quantprobe auto --custom] the atlas ALREADY has a band for '{target}':")
478
+ for ln in atlas_lines(known):
479
+ print(ln)
480
+ print(" skip the probe below and build straight from it (minutes, not hours):")
481
+ # The path the fetch below will actually produce, not the bare repo filename - a
482
+ # command the user cannot paste yet is worse than no command.
483
+ print(
484
+ f" quantprobe quantize --gguf "
485
+ f"{os.path.join(dest, os.path.basename(spath))} --recipe {target}"
486
+ )
487
+ print(" Continuing re-measures it on YOUR file, which is the right call if your")
488
+ print(" source differs from the one above: the band is a property of the weights,")
489
+ print(" not of the name. If it is the same source, you are paying twice.\n")
426
490
  print(f" pipeline: fetch source -> probe the fragile band -> {cal} -> build the")
427
491
  print(" depth-aware GGUF. Each stage prints its own time estimate before it starts;")
428
492
  print(" on a large source this is HOURS, not minutes. Interrupt anytime; fetch resumes.")
@@ -375,7 +375,9 @@ def main():
375
375
  f = sub.add_parser("fetch", help="robust HF download (Range-resume, retry)")
376
376
  f.add_argument(
377
377
  "repo",
378
- help="HF repo, or a preset: qwen3-30b, glm-air, deepseek-16b, qwen3-0.6b",
378
+ help="HF repo, a fetch preset (qwen3-30b, glm-air, deepseek-16b, qwen3-0.6b), an `auto` "
379
+ "preset, or a recipe key with a published build (e.g. qwen3.6-35b) - listing them by "
380
+ "hand is how the four vocabularies drifted apart, so `fetch` now resolves all of them",
379
381
  )
380
382
  f.add_argument("dest")
381
383
  f.add_argument("files", nargs="*")
@@ -112,6 +112,27 @@ def fetch(repo, dest, fname, tok, tries=100, force=False):
112
112
  return False
113
113
 
114
114
 
115
+ def resolve_alias(name):
116
+ """Turn a bare model name into (repo, file, why) using every list we have, not just ours.
117
+
118
+ `fetch`, `auto` and the recipe atlas each grew their own vocabulary, so a name that works in
119
+ one command used to fail in another - worst of all for a recipe we PUBLISHED A BUILD OF,
120
+ where the file is sitting on HuggingFace and we were the only thing standing between the
121
+ user and it. Returns file=None when we know the repo but not which quant to take."""
122
+ from . import recipes as recmod
123
+
124
+ rec = recmod.find(key=name)
125
+ if rec:
126
+ art = recmod.artifact(rec)
127
+ if art and art.get("repo") and art.get("file"):
128
+ return art["repo"], art["file"], "published depth-aware build"
129
+ from .auto import MODEL_REPOS
130
+
131
+ if name in MODEL_REPOS:
132
+ return MODEL_REPOS[name][0], None, "`auto` preset"
133
+ return None, None, None
134
+
135
+
115
136
  def run(a):
116
137
  import sys as _s
117
138
 
@@ -120,6 +141,20 @@ def run(a):
120
141
  repo, f = PRESETS[repo]
121
142
  files = [f]
122
143
  print(f"[quantprobe] preset '{a.repo}' -> {repo}/{f}")
144
+ elif not files:
145
+ alias, afile, why = resolve_alias(repo)
146
+ if alias and afile:
147
+ print(f"[quantprobe] '{repo}' -> {alias}/{afile} ({why})")
148
+ repo, files = alias, [afile]
149
+ elif alias:
150
+ # We know WHERE it lives but not which quant is right for this box - and picking
151
+ # that is `auto`'s whole job, so hand off instead of guessing a file.
152
+ _s.exit(
153
+ f"'{repo}' is an {why} -> {alias}, but `fetch` needs a filename and the right\n"
154
+ f"quant depends on your hardware. Either:\n"
155
+ f" quantprobe auto {repo} # picks the file your machine can run\n"
156
+ f" quantprobe fetch {alias} {a.dest} <name.gguf>"
157
+ )
123
158
  if not files:
124
159
  _s.exit("no files given (or use a preset: " + ", ".join(PRESETS) + ")")
125
160
  ok = all(fetch(repo, a.dest, fn, token(), force=getattr(a, "force", False)) for fn in files)
@@ -16,6 +16,7 @@ from __future__ import annotations
16
16
  import glob
17
17
  import json
18
18
  import os
19
+ import re
19
20
 
20
21
 
21
22
  def _dir():
@@ -54,6 +55,33 @@ def find(key=None, arch=None, n_layer=None):
54
55
  return None
55
56
 
56
57
 
58
+ def _repo_from_url(url):
59
+ """`https://huggingface.co/Owner/Name` -> `Owner/Name`, or None if it isn't an HF model URL.
60
+
61
+ A published artifact URL is the only place a recipe records where its build lives, so this
62
+ is what makes `fetch <recipe-key>` able to download it rather than merely name it."""
63
+ if not url:
64
+ return None
65
+ m = re.match(r"https?://(?:www\.)?huggingface\.co/([^/\s]+/[^/\s?#]+)", url)
66
+ return m.group(1) if m else None
67
+
68
+
69
+ REPO_URL = "https://github.com/FedericoTs/quantprobe/blob/master/"
70
+
71
+
72
+ def evidence_url(r):
73
+ """The raw log that proves this recipe, as something the reader can actually open.
74
+
75
+ The module docstring says a recipe you cannot check is a recipe you should not use - but the
76
+ stored path is repo-relative, so for anyone who arrived through `pip install` the citation
77
+ named a file they do not have. Every recipe's log is committed on master (checked before this
78
+ was added); a path that resolves nowhere would be worse than no citation at all."""
79
+ p = (r.get("provenance") or {}).get("raw_log")
80
+ if not p or "://" in p:
81
+ return p
82
+ return REPO_URL + p.replace("\\", "/").lstrip("./")
83
+
84
+
57
85
  def artifact(r):
58
86
  """The prebuilt file for this recipe, if someone already built and published it.
59
87
 
@@ -64,21 +92,20 @@ def artifact(r):
64
92
  if not a:
65
93
  return None
66
94
  if isinstance(a, str):
67
- import re
68
-
69
95
  m = re.search(r"https?://\S+", a)
70
- return (
71
- {
72
- "url": m.group(0).rstrip(".,)") if m else None,
73
- "file": None,
74
- "bytes": None,
75
- "note": a,
76
- }
77
- if m
78
- else None
79
- )
96
+ if not m:
97
+ return None
98
+ url = m.group(0).rstrip(".,)")
99
+ return {
100
+ "url": url,
101
+ "repo": _repo_from_url(url),
102
+ "file": None,
103
+ "bytes": None,
104
+ "note": a,
105
+ }
80
106
  return {
81
107
  "url": a.get("url"),
108
+ "repo": a.get("repo") or _repo_from_url(a.get("url")),
82
109
  "file": a.get("file"),
83
110
  "bytes": a.get("bytes"),
84
111
  "note": a.get("note", ""),
@@ -115,7 +142,7 @@ def describe(r):
115
142
  f"fragile band layers {lo}-{hi} ({p['shape']}-fragile, {p['fragility_ratio']}x "
116
143
  f"the median band)\n"
117
144
  f" measured {pr['measured']} on {pr['hardware']}, eval {pr['eval']}\n"
118
- f" evidence: {pr['raw_log']}"
145
+ f" evidence: {evidence_url(r)}"
119
146
  )
120
147
  a = artifact(r)
121
148
  if a and a["url"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.34.0
3
+ Version: 1.35.1
4
4
  Summary: Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, and emit ready-to-run llama.cpp recipes.
5
5
  Author: Federico Sciuca
6
6
  License: MIT
@@ -87,6 +87,17 @@ quantprobe auto
87
87
 
88
88
  Detects your machine, asks which model you want, picks the best quant for it, downloads it, and launches. No flags to learn.
89
89
 
90
+ Or skip straight to a model we already did the surgery on — the 35B whose depth-aware build loses
91
+ **29.2% less quality at byte-identical size** ([the numbers](#measured-results)):
92
+
93
+ ```bash
94
+ quantprobe fetch qwen3.6-35b ./models
95
+ ```
96
+
97
+ Every model in the [fragility atlas](quantprobe/recipes/) answers to its own name. Ask `auto` about
98
+ one and it tells you where that model breaks and what proved it, whether or not it can build it for
99
+ you.
100
+
90
101
  ## What it does
91
102
 
92
103
  One pipeline, end to end — most tools ship the first line only:
File without changes
File without changes