mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-04 23:38:47 +00:00
setup: the DSpark drafter of a GGUF build is the original mtp.safetensors, Unsloth's pinned Q8_0 file is the fallback
Unsloth re-uploaded its drafter in another layout on 2026-11-23, and setup depended on that one file name. The original checkpoint is public
(thinkingmachines/Inkling-2-Mini, Apache-2.0, not gated: anonymous curl, HTTP 206 on a ranged GET, no token), unchanged since the upload commit
1fb4134b9a74f9681054f4ef82e4bf1f458a2337 (later commits only touch README / config).
inkling_family: MTP_FILE / MTP_BASE (the commit URL) / DRAFTER_FILES (635,801,416 bytes, sha256 7c3b6513...a1d2), drafter_sources (config
inkling_drafter_source, env STRATA_INKLING_DRAFTER_SOURCE, STRATA_INKLING_SOURCE mirror, then the pinned repository); size_of / sha256_of / pins_for know it.
setup.inkling_fetch_drafter: an install that already has a complete drafter keeps it (no second download); otherwise mtp.safetensors (636 MB, the size
is printed), and when it cannot be fetched or does not check out, Unsloth's pinned dspark-Inkling-2-Mini-Q8_0.gguf (402 MB) with a warning, without
a "Setup stopped" or an error event. inkling_find_local_dspark prefers a local mtp.safetensors over a dspark*.gguf (which may be the new layout).
The planner's drafter file size is 0.636 GB (unified-memory fit, disk, download size).
Measured 2026-11-23 on an RTX A6000 (CUDA 12.8, UD-Q4_K_XL, same engine, 2 rounds, chain and tree unchanged): the original and Unsloth's old Q8_0 drafter
give the same acceptance (tokens per step code 3.6 / 3.6, edit 5.6 / 5.6, chat 1.9 / 1.9, json 3.7 / 3.6, count 5.7 / 5.7, tool 4.6 / 4.6, doc4k 2.6 / 2.8)
and the same speed within noise (x off: code 1.27 / 1.29, edit 1.85 / 1.88, chat 0.93 / 0.94, count 2.17 / 2.15). Both take 416 MiB on the card ("DSpark took
416 MiB" with either, free memory after load identical to the MiB): the engine holds the matrices as BF16 in both cases, so the card size does not decide.
Tensor by tensor against the original: Unsloth's Q8_0 file is bit-equal in every F32 / BF16 tensor and 0.55 percent relative RMS in the 2-D matrices.
This commit is contained in:
1 parent
5abcc79a90
commit
2ace54dc05
6 files changed
+128
-17
No files matched your search
+3
-4
@@ -272,7 +272,7 @@ drafting and picture reading (`Inkling-2-Mini-Vision.strata`, 0.64 GB).
|
||||
| **SQ-15** | 14.3 GB | 16 GB GPU, 24 GB Mac, or 12 GB hybrid | flagship quality |
|
||||
| **SQ-20** | 19.3 GB | 24 GB GPU or 32+ GB unified | near-lossless native SF4+MX8 build |
|
||||
|
||||
**Unsloth Dynamic GGUF builds** ([unsloth/Inkling-2-Mini-GGUF](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF), plus 0.40 GB companion DSpark drafter)
|
||||
**Unsloth Dynamic GGUF builds** ([unsloth/Inkling-2-Mini-GGUF](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF), plus a 0.40 to 0.64 GB companion DSpark drafter)
|
||||
|
||||
| Range | File sizes | Typical hardware |
|
||||
| --- | ---: | --- |
|
||||
@@ -284,9 +284,8 @@ drafting and picture reading (`Inkling-2-Mini-Vision.strata`, 0.64 GB).
|
||||
strata launch --family inkling-2-mini --model SQ-15
|
||||
```
|
||||
|
||||
**The DSpark drafter (speculative drafting)** is optional and off unless you turn it on: `strata launch ... --drafting dspark` (back off with `--drafting off`).
|
||||
It is one small model (the original `mtp.safetensors`; the Unsloth `dspark-...-Q8_0.gguf` and the copy inside the SQ builds are the same weights) that
|
||||
guesses a few tokens ahead; the big model then checks them in one pass. Measured on RTX 3090 / A6000 / 5090 class cards with the whole model in VRAM:
|
||||
**The DSpark drafter (speculative drafting)** is decided by a measurement on your computer: at the first start of a placement Strata runs a short speed test with and without it and keeps it on only where it is at least 10 percent faster on a mix of code and chat (`strata launch ... --drafting dspark` always turns it on, `--drafting off` always off).
|
||||
It is one small model: the original `mtp.safetensors` of Thinking Machines (636 MB, BF16; downloaded for the GGUF builds, pinned by commit and checksum), with Unsloth's 402 MB Q8_0 copy of the same weights (`dspark-...-Q8_0.gguf`, the version before 2026-11-23) as the fallback; the copy inside the SQ builds is the same checkpoint too. It guesses a few tokens ahead; the big model then checks them in one pass. Measured on RTX 3090 / A6000 / 5090 class cards with the whole model in VRAM:
|
||||
code, code edits, JSON, tool calls and repeated text come out 1.2x to 2.4x faster; chat and prose are 3 to 17 percent slower; summaries of long documents
|
||||
are about even. On cards that keep experts in RAM and decode slowly (about 8 tokens per second or less) it is 1.5x to 4x faster on everything. It needs
|
||||
a few hundred MB of video memory on a card that is already full (it takes a little expert space; up to 1 GB when the card has room), and its answers can differ from plain decoding after a few dozen tokens (the checking pass uses different arithmetic).
|
||||
|
||||
+41
-8
@@ -10424,12 +10424,12 @@ def inkling_find_local_dspark(folder: Path) -> Path | None:
|
||||
for base in (folder, folder / "dspark"):
|
||||
if not base.is_dir():
|
||||
continue
|
||||
mtp = base / "mtp.safetensors" # the original checkpoint first: a dspark*.gguf may be Unsloth's newer layout, which this engine cannot read
|
||||
if mtp.is_file():
|
||||
return mtp
|
||||
ggufs = sorted(p for p in base.glob("dspark*.gguf") if p.is_file())
|
||||
if ggufs:
|
||||
return ggufs[0]
|
||||
mtp = base / "mtp.safetensors"
|
||||
if mtp.is_file():
|
||||
return mtp
|
||||
return None
|
||||
|
||||
|
||||
@@ -10553,6 +10553,36 @@ def inkling_fetch(a, name: str, folder: Path, own: bool) -> Path:
|
||||
fail(f"no source lists {name}")
|
||||
|
||||
|
||||
def inkling_fetch_drafter(a, folder: Path, own: bool) -> Path | None:
|
||||
"""The DSpark drafter of a downloaded GGUF build. An install that already holds a complete drafter keeps it (no second download).
|
||||
Otherwise the original checkpoint of Thinking Machines (mtp.safetensors, BF16, 636 MB, pinned commit + SHA-256) is fetched, and when that
|
||||
cannot be fetched or does not check out, Unsloth's pinned Q8_0 file (402 MB, the same weights). Both take the same memory on the card
|
||||
(measured: DSpark took 416 MiB with either; the engine holds the matrices as BF16 in both cases), so the card size does not matter."""
|
||||
names = [inkling_family.MTP_FILE, inkling_family.DSPARK_GGUF_FILE]
|
||||
for n in names:
|
||||
if inkling_have(a, folder / n):
|
||||
ok(f"drafter: DSpark ({n}) already downloaded")
|
||||
inkling_verify(folder / n, n, own)
|
||||
return folder / n
|
||||
what = {inkling_family.MTP_FILE: "the original checkpoint (BF16, from Thinking Machines' repository)",
|
||||
inkling_family.DSPARK_GGUF_FILE: "Unsloth's Q8_0 copy of the same checkpoint"}
|
||||
global fail
|
||||
real_fail = fail
|
||||
|
||||
def soft_fail(msg, hint=None, **detail): # a failed first try is not the end of setup: no "Setup stopped", no error event
|
||||
warn(f"{msg}" + (f" ({hint})" if hint else ""))
|
||||
sys.exit(1)
|
||||
say(f" drafter: DSpark, {what[names[0]]}: {names[0]} ({inkling_family.size_of(names[0]) / 1e6:.0f} MB)")
|
||||
fail = soft_fail
|
||||
try:
|
||||
return inkling_fetch(a, names[0], folder, own)
|
||||
except SystemExit:
|
||||
warn(f"{names[0]} could not be fetched; using {what[names[1]]}: {names[1]} ({inkling_family.size_of(names[1]) / 1e6:.0f} MB)")
|
||||
finally:
|
||||
fail = real_fail
|
||||
return inkling_fetch(a, names[1], folder, own)
|
||||
|
||||
|
||||
def inkling_tokenizer_dir(a, model: Path, folder: Path, out: Path, engine: Path | None, own: bool, *, data: Path | None = None) -> Path | None:
|
||||
"""Build serve's o200k tokenizer directory from Section 0 manifest, --export-tokenizer, companion files, or public HF fallback."""
|
||||
sys.path.insert(0, str(ROOT / "tools"))
|
||||
@@ -10690,13 +10720,16 @@ def install_inkling2(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopte
|
||||
ok(f"drafter: DSpark ({dspark_path.name})")
|
||||
else:
|
||||
ok("images: " + ("on (Inkling-2-Mini-Vision.strata, 0.64 GB lossless BF16)" if vision else "off"))
|
||||
files = inkling_family.files_of(model, vision, dspark=want_dspark)
|
||||
files = inkling_family.files_of(model, vision, dspark=False)
|
||||
left = 0.0
|
||||
for n in files:
|
||||
drafter = []
|
||||
if is_gguf and want_dspark and not any(inkling_have(a, folder / d) for d in (inkling_family.MTP_FILE, inkling_family.DSPARK_GGUF_FILE)):
|
||||
drafter = [inkling_family.MTP_FILE]
|
||||
for n in files + drafter:
|
||||
p = folder / n
|
||||
if not inkling_have(a, p):
|
||||
part = p.with_name(p.name + ".part")
|
||||
left += (inkling_family.FILES[n][0] - (part.stat().st_size if part.is_file() else 0)) / 1e9
|
||||
left += (inkling_family.size_of(n) - (part.stat().st_size if part.is_file() else 0)) / 1e9
|
||||
if left and free_gb(folder) < left:
|
||||
fail(f"not enough free disk space in {folder}: need ~{left:.1f} GB, {free_gb(folder):.1f} GB free",
|
||||
("use --data-dir on a bigger drive (strata launch --data-dir)" if CONTROL else "use --models-dir on a bigger drive"))
|
||||
@@ -10719,11 +10752,11 @@ def install_inkling2(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopte
|
||||
ok(f"model file: {model_file}")
|
||||
else:
|
||||
step(5, f"downloading {fam['title']} {model}")
|
||||
files = inkling_family.files_of(model, vision, dspark=want_dspark)
|
||||
files = inkling_family.files_of(model, vision, dspark=False)
|
||||
paths = {n: inkling_fetch(a, n, folder, own) for n in files}
|
||||
model_file = paths[files[0]]
|
||||
vision_path = paths.get(inkling_family.VISION_FILE) if vision else None
|
||||
dspark_path = paths.get(inkling_family.DSPARK_GGUF_FILE) if (is_gguf and want_dspark) else None
|
||||
dspark_path = inkling_fetch_drafter(a, folder, own) if (is_gguf and want_dspark) else None
|
||||
if dspark_path is not None:
|
||||
ok(f"drafter: DSpark ({dspark_path.name})")
|
||||
ok(f"model file: {model_file}")
|
||||
|
||||
@@ -77,6 +77,16 @@ FILES = {
|
||||
VISION_FILE: (636_526_592, "6589eff47f9c20bc3a032faa3d449f10bf4f04a84cc6b2ee8a44d51d2b6fc677"),
|
||||
**UNSLOTH_GGUF_FILES,
|
||||
}
|
||||
#: The drafter of a GGUF build: the ORIGINAL checkpoint file of Thinking Machines (Apache-2.0, not gated, anonymous download), pinned to the commit of the
|
||||
#: upload (later commits only touch README / config). BF16, 635,801,416 bytes. Measured 2026-11-23 (0221-DSPARK): the same tensors as Unsloth's old Q8_0 drafter
|
||||
#: (every F32/BF16 tensor bit for bit; the 2-D matrices 0.55 percent relative RMS from Q8_0), the engine reads it beside any GGUF. Unsloth's pinned Q8_0 file
|
||||
#: (DSPARK_GGUF_FILE, 402 MB) is the fallback when this one cannot be fetched and the file kept by an install that already has it.
|
||||
MTP_FILE = "mtp.safetensors"
|
||||
MTP_COMMIT = "1fb4134b9a74f9681054f4ef82e4bf1f458a2337"
|
||||
MTP_BASE = f"https://huggingface.co/thinkingmachines/Inkling-2-Mini/resolve/{MTP_COMMIT}"
|
||||
DRAFTER_FILES = {
|
||||
MTP_FILE: (635_801_416, "7c3b651317f01f73bcf4e1dceba66ef8b7e1a1eac6bc171e882e690a4b10a1d2"),
|
||||
}
|
||||
#: Auxiliary tokenizer files hosted beside the `.strata` weights (Section 0 embeds chat_template + config; tokenizer.json holds the 200K o200k BPE vocab/merges).
|
||||
TOKENIZER_FILES = {
|
||||
TOKENIZER_FILE: (26_178_678, None),
|
||||
@@ -138,7 +148,7 @@ ALT_GGUF_FILES = {
|
||||
def pins_for(name: str) -> list[tuple[int, str | None]]:
|
||||
"""Every (bytes, sha256) a file of this name may have: the pinned one first, then the re-uploaded layout for the main GGUFs."""
|
||||
out = []
|
||||
got = FILES.get(name) or TOKENIZER_FILES.get(name)
|
||||
got = FILES.get(name) or TOKENIZER_FILES.get(name) or DRAFTER_FILES.get(name)
|
||||
if got:
|
||||
out.append(got)
|
||||
if name in ALT_GGUF_FILES:
|
||||
@@ -147,12 +157,12 @@ def pins_for(name: str) -> list[tuple[int, str | None]]:
|
||||
|
||||
|
||||
def size_of(name: str) -> int | None:
|
||||
got = FILES.get(name) or TOKENIZER_FILES.get(name)
|
||||
got = FILES.get(name) or TOKENIZER_FILES.get(name) or DRAFTER_FILES.get(name)
|
||||
return got[0] if got else None
|
||||
|
||||
|
||||
def sha256_of(name: str) -> str | None:
|
||||
got = FILES.get(name) or TOKENIZER_FILES.get(name)
|
||||
got = FILES.get(name) or TOKENIZER_FILES.get(name) or DRAFTER_FILES.get(name)
|
||||
return got[1] if got else None
|
||||
|
||||
|
||||
@@ -201,8 +211,24 @@ def gguf_sources(env: dict | None = None, cfg: dict | None = None, shipped: Path
|
||||
return out
|
||||
|
||||
|
||||
DRAFTER_SOURCE_ENV = "STRATA_INKLING_DRAFTER_SOURCE"
|
||||
|
||||
|
||||
def drafter_sources(env: dict | None = None, cfg: dict | None = None) -> list[dict]:
|
||||
"""Download sources for mtp.safetensors: config inkling_drafter_source, env STRATA_INKLING_DRAFTER_SOURCE, STRATA_INKLING_SOURCE, then the pinned original repository."""
|
||||
env = os.environ if env is None else env
|
||||
out = _normalise((cfg or {}).get("inkling_drafter_source"))
|
||||
if env.get(DRAFTER_SOURCE_ENV):
|
||||
out += _normalise(env[DRAFTER_SOURCE_ENV])
|
||||
if env.get(SOURCE_ENV): # a local mirror of everything (tests, offline installs)
|
||||
out += _normalise(env[SOURCE_ENV])
|
||||
return out + [{"kind": "http", "base": MTP_BASE, "files": {}}]
|
||||
|
||||
|
||||
def sources_for(name: str, env: dict | None = None, cfg: dict | None = None, shipped: Path | None = None) -> list[dict]:
|
||||
"""Return the prioritized download sources for `name` (Unsloth GGUF repo for GGUF files, Strata repo for .strata/tokenizer)."""
|
||||
if name in DRAFTER_FILES:
|
||||
return drafter_sources(env=env, cfg=cfg)
|
||||
if name in UNSLOTH_GGUF_FILES or str(name).lower().endswith(".gguf"):
|
||||
return gguf_sources(env=env, cfg=cfg, shipped=shipped)
|
||||
return sources(env=env, cfg=cfg, shipped=shipped)
|
||||
|
||||
@@ -36,7 +36,7 @@ FREE_RAM_MARGIN_GB = 1.50 # free RAM that stays free beside the experts h
|
||||
UMA_RESERVE_GB = 5.00 # unified memory OS + driver reserve
|
||||
SSD_NEAR_RESIDENT_GB = 2.0
|
||||
VISION_GB = 0.637 # Inkling-2-Mini-Vision.strata (636,526,592 B, CPU / on-demand on <=12 GiB GPUs)
|
||||
DSPARK_GGUF_GB = 0.402 # dspark-Inkling-2-Mini-Q8_0.gguf (402,278,560 B)
|
||||
DSPARK_GGUF_GB = 0.636 # the drafter file of a GGUF build: mtp.safetensors (635,801,416 B, BF16, the default); Unsloth's Q8_0 copy is 0.402 GB (small cards, fallback)
|
||||
DEFAULT_CONTEXT = 32768 # docs/10-GUI-TUI.md default: 32K (up to 1M available)
|
||||
CONTEXTS = [8192, 32768, 65536, 131072, 262144]
|
||||
MAX_CONTEXT = 1048576
|
||||
|
||||
@@ -75,6 +75,58 @@ class GgufPin(unittest.TestCase):
|
||||
with self.assertRaises(SystemExit):
|
||||
setup.inkling_verify(bad, "X.gguf", False)
|
||||
|
||||
def test_the_drafter_is_the_original_checkpoint_pinned_by_commit(self):
|
||||
# thinkingmachines/Inkling-2-Mini mtp.safetensors: Apache-2.0, not gated; the upload commit (later commits only touch README / config)
|
||||
self.assertEqual(F.DRAFTER_FILES[F.MTP_FILE], (635_801_416, "7c3b651317f01f73bcf4e1dceba66ef8b7e1a1eac6bc171e882e690a4b10a1d2"))
|
||||
self.assertEqual(F.pins_for(F.MTP_FILE), [F.DRAFTER_FILES[F.MTP_FILE]])
|
||||
src = F.sources_for(F.MTP_FILE, env={})
|
||||
self.assertEqual(F.urls_for(F.MTP_FILE, src[0]),
|
||||
["https://huggingface.co/thinkingmachines/Inkling-2-Mini/resolve/1fb4134b9a74f9681054f4ef82e4bf1f458a2337/mtp.safetensors"])
|
||||
env = {F.DRAFTER_SOURCE_ENV: "https://example.org/d"}
|
||||
self.assertEqual(F.sources_for(F.MTP_FILE, env=env)[0]["base"], "https://example.org/d")
|
||||
self.assertEqual(F.sources_for(F.MTP_FILE, env=env)[-1]["base"], F.MTP_BASE)
|
||||
|
||||
def _drafter(self, have=(), failing=()):
|
||||
import tempfile
|
||||
from unittest import mock
|
||||
import setup
|
||||
calls = []
|
||||
|
||||
def fetch(a, name, folder, own):
|
||||
calls.append(name)
|
||||
if name in failing:
|
||||
raise SystemExit(1)
|
||||
return folder / name
|
||||
|
||||
with tempfile.TemporaryDirectory() as td, \
|
||||
mock.patch.object(setup, "inkling_fetch", side_effect=fetch), \
|
||||
mock.patch.object(setup, "inkling_have", side_effect=lambda a, p: p.name in have), \
|
||||
mock.patch.object(setup, "inkling_verify"):
|
||||
got = setup.inkling_fetch_drafter(mock.Mock(), Path(td), False)
|
||||
return got.name, calls
|
||||
|
||||
def test_setup_fetches_the_original_drafter_first(self):
|
||||
self.assertEqual(self._drafter(), (F.MTP_FILE, [F.MTP_FILE]))
|
||||
|
||||
def test_setup_falls_back_to_unsloths_copy_when_the_original_cannot_be_fetched(self):
|
||||
self.assertEqual(self._drafter(failing=(F.MTP_FILE,)), (F.DSPARK_GGUF_FILE, [F.MTP_FILE, F.DSPARK_GGUF_FILE]))
|
||||
with self.assertRaises(SystemExit):
|
||||
self._drafter(failing=(F.MTP_FILE, F.DSPARK_GGUF_FILE))
|
||||
|
||||
def test_setup_keeps_a_drafter_the_install_already_has(self):
|
||||
self.assertEqual(self._drafter(have=(F.DSPARK_GGUF_FILE,)), (F.DSPARK_GGUF_FILE, [])) # no second download
|
||||
self.assertEqual(self._drafter(have=(F.MTP_FILE,)), (F.MTP_FILE, []))
|
||||
|
||||
def test_a_local_folder_prefers_the_original_drafter(self):
|
||||
import tempfile
|
||||
import setup
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
td = Path(td)
|
||||
(td / "dspark-Inkling-2-Mini-Q8_0.gguf").write_bytes(b"x")
|
||||
self.assertEqual(setup.inkling_find_local_dspark(td).name, "dspark-Inkling-2-Mini-Q8_0.gguf")
|
||||
(td / "mtp.safetensors").write_bytes(b"x")
|
||||
self.assertEqual(setup.inkling_find_local_dspark(td).name, "mtp.safetensors")
|
||||
|
||||
def test_an_override_still_wins(self):
|
||||
src = F.gguf_sources(env={F.GGUF_SOURCE_ENV: "https://example.org/gguf"})
|
||||
self.assertEqual(src[0]["base"], "https://example.org/gguf")
|
||||
|
||||
@@ -171,10 +171,11 @@ class TestInklingUnslothDirectCatalog(unittest.TestCase):
|
||||
rc = setup.install_inkling2(args_ns, "inkling-2-mini", gpu_4gb, False, False, None, False, 8080, 16.0, None)
|
||||
|
||||
self.assertEqual(rc, 0)
|
||||
# the model, the picture reader, then the drafter: the original mtp.safetensors (it takes the same card memory as Unsloth's Q8_0 copy)
|
||||
self.assertEqual(fetched, [
|
||||
"Inkling-2-Mini-UD-Q2_K_XL.gguf",
|
||||
inkling_family.DSPARK_GGUF_FILE,
|
||||
inkling_family.VISION_FILE,
|
||||
inkling_family.MTP_FILE,
|
||||
])
|
||||
cfg_path = install_dir / "strata-inkling-2-mini-ud-q2_k_xl.json"
|
||||
self.assertTrue(cfg_path.is_file())
|
||||
|
||||
Reference in new issue
Block a user