Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

DeepSeek: pack_gguf takes an automatically found mmproj only when its projector is deepseek41v (a Qwen mmproj in the shared models folder is ignored, no error: #3927 #3917); files the person already has are recognised as DeepSeek by the pinned shard names in the guided screen too, not by the generic GGUF check that called the UD n-gram shard unreadable (#3914); tests

Niko1221dfa3f4025c9f
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.py
index 66dbe84f1..a09f6b8fd 100644
--- a/strata_cli/launch/runner.py
+++ b/strata_cli/launch/runner.py
@@ -1092,6 +1092,27 @@ class Runner:
self.emit("model", f"Used your prepared model files and wrote the run settings ({path.name}); this card is not one the built-in downloader sets up.", 100, level="warn")
return path
+ @staticmethod
+ def deepseek_set_in(mod, model_path, prefer: str | None = None):
+ """(set name, its catalog entry, the folder) when `model_path` (a folder, the folder above the set's own folder, or one shard) holds shards
+ of an official DeepSeek-V4.1-Flash set - recognised by the pinned shard names (the first release's names too), never by the generic GGUF
+ fingerprint table, which does not know DeepSeek (its shard 8 is a table, not a layer: "could not be read", #3914) - else None."""
+ fam = getattr(mod, "MULTI_FILE_FAMILIES", {}).get("deepseek41")
+ if fam is None or not model_path:
+ return None
+ p = Path(model_path)
+ legacy = getattr(mod, "DSV41_LEGACY_NAMES", {})
+ order = ([prefer] if prefer in fam["models"] else []) + [m for m in fam["models"] if m != prefer]
+ for m in order:
+ d = fam["models"][m]
+ subs = [d.get("subdir"), d.get("legacy_subdir"), m]
+ folders = [p, *[p / x for x in subs if x]] if p.is_dir() else [p.parent]
+ names = [n for s in d["shards"] for n in (s, legacy.get(s)) if n]
+ folder = next((f for f in folders if any((f / n).exists() for n in names)), None)
+ if folder is not None:
+ return m, d, folder
+ return None
+
def deepseek_files(self) -> bool:
"""--model-path names DeepSeek-V4.1-Flash's shards (a folder, the repository's folder with the set's own folder inside - UD-Q8_K_XL,
2.00bpw, 2.25bpw - or one shard): they are that model, whatever the fingerprint table of the Flash-Next files says. True when it did
@@ -1103,16 +1124,7 @@ class Runner:
fam = getattr(mod, "MULTI_FILE_FAMILIES", {}).get("deepseek41")
if fam is None or not s.model_path:
return False
- p = Path(s.model_path)
- found = None
- order = ([s.model] if s.model in fam["models"] else []) + [m for m in fam["models"] if m != s.model]
- for m in order:
- d = fam["models"][m]
- folders = [p, p / (d.get("subdir") or m)] if p.is_dir() else [p.parent]
- folder = next((f for f in folders if any((f / n).exists() for n in d["shards"])), None)
- if folder is not None:
- found = (m, d, folder)
- break
+ found = self.deepseek_set_in(mod, s.model_path, s.model)
except Exception: # noqa: BLE001 - not DeepSeek's: the usual check goes on
return False
if found is None:
@@ -1122,7 +1134,8 @@ class Runner:
raise LaunchError(f"These are DeepSeek-V4.1-Flash's files, not {s.family} {s.model}'s.",
"Leave --model out, or use --model " + model + ".", 2)
others = list(d["shards"])
- missing = [n for n in others if not (folder / n).exists()]
+ legacy = getattr(mod, "DSV41_LEGACY_NAMES", {})
+ missing = [n for n in others if not (folder / n).exists() and not (legacy.get(n) and (folder / legacy[n]).exists())]
if missing:
parts = {4: "four", 9: "nine"}.get(len(others), str(len(others)))
raise LaunchError(f"DeepSeek-V4.1-Flash {d.get('label', model)} is in {parts} parts and {len(missing)} of them are not in {folder} "
diff --git a/strata_cli/launch/screens.py b/strata_cli/launch/screens.py
index d88695b9b..d40c1adc1 100644
--- a/strata_cli/launch/screens.py
+++ b/strata_cli/launch/screens.py
@@ -497,6 +497,8 @@ class ModelScreen(Base):
if problem:
self.say(f"{problem[0]} {problem[1]}", True)
return
+ if self.check_own_deepseek(path):
+ return
try:
plan = models.plan_import(models.absolute(path))
except Exception as e: # noqa: BLE001
@@ -518,6 +520,37 @@ class ModelScreen(Base):
self.say(f"These files cannot be used as they are ({why}). " + (holds + " " if holds else "") +
"Check that every shard is in the folder, or pick a model from the list.", True)
+ def check_own_deepseek(self, path: str) -> bool:
+ """The files are DeepSeek-V4.1-Flash's (the pinned shard names): taken as that model, as `strata launch --model-path` does, instead of
+ the generic file check, which does not know DeepSeek and said "could not be read" for its n-gram shard (#3914). True when it answered."""
+ from strata_cli.launch.runner import Runner
+ try:
+ mod = self.ctx.catalog.strata.setup_module()
+ found = Runner.deepseek_set_in(mod, path, self.ctx.settings.model)
+ except Exception: # noqa: BLE001 - not DeepSeek's: the usual check goes on
+ return False
+ if found is None:
+ return False
+ model, d, folder = found
+ legacy = getattr(mod, "DSV41_LEGACY_NAMES", {})
+ missing = [n for n in d["shards"] if not (folder / n).exists() and not (legacy.get(n) and (folder / legacy[n]).exists())]
+ if missing:
+ self.say(f"These are DeepSeek-V4.1-Flash {d.get('label', model)} files, but {len(missing)} of {len(d['shards'])} parts are not in {folder} "
+ f"(first missing: {missing[0]}). Put every part in the folder, or pick a model from the list.", True)
+ return True
+ s = self.ctx.settings
+ s.model_path, s.family, s.model = str(folder), "deepseek41", model
+ self.ctx.picked_in_list = False
+ self.close_field("own")
+ gb = sum(x.stat().st_size for x in folder.iterdir() if x.is_file() and x.name.endswith(".gguf")) / 1e9
+ self.say(f"These files are DeepSeek-V4.1-Flash {d.get('label', model)} ({gb:.0f} GB in this folder). Press Enter to use them.")
+ try:
+ self.menu().select(("deepseek41", model))
+ except Exception: # noqa: BLE001 - the list may not show it; the choice is already made
+ pass
+ self.paint()
+ return True
+
def action_back(self) -> None:
if self.input_open():
self.close_field("own")
diff --git a/tests/terminal/test_dsv41_own_files_and_mmproj.py b/tests/terminal/test_dsv41_own_files_and_mmproj.py
new file mode 100644
index 000000000..07cedcd18
--- /dev/null
+++ b/tests/terminal/test_dsv41_own_files_and_mmproj.py
@@ -0,0 +1,141 @@
+"""#3927 / #3917: a Qwen vision projector in the shared models folder must never be taken for DeepSeek's (the pack is made without a vision
+tower, no error). #3914: DeepSeek files the person already has are recognised by the pinned shard names - in the guided screen too - instead of
+by the generic GGUF check, which does not know DeepSeek (and called its n-gram shard 'could not be read')."""
+from __future__ import annotations
+
+import struct
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+from unittest import mock
+
+ROOT = Path(__file__).resolve().parents[2]
+sys.path.insert(0, str(ROOT))
+sys.path.insert(0, str(ROOT / "tools"))
+sys.path.insert(0, str(ROOT / "tools" / "dsv41"))
+import pack_gguf as PG # noqa: E402
+import setup # noqa: E402
+
+
+def gguf(path: Path, **kv) -> Path:
+ """A GGUF with only metadata (string and uint32 values)."""
+ out = bytearray(b"GGUF" + struct.pack("<IQQ", 3, 0, len(kv)))
+ for k, v in kv.items():
+ k = k.replace("__", ".")
+ out += struct.pack("<Q", len(k)) + k.encode()
+ if isinstance(v, str):
+ out += struct.pack("<I", 8) + struct.pack("<Q", len(v)) + v.encode()
+ else:
+ out += struct.pack("<I", 4) + struct.pack("<I", v)
+ out += b"\0" * (-len(out) % 32)
+ path.write_bytes(bytes(out))
+ return path
+
+
+class SharedFolderMmproj(unittest.TestCase):
+ def layout(self, d: Path):
+ models = d / "models"
+ model = models / "deepseek-v4.1-flash-IST-DAS-2.25bpw"
+ model.mkdir(parents=True)
+ return models, model
+
+ def test_a_qwen_projector_in_the_shared_folder_is_ignored(self):
+ with tempfile.TemporaryDirectory() as d:
+ models, model = self.layout(Path(d))
+ gguf(models / "mmproj-Qwen3.8-Flash-Next-BF16.gguf", general__architecture="clip", clip__projector_type="qwen3vl_merger")
+ gguf(models / "mmproj-Swift-Qwen3.8-Flash-Next-BF16.gguf", general__architecture="clip", clip__projector_type="qwen3vl_merger")
+ self.assertIsNone(PG.find_mmproj(model))
+
+ def test_a_deepseek_projector_is_found_even_after_a_qwen_one(self):
+ with tempfile.TemporaryDirectory() as d:
+ models, model = self.layout(Path(d))
+ gguf(models / "mmproj-Qwen3.8-Flash-Next-BF16.gguf", general__architecture="clip", clip__projector_type="qwen3vl_merger")
+ ds = gguf(models / "mmproj-zz-DeepSeek-BF16.gguf", general__architecture="clip", clip__projector_type="deepseek41v")
+ self.assertEqual(PG.find_mmproj(model), ds)
+
+ def test_a_broken_or_not_gguf_mmproj_file_is_skipped(self):
+ with tempfile.TemporaryDirectory() as d:
+ models, model = self.layout(Path(d))
+ (models / "mmproj-broken.gguf").write_bytes(b"not a gguf at all")
+ (models / "mmproj-empty.gguf").write_bytes(b"")
+ self.assertIsNone(PG.find_mmproj(model))
+
+ def test_no_mmproj_at_all(self):
+ with tempfile.TemporaryDirectory() as d:
+ _models, model = self.layout(Path(d))
+ self.assertIsNone(PG.find_mmproj(model))
+
+ def test_setup_does_not_name_an_mmproj_for_the_official_sets(self):
+ cmd = setup.dsv41_pack_cmd(Path("/m/set"), ["a.gguf"], Path("/s/e.gguf"), Path("/s/m.gguf"), Path("/s/d.gguf"), Path("/p"))
+ self.assertNotIn("--mmproj", cmd) # the folder scan above decides, by the projector type
+
+
+class OwnDeepSeekFiles(unittest.TestCase):
+ def touch_set(self, folder: Path, names):
+ folder.mkdir(parents=True, exist_ok=True)
+ for n in names:
+ (folder / n).write_bytes(b"x")
+
+ def test_the_pinned_shard_names_are_recognised_in_the_folder_above_and_in_the_first_releases_folder(self):
+ from strata_cli.launch.runner import Runner
+ fam = setup.MULTI_FILE_FAMILIES["deepseek41"]
+ new = fam["models"]["IST-DAS-2.00bpw"]["shards"]
+ with tempfile.TemporaryDirectory() as d:
+ d = Path(d)
+ self.touch_set(d / "a", new)
+ self.assertEqual(Runner.deepseek_set_in(setup, d / "a")[0], "IST-DAS-2.00bpw")
+ old = ["model-2.25bpw-%05d-of-00004.gguf" % i for i in range(1, 5)]
+ self.touch_set(d / "b" / "2.25bpw", old)
+ m, _entry, folder = Runner.deepseek_set_in(setup, d / "b")
+ self.assertEqual((m, folder), ("IST-DAS-2.25bpw", d / "b" / "2.25bpw"))
+ ud = [setup.DSV41_SHARD.format(i=i) for i in range(1, 10)]
+ self.touch_set(d / "c" / "UD-Q8_K_XL", ud)
+ self.assertEqual(Runner.deepseek_set_in(setup, d / "c")[0], "UD-Q8_K_XL")
+
+ def test_other_models_files_are_not_deepseeks(self):
+ from strata_cli.launch.runner import Runner
+ with tempfile.TemporaryDirectory() as d:
+ self.touch_set(Path(d), ["Qwen3.8-Flash-Next-GSQ-RCO-Q2_0-00001-of-00002.gguf"])
+ self.assertIsNone(Runner.deepseek_set_in(setup, Path(d)))
+
+ def screen(self, settings):
+ from strata_cli.launch.screens import ModelScreen
+ f = mock.MagicMock()
+ f.ctx.settings = settings
+ f.ctx.catalog.strata.setup_module.return_value = setup
+ said = []
+ f.say = lambda text, err=False: said.append(text)
+ return ModelScreen, f, said
+
+ def test_the_guided_screen_takes_the_ud_files_as_deepseek_instead_of_saying_a_shard_could_not_be_read(self):
+ from strata_cli.launch import settings as S
+ with tempfile.TemporaryDirectory() as d:
+ self.touch_set(Path(d), [setup.DSV41_SHARD.format(i=i) for i in range(1, 10)])
+ cls, f, said = self.screen(S.LaunchSettings())
+ self.assertTrue(cls.check_own_deepseek(f, d))
+ s = f.ctx.settings
+ self.assertEqual((s.family, s.model, s.model_path), ("deepseek41", "UD-Q8_K_XL", str(Path(d))))
+ self.assertIn("DeepSeek-V4.1-Flash", " ".join(said))
+ self.assertNotIn("cannot be used", " ".join(said))
+
+ def test_a_part_that_is_missing_is_said_plainly(self):
+ from strata_cli.launch import settings as S
+ with tempfile.TemporaryDirectory() as d:
+ self.touch_set(Path(d), [setup.DSV41_SHARD.format(i=i) for i in range(1, 9)]) # shard 9 is missing
+ cls, f, said = self.screen(S.LaunchSettings())
+ self.assertTrue(cls.check_own_deepseek(f, d))
+ self.assertIn("1 of 9 parts are not in", " ".join(said))
+ self.assertIsNone(f.ctx.settings.model_path)
+
+ def test_files_of_another_model_go_on_to_the_usual_check(self):
+ from strata_cli.launch import settings as S
+ with tempfile.TemporaryDirectory() as d:
+ self.touch_set(Path(d), ["x-00001-of-00002.gguf"])
+ cls, f, said = self.screen(S.LaunchSettings())
+ self.assertFalse(cls.check_own_deepseek(f, d))
+ self.assertEqual(said, [])
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/dsv41/pack_gguf.py b/tools/dsv41/pack_gguf.py
index bf0bdd703..b56838f59 100644
--- a/tools/dsv41/pack_gguf.py
+++ b/tools/dsv41/pack_gguf.py
@@ -316,6 +316,20 @@ def short(g: Gguf):
return None if have >= need else "%s: %d of %d bytes" % (g.path.name, have, need)
+def find_mmproj(model: pathlib.Path):
+ """The DeepSeek vision tower beside the model (an automatic find, no --mmproj): an mmproj*.gguf in the model's parent folder whose projector IS
+ deepseek41v. The folder is shared with other families' files (Qwen keeps its own mmproj-Qwen3.8-Flash-Next-BF16.gguf there, projector
+ qwen3vl_merger): those are never taken, and never an error - the pack is made without a vision tower. A file named with --mmproj is checked
+ strictly in main()."""
+ for p in sorted(model.parent.glob("mmproj*.gguf")):
+ try:
+ if Gguf(p).kv.get("clip.projector_type") == "deepseek41v":
+ return p
+ except (OSError, ValueError, SystemExit, struct.error):
+ continue
+ return None
+
+
def is_engram_file(g) -> bool:
"""The Engram table's GGUF: general.architecture 'engram' (the first release) or 'deepseek41-engram' (ISTA-DASLab's final files)."""
arch = str(g.kv.get("general.architecture") or "")
@@ -404,7 +418,7 @@ def main() -> int:
"blocks become mtp.0-2 beside the trunk's tensors (default: the first dspark-*.gguf "
"in <model>/.. when there is one)")
ap.add_argument("--mmproj", help="unsloth's vision tower GGUF (mmproj-*.gguf, clip / deepseek41v): its tensors become the "
- "checkpoint's vision.* / aligner.* (default: the first mmproj*.gguf in <model>/..)")
+ "checkpoint's vision.* / aligner.* (default: the first mmproj*.gguf in <model>/.. whose projector is deepseek41v; other families' are ignored)")
ap.add_argument("--tq-experts", nargs="+", help="folders tq_convert.py wrote (tq.json + tq-L<layer>.bin): the routed experts of the layers "
"listed there are read from it as trellis types (TQK5X ..), the others keep their MXFP4")
ap.add_argument("--dense-override", action="append", help="a folder dense_requant.py wrote (dense.json + dense.bin): its tensors replace the same-named "
@@ -731,8 +745,7 @@ def main() -> int:
print("DSpark drafter from %s: %d blocks" % (ds_path.name, nb))
# the vision tower from unsloth's mmproj GGUF (clip, projector deepseek41v): llama.cpp's names -> the checkpoint's;
# the F32 norms / biases / marker rows are read as BF16 by the engine; mlp.w1 is the file's gate and up
- mm_path = pathlib.Path(a.mmproj).expanduser().resolve() if a.mmproj else next(
- iter(sorted(model.parent.glob("mmproj*.gguf"))), None)
+ mm_path = pathlib.Path(a.mmproj).expanduser().resolve() if a.mmproj else find_mmproj(model)
mm_geo = {}
if mm_path is not None:
if not mm_path.is_file():