DeepSeek pictures by default: setup fetches the vision tower's weights (mmproj-BF16.gguf, pinned) with the shared files, packs them with the model (pack_gguf --mmproj) and rebuilds a pack made without them; --vision no leaves all of it out; the picture-reader parts of the launcher's model state skip DeepSeek (its tower is part of the engine); the installed-config description says pictures on for a --vision on DeepSeek config; tests

This commit is contained in:
Niko1221 committed 2026-10-27 05:49:37 +01:00
1 parent 9b177f3080
commit 1e617c3f64
5 files changed
+84 -11

No files matched your search

+1 -1
View File
@@ -139,7 +139,7 @@ strata launch --family deepseek41 --model ist-das-2.00bpw
- The context is 8192 tokens (8K), the size the engine was checked at.
- `--speed faster|full` picks how many of the model's 6 experts it uses per word. Faster uses 5 (a small quality change, usually not noticeable) and is the default on a PC with 16 GB of graphics memory or less and on PCs whose graphics share the computer's memory. Full uses all 6. `--full-quality` is the same as `--speed full`. Both need DeepSeek engine 0.1.50 or newer, which `strata launch` fetches. The engine's own flag is `--experts N`.
- It answers one request at a time. `--parallel` above 1 is ignored with a note.
- It cannot read pictures, so pictures are off and `--vision on` is ignored with a note.
- It reads pictures (on by default) with the engine's own vision tower, loaded with the model; `--vision off` turns them off. Setup fetches the tower's weights (mmproj-BF16.gguf, 1 GB) with the other shared files and packs them with the model.
- `--tune` runs DeepSeek's own short tuner (drafter on or off, CPU threads), not the Qwen tuner.
- `--model-path DIR` starts from the shards you already have.
- `--plan` shows where the model goes on your cards and how much is held in RAM.
+26 -6
View File
@@ -726,7 +726,9 @@ DSV41_LEGACY_NAMES = {
DSV41_ISTA_ENGRAM: "engram-IQ4_NL.gguf",
}
# the files every official set shares (name -> where it comes from); they live in models/deepseek-v4.1-flash-shared, once
DSV41_MMPROJ = "mmproj-BF16.gguf" # the vision tower's weights (972 MB, pinned): packed into the model's pack when pictures are on (0.2.7)
DSV41_SHARED = {
DSV41_MMPROJ: hf(DSV41_REPO),
DSV41_ISTA_ENGRAM: hf(DSV41_ISTA_REPO),
DSV41_SHARD.format(i=1): hf(DSV41_REPO) + "UD-Q8_K_XL/", # only its metadata is read (pack_gguf --engram-meta)
DSV41_DSPARK: hf(DSV41_REPO),
@@ -8098,14 +8100,23 @@ def dsv41_find_shared(a, name: str, folder: Path, shared: Path) -> Path:
return shared / name
def dsv41_pack_cmd(folder: Path, shards: list, engram: Path, meta: Path, dspark: Path, pack: Path) -> list:
def dsv41_pack_has_tower(pack: Path) -> bool:
"""Does the pack carry the vision tower (pack_gguf.py writes vision.* and image_token_id into ds4.txt when it found the mmproj)?"""
try:
txt = (Path(pack) / "ds4.txt").read_text(encoding="utf-8", errors="replace")
except OSError:
return False
return "\nimage_token_id " in "\n" + txt and "vision.num_hidden_layers" in txt
def dsv41_pack_cmd(folder: Path, shards: list, engram: Path, meta: Path, dspark: Path, pack: Path, mmproj: Path | None = None) -> list:
"""The pack recipe for an official IST-DAS set - this and nothing else: another one (--skip-tensors / --dense-override + engram_fold)
packs without an error and gives garbage text (P2003, 2026-10-23). The drafter's noise token (128799) and markov rank (256) are stated:
the IST-DAS GGUFs do not carry them, and a pack with noise id 0 drafts deep less often (decode ~10% slower with DSpark). --shards names the four files, so an Engram or another
set in the same folder is not read as part of the model."""
return [sys.executable, str(ROOT / "tools" / "dsv41" / "pack_gguf.py"), "--model", str(folder), "--shards", *[Path(n).name for n in shards],
"--engram", str(engram), "--engram-meta", str(meta), "--dspark-gguf", str(dspark),
"--dspark-noise-token", "128799", "--dspark-markov-rank", "256", "--out", str(pack)]
"--dspark-noise-token", "128799", "--dspark-markov-rank", "256", *(["--mmproj", str(mmproj)] if mmproj else []), "--out", str(pack)]
def dsv41_prefill_chunk_args(cards, ram_gb) -> list:
@@ -8229,7 +8240,12 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
folder = dsv41_folder(a, fam, tag, model)
shards = [dsv41_pick(folder, n) for n in md["shards"]]
shared_dir = dsv41_shared_dir(a, fam)
shared = [dsv41_find_shared(a, n, folder, shared_dir) for n in md.get("shared", [])]
# Pictures are on by default (owner rule): the engine reads them with its own vision tower, which the pack carries when the tower's weights
# (mmproj-BF16.gguf, a shared file) were there when it was made. --vision no leaves the file out and the pack text-only.
ds_vision = "off" if a.vision in ("no", "off") else "on"
shared_names = list(md.get("shared", [])) + ([DSV41_MMPROJ] if ds_vision == "on" else [])
shared = [dsv41_find_shared(a, n, folder, shared_dir) for n in shared_names]
mmproj_file = shared[len(md.get("shared", []))] if ds_vision == "on" else None
own_files = {f: bool(a.gguf_dir) or f.parent != shared_dir for f in shared} # a file found outside setup's own folder is the person's
def partial(f: Path) -> int:
@@ -8275,7 +8291,6 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
warn(f"{ctx // 1024}K tokens of context: the engine was checked at 4K and 8K; longer is kept as you chose, but untested")
# Pictures are on by default (owner rule): the engine reads them with its own vision tower (319 MiB, loaded with the model, no separate
# reader process). --vision no turns them off (--vision off for the engine); gpu / cpu name a Flash-Next reader and mean "on" here.
ds_vision = "off" if a.vision in ("no", "off") else "on"
if a.vision in ("gpu", "cpu"):
warn(f"{fam['title']} reads pictures with the engine's own tower, so --vision {a.vision} is taken as yes: pictures on")
if a.rope_scaling or a.rope_scale or a.kv or a.resident_budget_gib is not None or a.low_ram not in (None, "auto"):
@@ -8338,6 +8353,10 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
data, _ = data_folder_for(a)
pack = data / "packs" / tag.lower() # the engine's map of the shards, the hash tables, the tokenizer: a few MB
have_pack = (pack / "tokenizer" / "vocab.json").exists() and (pack / "tensors.txt").exists()
if have_pack and ds_vision == "on" and mmproj_file is not None and not dsv41_pack_has_tower(pack):
warn("the pack from an earlier run was made without the picture reader: building it again with it (a few minutes)")
shutil.rmtree(pack, ignore_errors=True)
have_pack = False
if have_pack and ista: # a pack from an earlier run is kept only when the engine finds all of its files
good, why = dsv41_pack_info(exe, pack, lib_dirs)
if not good:
@@ -8346,9 +8365,10 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
have_pack = False
if not have_pack:
if ista:
run(dsv41_pack_cmd(folder, [f.name for f in shards], shared[0], shared[1], shared[2], pack))
run(dsv41_pack_cmd(folder, [f.name for f in shards], shared[0], shared[1], shared[2], pack, mmproj_file))
else:
run([sys.executable, str(ROOT / "tools" / "dsv41" / "pack_gguf.py"), "--model", str(folder), "--out", str(pack)])
run([sys.executable, str(ROOT / "tools" / "dsv41" / "pack_gguf.py"), "--model", str(folder), "--out", str(pack),
*(["--mmproj", str(mmproj_file)] if mmproj_file else [])])
if ista:
prof = DSV41_PROFILES / md["profile"] # which experts are used most: the RAM store starts with them (the engine reads <pack>/expert-profile.bin)
if prof.is_file() and not (pack / "expert-profile.bin").exists():
+3 -1
View File
@@ -111,7 +111,9 @@ def assess(catalog, family: str | None, model: str | None, *, vision: str = "off
mtp = mtp_choice(mtp, drafting)
row = next((r for r in (rows if rows is not None else catalog.rows()) if r.family == family and r.model == model), None) if (family and model) else None
st.total_gb = float(row.download_gb) if row else 0.0
wants_pictures = vision != "off" and (row is None or row.images)
# DeepSeek reads pictures with its own engine's tower: nothing separate to fetch or to start (the tower's file is part of its setup)
own_tower = bool(family) and bool(catalog.strata.multi_family(family))
wants_pictures = vision != "off" and (row is None or row.images) and not own_tower
data = Path(data_dir) if data_dir else None
if model_path:
st.own_files = True
+2 -1
View File
@@ -670,7 +670,8 @@ class Strata:
plan = self.removal_plan(path)
return {"model": tag, "config": path.name, "model_name": cfg.get("model_name"),
"context": int(val("--max-context")) if str(val("--max-context") or "").isdigit() else None,
"kv": val("--kv"), "images": ("gpu" if vis.get("gpu") else "cpu") if isinstance(vis, dict) else "off",
"kv": val("--kv"), "images": ("gpu" if vis.get("gpu") else "cpu") if isinstance(vis, dict)
else ("on" if cfg.get("arch") == "deepseek41" and str(val("--vision") or "on").lower() not in ("off", "no", "false", "0") else "off"),
"port": cfg.get("port", DEFAULT_PORT), "host": cfg.get("host", "127.0.0.1"),
"gpu": cfg.get("gpu"), "gpu_roles": cfg.get("gpu_roles"), "api_key_set": bool(cfg.get("api_key")),
"low_ram": "--resident-experts" in a or "--mmap-experts" in a,
+52 -2
View File
@@ -194,6 +194,7 @@ class Install(unittest.TestCase):
self.exe.write_text("x")
cards = cards or FOUR
kw.setdefault("model", "UD-Q8_K_XL")
kw.setdefault("vision", "no") # the older tests are about the files of the model; pictures-on has its own tests (PicturesByDefault)
gpu = {"index": 0, "count": len(cards), "vram_gb": 32.0, "name": "R9700", "cards": cards}
return run(setup.install_dsv41, args(models_dir=str(self.root / "models"), **kw), "deepseek41", gpu, True, [], 13, [], 8080, ram,
None, cards)
@@ -220,7 +221,7 @@ class Install(unittest.TestCase):
self.assertEqual(self.cfg["engine_ready_s"], 3600)
self.assertEqual(self.cfg["backend"], "hip")
self.assertTrue(self.cfg["tokenizer"].endswith("tokenizer"))
self.assertEqual(a[a.index("--vision") + 1], "on") # 0.2.7: the engine reads pictures with its own tower
self.assertEqual(a[a.index("--vision") + 1], "off") # (this test asks for no pictures: they are on by default, see PicturesByDefault)
self.assertNotIn("--mtp", a)
self.assertIn("4 cards, one block of layers on each", out)
self.assertIn("n-gram table", out)
@@ -676,7 +677,7 @@ class InstallOfficial(Install):
self.assertEqual(rc, 0, out)
a = self.cfg["args"]
self.assertEqual(a[a.index("--dspark") + 1], "auto") # never "off": that still loads the drafter and takes the VRAM
self.assertNotIn("off", a)
self.assertNotEqual(a[a.index("--dspark") + 1], "off")
self.assertNotIn("--prefill-chunk", a) # the engine's own default is the layer-major prompt path
self.assertEqual(a[a.index("--dspark-conf") + 1], "0.65") # never a floor below 0.3 # the layer-major prompt path
self.assertNotIn("--ssd-cache", a) # the store sizes itself
@@ -731,3 +732,52 @@ class InstallSmallest(InstallOfficial):
if __name__ == "__main__":
unittest.main()
class PicturesByDefault(Install):
"""0.2.7: DeepSeek reads pictures with its own engine's tower, on by default: setup fetches the tower's weights (mmproj-BF16.gguf, a shared file),
packs them with the model and writes --vision on; --vision no leaves all three out."""
def test_default_fetches_the_tower_packs_it_and_says_on(self):
rc, out = self.install(vision=None)
self.assertEqual(rc, 0, out)
got = [c[2].name for c in self.calls if c[0] == "get"]
self.assertIn(setup.DSV41_MMPROJ, got)
self.assertEqual(got[-1], setup.DSV41_MMPROJ)
pack = [c for c in self.calls if c[0] == "run"][-1][1]
self.assertIn("--mmproj", pack)
self.assertTrue(str(pack[pack.index("--mmproj") + 1]).endswith(setup.DSV41_MMPROJ))
a = self.cfg["args"]
self.assertEqual(a[a.index("--vision") + 1], "on")
self.assertNotIn("cannot read pictures", out)
def test_vision_no_leaves_the_tower_out(self):
rc, out = self.install(vision="no")
self.assertEqual(rc, 0, out)
self.assertNotIn(setup.DSV41_MMPROJ, [c[2].name for c in self.calls if c[0] == "get"])
pack = [c for c in self.calls if c[0] == "run"][-1][1]
self.assertNotIn("--mmproj", pack)
a = self.cfg["args"]
self.assertEqual(a[a.index("--vision") + 1], "off")
def test_gpu_and_cpu_are_taken_as_yes_with_a_note(self):
rc, out = self.install(vision="cpu")
self.assertEqual(rc, 0, out)
self.assertIn("own tower", out)
a = self.cfg["args"]
self.assertEqual(a[a.index("--vision") + 1], "on")
def test_a_pack_without_the_tower_is_made_again_with_it(self):
pack = self.root / "data" / "packs" / "deepseek-v4.1-flash-ud-q8_k_xl"
(pack / "tokenizer").mkdir(parents=True)
(pack / "tokenizer" / "vocab.json").write_text("{}")
(pack / "tensors.txt").write_text("x")
(pack / "ds4.txt").write_text("hidden_size 5120\n")
self.assertFalse(setup.dsv41_pack_has_tower(pack))
rc, out = self.install(vision=None)
self.assertEqual(rc, 0, out)
self.assertIn("made without the picture reader", out)
self.assertTrue([c for c in self.calls if c[0] == "run" and "--mmproj" in c[1]])
pack.mkdir(parents=True, exist_ok=True)
(pack / "ds4.txt").write_text("vision.num_hidden_layers 32\nimage_token_id 129264\n")
self.assertTrue(setup.dsv41_pack_has_tower(pack))