DeepSeek local GGUF: accept both layouts of the IST-DAS sets, the pinned four-shard one and ISTA-DASLab's six-shard one (owner decision, option B)

The download default stays on the four-shard pin cb02422c; nothing is fetched under the new names. The six-shard files (Hub commit a419d74c,
27 October: five shards a set, the Engram as the sixth) and the four-shard files with the first shard ISTA re-published on 26 October (what the
Hub's last four-shard commit 653a9874 serves; #4237 was refused by the app because only the pinned size of shard 1 was known) are taken from
files already here, by size and SHA-256.

- setup.py: DSV41_ISTA6_FILES (15 files), shards6 on the three sets, dsv41_layout_of / dsv41_parts / dsv41_pack_layout; install_dsv41 picks the
  layout of a --gguf-dir folder (both whole: the pinned one), packs the five files with the Engram as --engram, and builds the pack again when it
  was made from the other layout's files. The converted Engram (same name and size, another hash) is accepted beside the pinned one.
- strata_control/dsv41_sets.py, models.py: the app's check and `strata models import` know the six-shard names, the re-published shard 1, and
  that a folder with both whole layouts of one set is that set once.
- strata_cli/launch: --model-path and the guided screen name what is missing in the layout that is there.
- tools/dsv41/pack_gguf.py: --engram as the sixth shard of a six-shard split; the pinned release's Engram serves the six-shard shards too.
- Tests for each; docs/DEEPSEEK41.md.

Builds on the cherry-picks of #4348 (integer tensors in the GGUF reader) and #4632 (StackArc3's six-shard work, option A), which this
commit reworks so the four-shard pin and files keep working unchanged.

Related: #4237, #4256, #4632.
This commit is contained in:
Niko1221 committed 2026-10-30 00:32:32 +01:00
1 parent c4e975cc7a
commit d7cb41ba87
13 files changed
+563 -304

No files matched your search

+12 -9
View File
@@ -33,17 +33,20 @@ perplexity +7.3% (code +3.2%, agent work +2.2%). IQ1_M: perplexity +21% (KL 0.21
| File | Size | What it is |
| --- | ---: | --- |
| IQ1_M shards (1.75 bpw), 5 files | 121 GB | the model, smallest set |
| IQ2_XXS shards (2.00 bpw), 5 files | 138 GB | the model, middle set |
| IQ2_XS shards (2.25 bpw), 5 files | 155 GB | the model, largest set |
| IQ1_M shards (1.75 bpw), 4 files | 121 GB | the model, smallest set |
| IQ2_XXS shards (2.00 bpw), 4 files | 138 GB | the model, middle set |
| IQ2_XS shards (2.25 bpw), 4 files | 155 GB | the model, largest set |
| IQ4_NL: `DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf` | 111 GB | the 4-bit Engram lookup table the model reads from RAM or SSD. Not a model to pick: all three sets use this one file, and it is already in their download sizes |
| DSpark drafter (Q8_0) | 8 GB | the small draft model (Unsloth) |
Since 27 October 2026 the sets are in the llama.cpp b11870 layout: the files are named `...-0000N-of-00006.gguf`. Shards 1 to 5 are the set's own files
(shard 1 is 5.8 MB of metadata with the chat template inside) and shard 6 is the Engram file above, shared by the three sets; setup
downloads it once and hands it to `pack_gguf.py` as `--engram`, which counts it as the sixth shard. The earlier four-shard files (the
first release's `model-2.00bpw-0000N-of-00004.gguf` and the 24 October names) are not the same bytes any more and are not accepted: setup
downloads the six-shard files next to them.
**Two layouts of the same sets.** Setup downloads the four-shard files (`...-0000N-of-00004.gguf`, the Hugging Face revision `cb02422c`). On 27 October 2026
ISTA-DASLab re-split the three sets: five shards each (`...-0000N-of-00006.gguf`; shard 1 is 5.8 MB of metadata and has no tensors) and the Engram file as the
sixth shard of the split. Strata takes either from files you already have (`--gguf-dir`, `--model-path`, "Use a local GGUF" in the app, `strata models import`),
checks their size and SHA-256, and packs them. The same goes for the four-shard files whose first shard ISTA-DASLab re-published on 26 October with a larger
chat template. What differs in the six-shard files: the two Engram tables are one tensor (the same bytes), the Engram gate is stored already folded (q times k),
the attention output matrix is one 2-D tensor instead of a 3-D one, and there is a routing bias for picture tokens. The packs are the same size and the engine
reads both. The Engram has the same name and size in both layouts but another hash; either one works with either layout, and setup downloads the pinned one
if you have none. The download default is still the four-shard files.
**On a Ryzen AI Max "Strix Halo" (Windows)** the graphics chip and the CPU share one pool of memory, so the engine counts it once: the
128 GB box (a 64 GB BIOS carve-out plus the 64 GB Windows sees) keeps about 109 GB of the 2.00 set's experts in that pool (the dense
@@ -68,7 +71,7 @@ prompts 141 tokens/s at 1.2K and 615 at 4.6K. They saw 16 to 22 tokens/s with `-
computer; other cards and RAM sizes can differ, and `--dspark auto` stays the default.
Setup downloads with resume and SHA-256, packs the model with the plain recipe (`pack_gguf.py --model SET --shards ... --engram
DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf --engram-meta <UD shard 1> --dspark-gguf dspark-...-Q8_0.gguf`; do not add `--skip-tensors` or `--dense-override`:
engram-IQ4_NL.gguf --engram-meta <UD shard 1> --dspark-gguf dspark-...-Q8_0.gguf`; do not add `--skip-tensors` or `--dense-override`:
that packs without an error and gives garbage text), copies the shipped hot-expert profile (`data/dsv41/profile-2.00.bin` or `-2.25.bin`)
into the pack as `expert-profile.bin`, checks `strata-dsv41 --pack-info` (every file present) and answers a 16-token test question
(`tools/dsv41/smoke.py`, the text must name Paris). The start script passes `--dspark auto` (never `off`: `off` still loads the drafter
+134 -85
View File
@@ -101,7 +101,7 @@ HF_REVISIONS = {
"unsloth/Qwen3.6-35B-A3B-MTP-GGUF": "5bc3e238d916f48a861bac2f8a1990a0e9b7e98d", # 2026-10-12
"agentionai/Qwen3.8-Flash-Next-Gyro-GGUF": "1ada08422e404aca51ab9df665f089f34c419c6b", # 2026-10-13
"unsloth/DeepSeek-V4.1-Flash-1017-GGUF": "f924b94f19c1fea02c06a65c8475b0a45e2b88b1", # 2026-10-20 (the port's reference)
"ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF": "a419d74cd28d5b9f8c5e2b9077d11a609c17bc32", # 2026-10-27 (the six-shard 1.75 / 2.00 / 2.25 bpw sets in llama.cpp b11870's layout, and the converted Engram)
"ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF": "cb02422c900df489cea5833e8a92171224059b3c", # 2026-10-24 (ISTA-DASLab's final 1.75 / 2.00 / 2.25 bpw sets and Engram)
}
@@ -683,17 +683,68 @@ DSV41_FILES = {
"mmproj-BF16.gguf": (972208288, "9a1ef7c40d0d702c7ed8c5f863f60abae64091387ba3fce0ad19ce9beeda3bf9"),
}
# The two OFFICIAL IST-DAS sets (ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF at the revision above, a flat repository; Hub LFS sha256 = what the
# files hash to): IQ2_XXS is the 2.00 bpw set, IQ2_XS the 2.25 bpw set and IQ1_M the 1.75 bpw set. Since 2026-10-27 (llama.cpp b11870 and newer) each set is
# SIX shards: 1-5 are files of the set (shard 1 is the 5.8 MB metadata) and shard 6 is the ONE Engram table (110.6 GB, the same file for all sets: downloaded
# once into the shared folder and handed to pack_gguf as --engram, which counts it as the sixth shard). The DSpark drafter and the 5.8 MB metadata shard of
# Unsloth's set that pack_gguf --engram-meta reads are pinned in DSV41_FILES above. This is the set a normal PC runs (64 GB RAM + a 12 GB card;
# docs/DEEPSEEK41.md); the UD-Q8_K_XL entry stays for the big machines.
# files hash to): IQ2_XXS is the 2.00 bpw set, IQ2_XS the 2.25 bpw set and IQ1_M the 1.75 bpw set, 4 shards each, plus ONE Engram table (110.6 GB, the same file for both sets:
# downloaded once into the shared folder) and the DSpark drafter and the 5.8 MB metadata shard of Unsloth's set that pack_gguf --engram-meta reads
# (both pinned in DSV41_FILES above). This is the set a normal PC runs (64 GB RAM + a 12 GB card; docs/DEEPSEEK41.md); the UD-Q8_K_XL entry stays
# for the big machines.
DSV41_ISTA_REPO = "ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF"
DSV41_ISTA_ENGRAM = "DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf"
DSV41_ISTA_SHARD = "DeepSeek-V4.1-Flash-1017-GSQ-RCO-{quant}-{i:05d}-of-00006.gguf"
DSV41_ISTA_SHARDS = 5 # the files of a set itself (the sixth shard of its split is the Engram)
DSV41_ISTA_SHARD = "DeepSeek-V4.1-Flash-1017-GSQ-RCO-{quant}-{i:05d}-of-00004.gguf"
DSV41_DSPARK = "dspark-DeepSeek-V4.1-Flash-1017-Q8_0.gguf"
DSV41_ISTA_FILES = {
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00001-of-00004.gguf": (39358830464, "6e3f0d5ff53d00428ec32c079db9e8255cb410ccaa435e5342aaa8a47fe1339d"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00002-of-00004.gguf": (39176113248, "34d68c99fdae9948f9f0af0dafe308e805ce0a78d2c48641b24cc57242fdc0af"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00003-of-00004.gguf": (39997334720, "a08468c83955e0c4d3a9eb3f7b86c45b7bbac55d99c4640039a296a8a4b327ea"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00004-of-00004.gguf": (2188841824, "b05f26a92325aa6845cebcb3ec1f93d2e65ebf89bdc3f805695960d2f0681832"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-00001-of-00004.gguf": (39535776992, "4c65307992ab586c527ca1f6f64062aa96a33b23c02b7fed103f45f75e854798"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-00002-of-00004.gguf": (39494617536, "933461a974fcccee741bf2f9798201e72ab4aa3f8a952be56f849896ca6ea30e"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-00003-of-00004.gguf": (39423838496, "bbf91fa346a85ebaf32dd4fd5c456b534d780d381e54f46ac90783a481373240"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-00004-of-00004.gguf": (36771591232, "e5b2f8781fab688cd4bc3bc7a69651b5dbb90ed94965657c6bead8bb4774f3cf"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00001-of-00004.gguf": (39075714624, "d46efb67ccffd8fb5d7f18b423896381b9e06d8491e161c370ddf3b05b07e050"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00002-of-00004.gguf": (39388449504, "cec1b2c3da429dc768b8bb9bc4dc4403d81f74d34db660a6a34ee3e555bf2c70"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00003-of-00004.gguf": (39246891616, "9d9c2140fcb134a0b9a74dedd0e5167e68077af6d08ce7f856bce112f0a35dd3"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00004-of-00004.gguf": (20527837312, "9b790a2297ed3cdede379fc984f4a52bb95f3b23724c797af11d1fa6a69db059"),
"DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf": (110595290816, "eb19f30d368d393784e1fc54fdfaffc427ebb2110bf3762fdf5a8fbb9a2d740a"),
}
# ISTA re-published the first shard of each set on 2026-10-26 with a larger chat template (images in tool results; their PATCHING.md, and what their
# patch_chat_template.py makes of a shard 1 already downloaded). setup downloads the pinned revision (HF_REVISIONS), so DSV41_ISTA_FILES stays the older
# file; a newer shard 1 "already here" (--gguf-dir) is the same weights with the newer template and is accepted by its own size and SHA-256, never fetched.
DSV41_NEW_SHARD1 = {
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00001-of-00004.gguf": (39358841536, "a7be0d5a48e4d1c13c5535f9123d9131ab8964e5acf8a0c01d14970e4b7f4df9"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-00001-of-00004.gguf": (39535788064, "d9b949d55e27242b8afc7c2928749b888372d4c39682f9a131670d1c2555155e"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00001-of-00004.gguf": (39075725728, "2dfe9711eac1f7814aa59154d11e8f27739f8b96875dc1e667eac9f8c756e1fe"),
}
# The files the first release of these sets was downloaded as (helcig/tmp-oct26-2, 2026-10-23: model-2.00bpw-0000N-of-00004.gguf, model-2.25bpw-...,
# engram-IQ4_NL.gguf, usually in a 2.00bpw/ or 2.25bpw/ folder): testers and our boxes have them. They are the same weights: shards 2-4 are the
# same bytes as today's, and shard 1 and the Engram differ only in their GGUF header (metadata). setup accepts them from "files already here"
# (size and SHA-256 checked against these pins) and never downloads them. Not in REPO_PINS: nothing is fetched under these names.
DSV41_LEGACY_FILES = {
"model-2.00bpw-00001-of-00004.gguf": (39075713728, "78ab9efc46a26647c3e94b322c99cd7e2af261dd28b38f2712e128562db1ef47"),
"model-2.00bpw-00002-of-00004.gguf": (39388449504, "cec1b2c3da429dc768b8bb9bc4dc4403d81f74d34db660a6a34ee3e555bf2c70"),
"model-2.00bpw-00003-of-00004.gguf": (39246891616, "9d9c2140fcb134a0b9a74dedd0e5167e68077af6d08ce7f856bce112f0a35dd3"),
"model-2.00bpw-00004-of-00004.gguf": (20527837312, "9b790a2297ed3cdede379fc984f4a52bb95f3b23724c797af11d1fa6a69db059"),
"model-2.25bpw-00001-of-00004.gguf": (39535776064, "ddd13aca16faa23b08f5196b5e0daddf90f04688a271f5889eb22fa7d7d65526"),
"model-2.25bpw-00002-of-00004.gguf": (39494617536, "933461a974fcccee741bf2f9798201e72ab4aa3f8a952be56f849896ca6ea30e"),
"model-2.25bpw-00003-of-00004.gguf": (39423838496, "bbf91fa346a85ebaf32dd4fd5c456b534d780d381e54f46ac90783a481373240"),
"model-2.25bpw-00004-of-00004.gguf": (36771591232, "e5b2f8781fab688cd4bc3bc7a69651b5dbb90ed94965657c6bead8bb4774f3cf"),
"engram-IQ4_NL.gguf": (110595290720, "1f17d8ae37e9df3bb45f7ef1b4fcd1706d7b759af0413c117bf8e92aed459281"),
}
# today's name -> the name it had in the first release
DSV41_LEGACY_NAMES = {
**{DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=i): "model-2.00bpw-%05d-of-00004.gguf" % i for i in range(1, 5)},
**{DSV41_ISTA_SHARD.format(quant="IQ2_XS", i=i): "model-2.25bpw-%05d-of-00004.gguf" % i for i in range(1, 5)},
DSV41_ISTA_ENGRAM: "engram-IQ4_NL.gguf",
}
# The SIX-shard layout (0.2.8.1). On 2026-10-27 (commit a419d74c, llama.cpp b11870 and newer) ISTA-DASLab re-split the three sets: five shards per set
# (shard 1 is 5.8 MB of metadata and the tokenizer, no tensors) and the Engram as the sixth shard of the split. The files are not the pinned ones, so they
# are a second layout beside the four-shard one: setup downloads the pinned four-shard files as before (HF_REVISIONS stays at cb02422c, the owner decides
# when the default moves), and takes this layout from "files already here" (--gguf-dir / --model-path, the app's "Use a local GGUF") by size and SHA-256.
# Same model: the experts and dense weights have the same types, shapes and sizes in both layouts; the converter folded the Engram gate (q_weight *
# k_weight -> engram_gate), merged the two Engram tables into one tensor (per_layer_token_embd, the same 110,595,290,400 bytes) and added the image tokens'
# routing bias (exp_probs_b_vl, used only for picture tokens). The engine reads both (engram.gate.weight or q_weight/k_weight; ds4_model.cu).
DSV41_ISTA6_SHARD = "DeepSeek-V4.1-Flash-1017-GSQ-RCO-{quant}-{i:05d}-of-00006.gguf"
DSV41_ISTA6_SHARDS = 5 # the files of a set itself; the sixth shard of its split is the Engram
DSV41_ISTA6_FILES = {
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00001-of-00006.gguf": (5780704, "3e8ddd11441edd4bc19bacaef5dbe38818af2cbdf0820fb70f1d2d851fcc192a"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00002-of-00006.gguf": (39340012896, "be4ceb1caf1bed28e886860cf6a52adc8f5ca9eb0d2098ade39bb4179d48b323"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00003-of-00006.gguf": (38698805888, "758c66ba65236e8ce0820c21a7b6f9b2947681df8cc509f672a77722e8191b9a"),
@@ -709,13 +760,11 @@ DSV41_ISTA_FILES = {
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00003-of-00006.gguf": (39736712000, "8168d0998fc494def2e1952d83c131425a108660aae9d29190f5a8670ab62b48"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00004-of-00006.gguf": (39036908384, "9eb9b4de1968f150dfc207eb31c27be9cd9b5666a9a6246bde8a22b184b4bee0"),
"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00005-of-00006.gguf": (19923784832, "7e35f6b4e6fc46f6c4b152b593d84d683c5ece695ae6ad734f556198c041bec1"),
"DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf": (110595290816, "3dac4c54893ad7aa89103c0028500eadc78e74112cef3a2930a97e67dc9fb4f3"), # converted in place on 2026-10-27: same size, new hash
}
# The four-shard files of the earlier releases (the first release's model-2.00bpw-0000N-of-00004.gguf and the 2026-10-24 four-shard names) are not the
# files of today's sets: the shards were re-split on 2026-10-27, so none of their bytes line up with the six-shard layout, and setup no longer accepts
# them as "files already here". The tables stay (empty) because the Terminal, the app's preview and the tests read them.
DSV41_LEGACY_FILES = {}
DSV41_LEGACY_NAMES = {}
# The Engram of that commit: the same name and size as the pinned one, converted in place (one tensor, split 6 of 6), so a new SHA-256. Either file is the
# Engram of either layout (the pack reads the tables from both); the pin stays the old one, this hash is accepted beside it.
DSV41_ENGRAM_CONVERTED = (110595290816, "3dac4c54893ad7aa89103c0028500eadc78e74112cef3a2930a97e67dc9fb4f3")
DSV41_SHA_ALSO = {DSV41_ISTA_ENGRAM: (DSV41_ENGRAM_CONVERTED[1],)}
# 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 = {
@@ -724,7 +773,7 @@ DSV41_SHARED = {
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),
}
DSV41_ALL_FILES = {**DSV41_FILES, **DSV41_ISTA_FILES, **DSV41_LEGACY_FILES}
DSV41_ALL_FILES = {**DSV41_FILES, **DSV41_ISTA_FILES, **DSV41_ISTA6_FILES, **DSV41_LEGACY_FILES}
DSV41_PROFILES = ROOT / "data" / "dsv41" # the shipped hot-expert profiles (profile-2.00.bin, profile-2.25.bin, + .sha256)
DSV41_CONTEXT = 8192 # the context the engine was checked at (4096 and 8192; 64K is not tried yet)
DSV41_MAC_VISION = False # an Apple Silicon Mac: the Metal engine has not run DeepSeek's picture tower (0.2.7.1), so pictures stay off there
@@ -748,21 +797,24 @@ MULTI_FILE_FAMILIES["deepseek41"]["models"] = {
"a 12 GB card and 40-64 GB of RAM at about 5-7 tokens a second; quality about 15.5% above the original model's "
"perplexity (code and agent work 5-9%)",
"ram_gb": 40, "recipe": "ista", "subdir": None, "legacy_subdir": "2.00bpw", "profile": "profile-2.00.bin", "hf": hf(DSV41_ISTA_REPO),
"shards": [DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=i) for i in range(1, DSV41_ISTA_SHARDS + 1)],
"shards": [DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=i) for i in range(1, 5)],
"shards6": [DSV41_ISTA6_SHARD.format(quant="IQ2_XXS", i=i) for i in range(1, DSV41_ISTA6_SHARDS + 1)],
"shared": [DSV41_ISTA_ENGRAM, DSV41_SHARD.format(i=1), DSV41_DSPARK]},
"IST-DAS-2.25bpw": {
"label": "IST-DAS 2.25 bpw",
"about": "the better official version: 155 GB of model + 111 GB n-gram table + 8 GB drafter (274 GB of disk, 17 GB more than "
"2.00). About the same speed; quality about 7.3% above the original model's perplexity (code and agent work 2-3%)",
"ram_gb": 44, "recipe": "ista", "subdir": None, "legacy_subdir": "2.25bpw", "profile": "profile-2.25.bin", "hf": hf(DSV41_ISTA_REPO),
"shards": [DSV41_ISTA_SHARD.format(quant="IQ2_XS", i=i) for i in range(1, DSV41_ISTA_SHARDS + 1)],
"shards": [DSV41_ISTA_SHARD.format(quant="IQ2_XS", i=i) for i in range(1, 5)],
"shards6": [DSV41_ISTA6_SHARD.format(quant="IQ2_XS", i=i) for i in range(1, DSV41_ISTA6_SHARDS + 1)],
"shared": [DSV41_ISTA_ENGRAM, DSV41_SHARD.format(i=1), DSV41_DSPARK]},
"IST-DAS-1.75bpw": {
"label": "IST-DAS 1.75 bpw",
"about": "the smallest official version: 121 GB of model + 111 GB n-gram table + 8 GB drafter (239 GB of disk, 18 GB less than 2.00). Runs "
"where 2.00 is tight (a 12 GB card and 32-40 GB of RAM). Smallest: fine for code and agent work, noticeably weaker on plain prose; pick 2.00 if it fits",
"ram_gb": 34, "recipe": "ista", "subdir": None, "legacy_subdir": None, "profile": "profile-2.00.bin", "hf": hf(DSV41_ISTA_REPO),
"shards": [DSV41_ISTA_SHARD.format(quant="IQ1_M", i=i) for i in range(1, DSV41_ISTA_SHARDS + 1)],
"shards": [DSV41_ISTA_SHARD.format(quant="IQ1_M", i=i) for i in range(1, 5)],
"shards6": [DSV41_ISTA6_SHARD.format(quant="IQ1_M", i=i) for i in range(1, DSV41_ISTA6_SHARDS + 1)],
"shared": [DSV41_ISTA_ENGRAM, DSV41_SHARD.format(i=1), DSV41_DSPARK]},
"UD-Q8_K_XL": {
"label": "Unsloth UD-Q8_K_XL",
@@ -3127,18 +3179,17 @@ def own_gguf_is_whole(path: Path) -> bool:
return False
def verify_sha256(s: Path, size: int, sha: str, own: bool = False, repair=None, exact: bool = False) -> None:
def verify_sha256(s: Path, size: int, sha: str, own: bool = False, repair=None, also: tuple = ()) -> None:
"""A shard's size and SHA-256 against the pinned values (the Unsloth file); the result is kept in its finish mark,
so the ~5 minutes of hashing 111 GB happen once. A wrong file is deleted, so the next run downloads it again.
`repair` (a downloaded file's own re-reader, see repair_download): the wrong file is first compared with the server
piece by piece and only the damaged pieces are written again, then it is checked a second time.
`exact` (the Engram): the person's own file must be the published one, whole GGUF or not - an Engram from before ISTA-DASLab's in-place
conversion of 2026-10-27 has the same name and size and would be used as it is, and the pack then fails without saying why."""
`also`: other SHA-256 values that are the same file for Strata's purposes (the Engram ISTA-DASLab converted in place on 2026-10-27, DSV41_SHA_ALSO)."""
m = s.with_name(s.name + ".done")
if m.exists() and f"sha256 {sha}" in m.read_text(encoding="utf-8", errors="replace"):
if m.exists() and any(f"sha256 {x}" in m.read_text(encoding="utf-8", errors="replace") for x in (sha, *also)):
return
have = s.stat().st_size if s.exists() else -1
if own and have > 0 and have != size and own_gguf_is_whole(s) and not exact:
if own and have > 0 and have != size and own_gguf_is_whole(s):
# a fine-tune or another build with the layout of the published file (#3777: 96 bytes apart): recommend, never refuse
warn(f"{s.name} is {have:,} bytes; the published file is {size:,}. It is a complete GGUF file, so Strata uses it as it is; "
"it may be another version or a fine-tune, so check a few answers before you rely on it")
@@ -3146,8 +3197,7 @@ def verify_sha256(s: Path, size: int, sha: str, own: bool = False, repair=None,
if have != size:
if own: # --gguf-dir: the person's own file is never deleted by setup
fail(f"{s.name} is {have:,} bytes; the published file is {size:,}",
"it may be cut short or another version" + (" (an Engram from before ISTA-DASLab's 2026-10-27 conversion has another size too)" if exact else "")
+ "; your file was left as it is. Copy the whole published file into the folder")
"it may be cut short or another version; your file was left as it is. Copy the whole published file into the folder")
fail(f"{s.name} is {have:,} bytes, not {size:,}", "delete it and run setup again (the download restarts)")
say(f" checking {s.name} (SHA-256, {size / 1e9:.1f} GB) ...")
digest = _hash_file(s, size)
@@ -3159,15 +3209,15 @@ def verify_sha256(s: Path, size: int, sha: str, own: bool = False, repair=None,
digest = _hash_file(s, size)
else:
say(" The damaged parts could not be found this way.")
if digest != sha and digest in also:
say(f" {s.name} is the converted version ISTA-DASLab published on 2026-10-27 (the same tables in one tensor); it is used as it is")
mark(s, f"sha256 {digest}")
return
if digest != sha:
if own and own_gguf_is_whole(s) and not exact:
if own and own_gguf_is_whole(s):
warn(f"{s.name} is not the published file (SHA-256 {digest[:12]}..., expected {sha[:12]}...) but it is a complete GGUF file, so "
"Strata uses it as it is; it may be another version or a fine-tune, so check a few answers before you rely on it")
return
if own and exact:
fail(f"{s.name} is not the current published file (SHA-256 {digest}, expected {sha}): it is from before ISTA-DASLab converted it on 2026-10-27",
"the six-shard sets need the converted file. Download it again (drop --gguf-dir, or fetch it from the model's Hugging Face page); "
"your file was left as it is")
if own:
fail(f"{s.name} does not match the published file (SHA-256 {digest}, expected {sha})",
"it may be damaged or another version; your file was left as it is. Copy the whole published file into the folder")
@@ -8107,7 +8157,7 @@ def dsv41_folder(a, fam: dict, tag: str, model: str = "UD-Q8_K_XL") -> Path:
if a.gguf_dir:
folder = Path(a.gguf_dir)
d = fam["models"][model]
names = [n for s in d["shards"] for n in (s, DSV41_LEGACY_NAMES.get(s)) if n]
names = [n for s in d["shards"] for n in (s, DSV41_LEGACY_NAMES.get(s)) if n] + list(d.get("shards6") or [])
if any((folder / n).exists() for n in names):
return folder
for sub in (d.get("subdir"), d.get("legacy_subdir"), model): # the set's own folder inside (the first release used 2.00bpw/, 2.25bpw/)
@@ -8128,6 +8178,40 @@ def dsv41_pick(folder: Path, name: str) -> Path:
return folder / name
def dsv41_layout_of(md: dict, present) -> str:
"""Which layout of a set the files are: "four" (the pinned files, and the first release's names) or "six" (ISTA-DASLab's 2026-10-27 re-split,
DSV41_ISTA6_FILES). `present(name)` says whether a file is there. Six only when its files are there and the four-shard ones are not (or are
not whole while the six are): a folder holding both whole sets is used as the pinned four-shard one, as before."""
four = [bool(present(n) or (DSV41_LEGACY_NAMES.get(n) and present(DSV41_LEGACY_NAMES[n]))) for n in md["shards"]]
six = [bool(present(n)) for n in md.get("shards6") or []]
return "six" if six and any(six) and (not any(four) or (all(six) and not all(four))) else "four"
def dsv41_parts(md: dict, present) -> tuple:
"""(layout, the names of its files, the ones that are not there) for a set's files seen through `present(name)`."""
layout = dsv41_layout_of(md, present)
names = list(md["shards6"] if layout == "six" else md["shards"])
missing = [n for n in names if not present(n) and not (layout == "four" and DSV41_LEGACY_NAMES.get(n) and present(DSV41_LEGACY_NAMES[n]))]
return layout, names, missing
def dsv41_pack_layout(pack: Path) -> str | None:
""""four" or "six" when the pack names the files of that layout (tensors.txt's `file N <name>` lines), else None. The pack folder is the same for
both layouts of a set, and a pack points into the files it was made from: one made from the other layout's files must be built again."""
try:
with (Path(pack) / "tensors.txt").open(encoding="utf-8", errors="replace") as f:
for line in f:
if not line.startswith("file "):
break
if "-of-00006" in line:
return "six"
if "-of-00004" in line:
return "four"
except OSError:
pass
return None
def dsv41_shared_dir(a, fam: dict) -> Path:
"""Where the files the official sets share (the Engram, the DSpark drafter, the metadata shard) are downloaded to: one folder, so
installing the second set does not download the 111 GB Engram again."""
@@ -8172,42 +8256,11 @@ def dsv41_pack_has_tower(pack: Path) -> bool:
return "\nimage_token_id " in "\n" + txt and "vision.num_hidden_layers" in txt
def dsv41_mark_text(f: Path) -> str | None:
"""f's finish mark, or None when there is none."""
try:
return f.with_name(f.name + ".done").read_text(encoding="utf-8", errors="replace")
except OSError:
return None
def dsv41_mark_is_stale(f: Path, sha: str) -> bool:
"""Does f's finish mark record another SHA-256 than the pin's? The Engram was converted in place on 2026-10-27: the same name and size, a new hash,
so a copy downloaded and marked before that is not done, and setup fetches it again instead of hashing 110 GB to delete it. A mark with no hash in it
(a download interrupted between its finish and the check, or an older setup) is not stale by itself: it cannot be judged without hashing the file."""
text = dsv41_mark_text(f)
return text is not None and "sha256 " in text and f"sha256 {sha}" not in text
def dsv41_pack_is_of(pack: Path, names: list) -> bool:
"""Is the pack made from these files (tensors.txt's `file N <name>` lines, compared by file name)? A pack from before the six-shard sets names the
four-shard files, and its offsets point into files that are not the ones downloaded now (the Engram keeps its name but has new bytes)."""
try:
with (Path(pack) / "tensors.txt").open(encoding="utf-8", errors="replace") as f:
used = set()
for line in f:
if not line.startswith("file "):
break
used.add(Path(line.split(" ", 2)[2].strip()).name)
except (OSError, IndexError):
return False
return set(names) <= used
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 set's five files, so
another set in the same folder is not read as part of the model; the Engram, the sixth shard of the split, comes with --engram (pack_gguf counts it)."""
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", *(["--mmproj", str(mmproj)] if mmproj else []), "--out", str(pack)]
@@ -8333,7 +8386,10 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
if dsv41_context.note(ctx):
warn(f"context {dsv41_context.label(ctx)}: {dsv41_context.note(ctx)}")
folder = dsv41_folder(a, fam, tag, model)
shards = [dsv41_pick(folder, n) for n in md["shards"]]
layout = dsv41_layout_of(md, lambda n: (folder / n).exists()) if (ista and a.gguf_dir) else "four"
shards = [dsv41_pick(folder, n) for n in (md["shards6"] if layout == "six" else md["shards"])]
if layout == "six":
say(f" {folder} holds ISTA-DASLab's six-shard files of 2026-10-27 ({len(shards)} files and the Engram as the sixth): they are used where they are.")
shared_dir = dsv41_shared_dir(a, fam)
# 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.
@@ -8349,8 +8405,7 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
p = f.with_name(f.name + ".part")
return p.stat().st_size if p.is_file() else 0
left = sum(0 if f.exists() and ((done(f) and not dsv41_mark_is_stale(f, fam["sha256"][f.name][1])) or a.gguf_dir or own_files.get(f)
or f.name in DSV41_LEGACY_FILES) else fam["sha256"][f.name][0] - partial(f)
left = sum(0 if f.exists() and (done(f) or a.gguf_dir or own_files.get(f) or f.name in DSV41_LEGACY_FILES) else fam["sha256"][f.name][0] - partial(f)
for f in [*shards, *shared]) / 1e9
probe = folder if folder.exists() else (folder.parent if folder.parent.exists() else Path(a.models_dir))
free = free_gb(probe)
@@ -8363,8 +8418,9 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
f"is {left * 1e9 / 50e6 / 3600:.1f} hours. Files you already have: --gguf-dir DIR.")
else:
say(" Nothing to download: the files are already here.")
unchecked = [f for f in [*shards, *shared] if f.exists() and f"sha256 {fam['sha256'][f.name][1]}" not in
(f.with_name(f.name + ".done").read_text(encoding="utf-8", errors="replace") if done(f) else "")]
unchecked = [f for f in [*shards, *shared] if f.exists() and not any(
f"sha256 {x}" in (f.with_name(f.name + ".done").read_text(encoding="utf-8", errors="replace") if done(f) else "")
for x in (fam['sha256'][f.name][1], *DSV41_SHA_ALSO.get(f.name, ())))]
if unchecked:
gb = sum(fam["sha256"][f.name][0] for f in unchecked) / 1e9
say(f" The files already here ({gb:.0f} GB) are checked against their SHA-256 once, now: about {max(1, round(gb / 55))} minutes on a fast "
@@ -8448,25 +8504,18 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
download((md.get("hf") or fam["hf"]) + f.name, f)
if f.name in DSV41_LEGACY_FILES:
ok(f"{f.name}: a file of the first release of this set (the same weights); it is used as it is")
verify_sha256(f, *fam["sha256"][f.name], own=bool(a.gguf_dir) or f.name in DSV41_LEGACY_FILES)
for f in shared: # the Engram, the drafter, the metadata shard: once for every official set
pin = fam["sha256"][f.name]
stale = f.exists() and not own_files[f] and dsv41_mark_is_stale(f, pin[1])
mark_text = dsv41_mark_text(f)
if f.name == DSV41_ISTA_ENGRAM and f.exists() and not own_files[f] and not stale and mark_text is not None and "sha256 " not in mark_text:
say(f" checking {f.name} (SHA-256, {pin[0] / 1e9:.1f} GB): its finish mark has no hash ...")
stale = f.stat().st_size != pin[0] or _hash_file(f, pin[0]) != pin[1]
if not stale:
mark(f, f"sha256 {pin[1]}")
if stale:
warn(f"{f.name} here is from before ISTA-DASLab converted it on 2026-10-27 (its SHA-256 is not the current one): downloading the current file")
f.unlink()
f.with_name(f.name + ".done").unlink(missing_ok=True)
new = DSV41_NEW_SHARD1.get(f.name)
if new and a.gguf_dir and f.is_file() and f.stat().st_size == new[0] and f.stat().st_size != pin[0]: # shard 1 with the 2026-10-26 chat template
pin = new
ok(f"{f.name}: the version with ISTA's newer chat template (the same weights); it is used as it is")
verify_sha256(f, *pin, own=bool(a.gguf_dir) or f.name in DSV41_LEGACY_FILES)
for f in shared: # the Engram, the drafter, the metadata shard: once for every official set
if f.exists() and (done(f) or own_files[f]):
ok(f"{f.name} already here ({f.parent})")
else:
download(DSV41_SHARED[f.name] + f.name, f)
verify_sha256(f, *fam["sha256"][f.name], own=own_files[f], exact=f.name == DSV41_ISTA_ENGRAM)
verify_sha256(f, *fam["sha256"][f.name], own=own_files[f], also=DSV41_SHA_ALSO.get(f.name, ()))
ok(f"model files: {folder} ({len(shards)} shards" + (f"; shared files: {shared_dir if any(not own_files[f] for f in shared) else shared[0].parent}" if shared else "") + ")")
step(6, "preparing the model for Strata")
@@ -8477,8 +8526,8 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
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 and not dsv41_pack_is_of(pack, [f.name for f in shards] + [shared[0].name]):
warn("the pack from an earlier run was made from other files of this set (the six-shard files replaced the four-shard ones): building it again")
if have_pack and ista and dsv41_pack_layout(pack) not in (None, layout):
warn(f"the pack from an earlier run was made from the {'four' if layout == 'six' else 'six'}-shard files of this set; these are the {layout}-shard files: building it again")
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
+2 -4
View File
@@ -1286,7 +1286,7 @@ class Runner:
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]
names = [n for s in d["shards"] for n in (s, legacy.get(s)) if n] + list(d.get("shards6") or []) # (+ the six-shard layout of 2026-10-27)
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
@@ -1312,9 +1312,7 @@ class Runner:
if s.family and s.family != "deepseek41":
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"])
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())]
_layout, others, missing = mod.dsv41_parts(d, lambda n: (folder / n).exists()) # the pinned four-shard layout, or ISTA's six-shard one (0.2.8.1)
if missing:
parts = {4: "four", 5: "five", 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} "
+2 -3
View File
@@ -559,10 +559,9 @@ class ModelScreen(Base):
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())]
_layout, names, missing = mod.dsv41_parts(d, lambda n: (folder / n).exists()) # the pinned four-shard layout, or ISTA's six-shard one (0.2.8.1)
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} "
self.say(f"These are DeepSeek-V4.1-Flash {d.get('label', model)} files, but {len(missing)} of {len(names)} 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
+6 -5
View File
@@ -48,7 +48,7 @@ MEASURED = ("4 x Radeon AI PRO R9700 (32 GB) with 251 GB of RAM: prompts of 3,00
"at 25-31 tokens a second (--tp 2); one answer at a time")
# The two official IST-DAS sets (ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF, setup.py DSV41_ISTA_FILES): 5 shards each since 2026-10-27, a sixth being the Engram (the experts as IQ1_M / IQ2 / IQ3 types, the
# The two official IST-DAS sets (ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF, setup.py DSV41_ISTA_FILES): 4 shards each (the experts as IQ1_M / IQ2 / IQ3 types, the
# dense weights Q8_0 / Q5_K), plus ONE Engram (110.6 GB, IQ4_NL, shared by both sets, stays on the SSD) and the DSpark drafter (8.0 GB).
# Measured 2026-10-23 (f-dsv41-rel): quality against the original model (final files, 4,995 positions: ppl +15.5% for 2.00 [code +8.6%, agent +5.3%], +7.3% for 2.25 [code +3.2%, agent +2.2%]
# on 2.25); speed on the owner PC (RTX 5070 12 GB, 64 GB RAM, 3.6 GB/s NVMe): answers ~4.7 tokens a second, prompts 121 tokens a second at 4K and
@@ -56,18 +56,19 @@ MEASURED = ("4 x Radeon AI PRO R9700 (32 GB) with 251 GB of RAM: prompts of 3,00
# R9700: answers ~31 tokens a second, prompts 330-373 tokens a second at 8K.
ISTA_ENGRAM_BYTES = 110_595_290_816
ISTA_DSPARK_BYTES = 7_976_914_240
# (the six-shard layout of the same sets, setup.py DSV41_ISTA6_FILES, is 74 KB larger: 2.00 138,238,967,104, 2.25 155,225,898,368, 1.75 120,721,194,336 bytes; the figures below are the pinned four-shard ones)
ISTA_META_BYTES = 5_780_589 # the first shard of Unsloth's UD-Q8_K_XL: only the metadata --engram-meta reads
ISTA_SETS = {
"IST-DAS-2.00bpw": {"title": "IST-DAS 2.00 bpw", "set_bytes": 138_238_967_104, "experts_gb": 132.07, "profile": "profile-2.00.bin",
"IST-DAS-2.00bpw": {"title": "IST-DAS 2.00 bpw", "set_bytes": 138_238_893_056, "experts_gb": 132.07, "profile": "profile-2.00.bin",
"ppl": "15.5%", "ram_ok_gb": 40.0, "ram_great_gb": 160.0, "disk_total": 257.0,
"quality": "about 15.5% above the original model's perplexity (code and agent work about 5-9% above)"},
# IQ1_M (1.75 bpw): 120,721,194,336 bytes of shards; experts = the shards minus the 6.16 GB of dense weights. RAM class from the experts' size against
# IQ1_M (1.75 bpw): 120,721,120,256 bytes of shards; experts = the shards minus the 6.16 GB of dense weights. RAM class from the experts' size against
# the 2.00 set's measured 40 GB (not measured on a computer yet); quality: the H100's 4,995-position score (KL 0.217, ppl 3.80, +21%; code +8.9%, agent +10.2%, English prose +53%).
"IST-DAS-1.75bpw": {"title": "IST-DAS 1.75 bpw", "set_bytes": 120_721_194_336, "experts_gb": 114.56, "profile": "profile-2.00.bin",
"IST-DAS-1.75bpw": {"title": "IST-DAS 1.75 bpw", "set_bytes": 120_721_120_256, "experts_gb": 114.56, "profile": "profile-2.00.bin",
"ppl": "21%", "ram_ok_gb": 34.0, "disk_total": 239.0,
"quality": "about 21% above the original model's perplexity: the smallest, fine for code and agent work, noticeably weaker "
"on plain prose; pick 2.00 if it fits"},
"IST-DAS-2.25bpw": {"title": "IST-DAS 2.25 bpw", "set_bytes": 155_225_898_368, "experts_gb": 149.06, "profile": "profile-2.25.bin",
"IST-DAS-2.25bpw": {"title": "IST-DAS 2.25 bpw", "set_bytes": 155_225_824_256, "experts_gb": 149.06, "profile": "profile-2.25.bin",
"ppl": "7.3%", "ram_ok_gb": 44.0, "ram_great_gb": 176.0, "disk_total": 274.0,
"quality": "about 7.3% above the original model's perplexity (code and agent work about 2-3% above), "
"the better of the two, 17 GB more disk"},
+23 -10
View File
@@ -7,6 +7,10 @@ Qwen fingerprints, so a folder with such a set ended in "the folder holds more t
sizes alone: no tensor is read and no 40 GB file is hashed in a preview (setup checks the SHA-256 once, when the set is adopted).
The tables are setup.py's own (read from it, never copied), so a new size added there is recognised here.
Three kinds of files are the same set: the pinned four-shard files (and the first release's names), the four-shard files as ISTA-DASLab re-published
their shard 1 on 2026-10-26 (a larger chat template: DSV41_NEW_SHARD1, what the Hub's last four-shard commit 653a9874 serves), and, since 0.2.8.1, ISTA-DASLab's
six-shard layout of 2026-10-27 (DSV41_ISTA6_FILES). setup downloads only the first; it takes the other two from files already here.
"""
from __future__ import annotations
@@ -19,8 +23,8 @@ FAMILY = "deepseek41"
def tables() -> dict | None:
"""{model: {"label", "shards": {name: bytes}, "legacy": {name: bytes}}} for the official sets and {"engram": {name: bytes}}; None when
setup.py cannot be read (the preview then behaves as before)."""
"""{model: {"label", "shards": {name: bytes}, "legacy": {name: bytes}, "new1": {name: bytes}, "six": {name: bytes}}} for the official sets and
{"engram": {name: bytes}}; None when setup.py cannot be read (the preview then behaves as before)."""
global _TABLES
if _TABLES is not None:
return _TABLES or None
@@ -30,13 +34,16 @@ def tables() -> dict | None:
spec.loader.exec_module(module) # type: ignore[union-attr]
family = module.MULTI_FILE_FAMILIES[FAMILY]
ista, legacy, renamed = module.DSV41_ISTA_FILES, module.DSV41_LEGACY_FILES, module.DSV41_LEGACY_NAMES
new1, six = getattr(module, "DSV41_NEW_SHARD1", {}), getattr(module, "DSV41_ISTA6_FILES", {})
result: dict = {"sets": {}, "engram": {}}
for model, entry in family["models"].items():
if entry.get("recipe") != "ista":
continue # Unsloth's 508 GB set is not an "already have it" case of the app
shards = {name: ista[name][0] for name in entry["shards"]}
old = {renamed[name]: legacy[renamed[name]][0] for name in entry["shards"] if name in renamed and renamed[name] in legacy}
result["sets"][model] = {"label": entry.get("label", model), "shards": shards, "legacy": old}
result["sets"][model] = {"label": entry.get("label", model), "shards": shards, "legacy": old,
"new1": {name: new1[name][0] for name in entry["shards"] if name in new1},
"six": {name: six[name][0] for name in entry.get("shards6") or [] if name in six}}
for name in (module.DSV41_ISTA_ENGRAM, renamed.get(module.DSV41_ISTA_ENGRAM)):
if name and (name in ista or name in legacy):
result["engram"][name] = (ista.get(name) or legacy[name])[0]
@@ -48,24 +55,30 @@ def tables() -> dict | None:
def match(files: dict[str, int]) -> list[dict]:
"""The official sets the files {name: bytes} of one folder belong to, best first: complete sets before partial ones.
Each: {"model", "label", "complete", "present": [names], "missing": [names], "wrong_size": [names], "legacy": bool, "engram": name|None}.
A set counts when at least one of its shards is there; names and sizes are the pinned ones."""
Each: {"model", "label", "complete", "present": [names], "missing": [names], "wrong_size": [names], "legacy": bool, "layout": "four"|"legacy"|"six",
"engram": name|None}. A set counts when at least one of its shards is there; names and sizes are the pinned ones (shard 1 of the four-shard layout also
at the size of its 2026-10-26 re-publication). A folder that holds the whole four-shard set and the whole six-shard set of one model is that
model once (the pinned four-shard files are the ones used)."""
known = tables()
if not known:
return []
engram = next((name for name in known["engram"] if files.get(name) == known["engram"][name]), None)
found = []
for model, entry in known["sets"].items():
for legacy, pinned in ((False, entry["shards"]), (True, entry["legacy"])):
for layout, pinned in (("four", entry["shards"]), ("legacy", entry["legacy"]), ("six", entry.get("six") or {})):
if not pinned:
continue
present = [n for n in pinned if n in files]
if not present:
continue
wrong = [n for n in present if files[n] != pinned[n]]
ok_sizes = {n: {pinned[n], *([entry["new1"][n]] if layout == "four" and n in entry.get("new1", {}) else [])} for n in pinned}
wrong = [n for n in present if files[n] not in ok_sizes[n]]
missing = [n for n in pinned if n not in files]
found.append({"model": model, "label": entry["label"], "legacy": legacy, "present": sorted(present), "missing": missing,
"wrong_size": wrong, "complete": not missing and not wrong, "engram": engram,
"bytes": sum(pinned[n] for n in present if n not in wrong) + (known["engram"][engram] if engram else 0)})
found.append({"model": model, "label": entry["label"], "legacy": layout == "legacy", "layout": layout, "present": sorted(present),
"missing": missing, "wrong_size": wrong, "complete": not missing and not wrong, "engram": engram,
"newer_first": [n for n in present if n not in wrong and files[n] != pinned[n]],
"bytes": sum(files[n] for n in present if n not in wrong) + (known["engram"][engram] if engram else 0)})
pinned_whole = {row["model"] for row in found if row["complete"] and row["layout"] != "six"}
found = [row for row in found if not (row["layout"] == "six" and row["complete"] and row["model"] in pinned_whole)]
found.sort(key=lambda row: (not row["complete"], len(row["missing"]) + len(row["wrong_size"]), row["model"]))
return found
+5 -1
View File
@@ -670,9 +670,13 @@ def _dsv41_plan(path: Path, details) -> dict | None:
messages.append(f"This is DeepSeek-V4.1-Flash, {row['label']}: all {len(row['present'])} model files are here"
+ (", and the n-gram table." if row["engram"] else "."))
if not row["engram"]:
messages.append("The n-gram table (111 GB) is not in this folder: setup downloads it, or put DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf beside the model files.")
messages.append("The n-gram table (111 GB) is not in this folder: setup downloads it, or put engram-IQ4_NL.gguf beside the model files.")
if row["legacy"]:
messages.append("These are the file names of the first release; Strata uses them as they are.")
if row.get("layout") == "six":
messages.append("These are ISTA-DASLab's six-shard files of 27 October 2026 (the Engram is the sixth part); Strata uses them as they are.")
if row.get("newer_first"):
messages.append("The first part is the version ISTA-DASLab re-published on 26 October 2026 (a larger chat template); Strata uses it as it is.")
messages.append("Strata checks the files once when it sets them up (about 5 minutes on a fast drive); nothing is copied or downloaded for them.")
sizes = _dsv41_files(place)
wanted = list(row["present"]) + ([row["engram"]] if row["engram"] else [])
+61 -6
View File
@@ -1,5 +1,6 @@
"""The app's "I already have the model" preview recognises an official DeepSeek-V4.1-Flash set (IST-DAS 1.75 / 2.00 / 2.25 bpw), under the
official file names or the first release's, from the pinned names and sizes. Qwen previews are unchanged (tests/terminal/test_models*.py)."""
official file names or the first release's, from the pinned names and sizes; since 0.2.8.1 also the four-shard files as ISTA-DASLab re-published
their shard 1 on 2026-10-26 (#4237) and ISTA-DASLab's six-shard layout of 2026-10-27. Qwen previews are unchanged (tests/terminal/test_models*.py)."""
import tempfile
import unittest
from pathlib import Path
@@ -10,9 +11,11 @@ from strata_control import dsv41_sets, models
T = dsv41_sets.tables()
def files_of(model, legacy=False, engram="official", drop=(), wrong=()):
def files_of(model, legacy=False, engram="official", drop=(), wrong=(), layout=None):
entry = T["sets"][model]
pinned = dict(entry["legacy"] if legacy else entry["shards"])
pinned = dict(entry["six"] if layout == "six" else entry["legacy"] if legacy else entry["shards"])
if layout == "four-newer-first": # the four-shard files after ISTA-DASLab's 2026-10-26 re-publication of shard 1
pinned.update(entry["new1"])
out = {n: (s + 1 if n in wrong else s) for n, s in pinned.items() if n not in drop}
if engram:
name = next(n for n in T["engram"] if (n.startswith("engram") == (engram == "legacy")))
@@ -33,7 +36,7 @@ class DeepSeekPreview(unittest.TestCase):
def test_the_tables_come_from_setup_and_cover_the_three_official_sizes(self):
self.assertEqual(sorted(T["sets"]), ["IST-DAS-1.75bpw", "IST-DAS-2.00bpw", "IST-DAS-2.25bpw"])
self.assertEqual(list(T["engram"]), ["DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf"])
self.assertEqual(len(T["engram"]), 2)
def test_each_official_set_is_recognised_with_its_size_name(self):
for model in T["sets"]:
@@ -43,7 +46,7 @@ class DeepSeekPreview(unittest.TestCase):
plan, folder = self.preview(files_of(model, legacy=legacy, engram="legacy" if legacy else "official"))
self.assertEqual(plan["file_set_status"], "plausible", (model, legacy, plan["issues"]))
self.assertEqual((plan["candidate_selection"]["family"], plan["candidate_selection"]["model"]), ("deepseek41", model))
self.assertEqual(plan["file_count"], 6) # the set's five files and the Engram, the sixth shard
self.assertEqual(plan["file_count"], 5)
self.assertEqual(plan["candidate_selection"]["setup_args_hint"][-2:], ["--gguf-dir", str(folder)])
self.assertEqual(plan["issues"], [])
self.assertTrue(plan["messages"])
@@ -52,7 +55,7 @@ class DeepSeekPreview(unittest.TestCase):
def test_without_the_engram_it_is_still_the_set_and_says_what_setup_fetches(self):
plan, _ = self.preview(files_of("IST-DAS-2.00bpw", engram=None))
self.assertEqual(plan["file_set_status"], "plausible")
self.assertEqual(plan["file_count"], 5)
self.assertEqual(plan["file_count"], 4)
self.assertTrue(any("n-gram table" in m and "downloads it" in m for m in plan["messages"]))
def test_a_missing_or_short_shard_names_the_file(self):
@@ -84,6 +87,58 @@ class DeepSeekPreview(unittest.TestCase):
self.assertNotIn("unsupported_or_missing_architecture", plan["issues"])
self.assertFalse(any("not supported" in m for m in plan["messages"]))
def test_the_four_shard_files_with_the_republished_first_shard_are_the_set_4237(self):
for model in T["sets"]:
plan, folder = self.preview(files_of(model, layout="four-newer-first"))
self.assertEqual(plan["file_set_status"], "plausible", (model, plan["issues"]))
self.assertEqual(plan["candidate_selection"]["model"], model)
self.assertEqual(plan["issues"], [])
self.assertEqual(plan["file_count"], 5)
self.assertTrue(any("re-published" in m for m in plan["messages"]), plan["messages"])
first = sorted(T["sets"]["IST-DAS-2.00bpw"]["shards"])[0] # a cut copy of the new first shard is still refused
listing = files_of("IST-DAS-2.00bpw", layout="four-newer-first")
listing[first] = T["sets"]["IST-DAS-2.00bpw"]["new1"][first] - (1 << 20)
plan, _ = self.preview(listing)
self.assertEqual(plan["missing_shards"], [first])
def test_the_six_shard_files_are_the_set(self):
for model in T["sets"]:
plan, folder = self.preview(files_of(model, layout="six"))
self.assertEqual(plan["file_set_status"], "plausible", (model, plan["issues"]))
self.assertEqual((plan["candidate_selection"]["family"], plan["candidate_selection"]["model"]), ("deepseek41", model))
self.assertEqual(plan["file_count"], 6) # the five files and the Engram, the sixth shard
self.assertEqual(plan["candidate_selection"]["setup_args_hint"][-2:], ["--gguf-dir", str(folder)])
self.assertTrue(any("six-shard" in m for m in plan["messages"]), plan["messages"])
plan, _ = self.preview(files_of("IST-DAS-1.75bpw", layout="six", engram=None))
self.assertEqual(plan["file_set_status"], "plausible")
self.assertTrue(any("n-gram table" in m and "downloads it" in m for m in plan["messages"]))
first = sorted(T["sets"]["IST-DAS-2.25bpw"]["six"])[0] # one file picked
plan, _ = self.preview(files_of("IST-DAS-2.25bpw", layout="six"), picked=first)
self.assertEqual(plan["candidate_selection"]["model"], "IST-DAS-2.25bpw")
def test_a_six_shard_set_with_a_missing_or_cut_file_names_the_file(self):
names = sorted(T["sets"]["IST-DAS-2.00bpw"]["six"])
plan, _ = self.preview(files_of("IST-DAS-2.00bpw", layout="six", drop=(names[2],)))
self.assertEqual(plan["file_set_status"], "invalid_or_incomplete")
self.assertEqual(plan["missing_shards"], [names[2]])
self.assertIsNone(plan["candidate_selection"])
listing = files_of("IST-DAS-2.00bpw", layout="six")
listing[names[1]] -= 1 << 20
plan, _ = self.preview(listing)
self.assertEqual(plan["missing_shards"], [names[1]])
self.assertIsNone(plan["candidate_selection"])
def test_a_folder_with_both_whole_layouts_of_one_set_is_that_set_once(self):
listing = {**files_of("IST-DAS-2.00bpw"), **files_of("IST-DAS-2.00bpw", layout="six")}
plan, _ = self.preview(listing)
self.assertNotIn("multiple_model_groups", plan["issues"])
self.assertEqual(plan["candidate_selection"]["model"], "IST-DAS-2.00bpw")
self.assertEqual(plan["file_count"], 5) # the pinned four-shard files and the Engram
self.assertFalse(any("six-shard" in m for m in plan["messages"]))
listing = {**files_of("IST-DAS-2.00bpw", layout="six"), **files_of("IST-DAS-2.25bpw")} # two different sets still ask
plan, _ = self.preview(listing)
self.assertIn("multiple_model_groups", plan["issues"])
def test_other_files_are_not_claimed(self):
with tempfile.TemporaryDirectory() as tmp:
with mock.patch.object(models, "_dsv41_files", return_value={"Qwen3.8-Flash-Next-GSQ-RCO-IQ1_M-00001-of-00002.gguf": 5, "x.gguf": 3}):
@@ -85,13 +85,60 @@ class OwnDeepSeekFiles(unittest.TestCase):
d = Path(d)
self.touch_set(d / "a", new)
self.assertEqual(Runner.deepseek_set_in(setup, d / "a")[0], "IST-DAS-2.00bpw")
self.touch_set(d / "b" / "2.25bpw", fam["models"]["IST-DAS-2.25bpw"]["shards"]) # (the first release's folder name, today's file names)
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_the_six_shard_names_are_recognised_like_the_pinned_ones(self):
from strata_cli.launch.runner import Runner
fam = setup.MULTI_FILE_FAMILIES["deepseek41"]
with tempfile.TemporaryDirectory() as d:
d = Path(d)
self.touch_set(d / "a", fam["models"]["IST-DAS-2.00bpw"]["shards6"])
self.assertEqual(Runner.deepseek_set_in(setup, d / "a")[0], "IST-DAS-2.00bpw")
self.touch_set(d / "b" / "2.25bpw", fam["models"]["IST-DAS-2.25bpw"]["shards6"])
m, _entry, folder = Runner.deepseek_set_in(setup, d / "b")
self.assertEqual((m, folder), ("IST-DAS-2.25bpw", d / "b" / "2.25bpw"))
def deepseek_files(self, folder: Path):
from strata_cli.launch import settings as S
from strata_cli.launch.runner import Runner
catalog = mock.MagicMock()
catalog.strata.setup_module.return_value = setup
r = Runner(S.LaunchSettings(model_path=str(folder)), catalog=catalog)
return r, r.deepseek_files()
def test_launch_model_path_takes_a_whole_six_shard_set_and_names_what_is_missing_from_an_incomplete_one(self):
from strata_cli.launch.runner import LaunchError
six = setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-1.75bpw"]["shards6"]
with tempfile.TemporaryDirectory() as d:
self.touch_set(Path(d) / "whole", six)
r, got = self.deepseek_files(Path(d) / "whole")
self.assertTrue(got)
self.assertEqual((r.s.family, r.s.model), ("deepseek41", "IST-DAS-1.75bpw"))
self.touch_set(Path(d) / "cut", [n for n in six if "-00003-" not in n])
with self.assertRaises(LaunchError) as cm:
self.deepseek_files(Path(d) / "cut")
self.assertIn("is in five parts and 1 of them are not in", str(cm.exception))
self.assertIn("-00003-of-00006.gguf", str(cm.exception))
def test_the_guided_screen_takes_a_six_shard_set_and_names_a_missing_part(self):
from strata_cli.launch import settings as S
six = setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards6"]
with tempfile.TemporaryDirectory() as d:
self.touch_set(Path(d) / "whole", six)
cls, f, said = self.screen(S.LaunchSettings())
self.assertTrue(cls.check_own_deepseek(f, str(Path(d) / "whole")))
self.assertEqual((f.ctx.settings.family, f.ctx.settings.model), ("deepseek41", "IST-DAS-2.00bpw"))
self.touch_set(Path(d) / "cut", six[:4])
cls, f, said = self.screen(S.LaunchSettings())
self.assertTrue(cls.check_own_deepseek(f, str(Path(d) / "cut")))
self.assertIn("1 of 5 parts are not in", " ".join(said))
def test_other_models_files_are_not_deepseeks(self):
from strata_cli.launch.runner import Runner
with tempfile.TemporaryDirectory() as d:
+13 -6
View File
@@ -260,7 +260,7 @@ class DiskCountsOnlyTheRest(unittest.TestCase):
self.s.data_dir = lambda: Path(self.tmp.name)
self.hw = {"ram_gb": 64.0, "gpus": [CARD], "engine_vendor": "nvidia", "disk_free_gb": 176.0}
def put_files(self, model="IST-DAS-2.00bpw"):
def put_files(self, model="IST-DAS-2.00bpw", legacy=False):
S = self.s.setup_module()
fam = S.MULTI_FILE_FAMILIES["deepseek41"]
md = fam["models"][model]
@@ -269,8 +269,10 @@ class DiskCountsOnlyTheRest(unittest.TestCase):
for where, names in ((models / (fam["tag"] + model), md["shards"]), (models / (fam["tag"] + "shared"), md["shared"])):
where.mkdir(parents=True, exist_ok=True)
for n in names:
(where / n).write_bytes(b"x" * 8)
sizes[n] = (8, S.DSV41_ALL_FILES[n][1])
name = S.DSV41_LEGACY_NAMES.get(n, n) if legacy and n in S.DSV41_LEGACY_NAMES else n
real = S.DSV41_ALL_FILES[name][0]
(where / name).write_bytes(b"x" * 8)
sizes[name] = (8, S.DSV41_ALL_FILES[name][1])
return sizes
def test_with_every_file_in_place_a_small_disk_is_not_tight(self):
@@ -279,6 +281,11 @@ class DiskCountsOnlyTheRest(unittest.TestCase):
words = self.s.dsv41_words(self.hw, "IST-DAS-2.00bpw")
self.assertNotIn("free disk space", words)
def test_the_first_releases_names_count_too(self):
S = self.s.setup_module()
with mock.patch.dict(S.DSV41_ALL_FILES, self.put_files(legacy=True)):
self.assertNotIn("free disk space", self.s.dsv41_words(self.hw, "IST-DAS-2.00bpw"))
def test_with_nothing_in_place_176_gb_is_tight_for_the_257_gb_set(self):
words = self.s.dsv41_words(self.hw, "IST-DAS-2.00bpw")
self.assertIn("free disk space", words)
@@ -287,12 +294,12 @@ class DiskCountsOnlyTheRest(unittest.TestCase):
def test_only_part_of_the_files_means_only_the_rest_is_counted(self):
S = self.s.setup_module()
sizes = self.put_files()
first = S.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards"][1]
first = S.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards"][0]
part = dict(sizes)
part[first] = (S.DSV41_ALL_FILES[first][0], sizes[first][1]) # shard 2 is not here at its real size: the rest of the files are
part[first] = (S.DSV41_ALL_FILES[first][0], sizes[first][1]) # shard 1 is not here at its real size: the rest of the files are
(Path(self.tmp.name) / "models" / ("deepseek-v4.1-flash-IST-DAS-2.00bpw") / first).unlink()
with mock.patch.dict(S.DSV41_ALL_FILES, part):
hw = {**self.hw, "disk_free_gb": 46.0} # shard 2 is 39.5 GB: 46 GB is enough for it plus the 6 GB of room
hw = {**self.hw, "disk_free_gb": 46.0} # shard 1 is 39.1 GB: 46 GB is enough for it plus the 6 GB of room
self.assertNotIn("free disk space", self.s.dsv41_words(hw, "IST-DAS-2.00bpw"))
hw = {**self.hw, "disk_free_gb": 44.0}
self.assertIn("free disk space", self.s.dsv41_words(hw, "IST-DAS-2.00bpw"))
+9
View File
@@ -85,6 +85,15 @@ class SixShardSplit(unittest.TestCase):
self.assertEqual(PG.engram_is_last_shard(str(CONVERTED), 6, shards), 1)
self.assertEqual(PG.engram_is_last_shard(None, 6, shards), 0) # no --engram: the five are five of six
def test_the_pinned_four_shard_releases_engram_counts_too_it_has_the_same_tables(self):
with tempfile.TemporaryDirectory() as d:
shards = self.model_shards(Path(d))
g = PG.Gguf(FIXTURE)
self.assertTrue(PG.is_engram_file(g)) # general.architecture deepseek41-engram
self.assertEqual(PG.engram_is_last_shard(str(FIXTURE), 6, shards), 1) # six-shard shards with the Engram of the pinned four-shard release
self.assertEqual(PG.engram_is_last_shard(str(FIXTURE), 6, self.model_shards(Path(d), 4)), 0) # still five of six when a shard is missing
self.assertEqual(PG.engram_is_last_shard(str(FIXTURE), 4, self.model_shards(Path(d), 4)), 0) # the four-shard sets do not need it counted
def test_it_never_counts_when_a_shard_is_missing_the_split_differs_or_the_path_is_no_file(self):
with tempfile.TemporaryDirectory() as d:
d = Path(d)
+5 -2
View File
@@ -366,14 +366,17 @@ def is_engram_file(g) -> bool:
def engram_is_last_shard(explicit: str | None, split: int, shards: list) -> int:
"""1 when the model's split ends in the Engram table: ISTA-DASLab's six-shard sets (llama.cpp b11870 and newer) declare split.count 6 with five
model shards, and the sixth is the Engram file shared by all their sets, passed as --engram (a single file) instead of in --shards. It counts only
when it is one file that is not already among the shards, declares the same split as number count-1, and holds exactly one tensor,
per_layer_token_embd.weight (the converted Engram has no general.architecture, so is_engram_file cannot tell it). Else 0."""
when it is one file that is not already among the shards and is either the Engram of the pinned four-shard release (general.architecture
deepseek41-engram: the same tables, so it serves the six-shard shards too) or the converted one: no general.architecture, the same split as number
count-1, exactly one tensor, per_layer_token_embd.weight. Else 0."""
if not explicit or len(shards) != split - 1:
return 0
path = pathlib.Path(explicit).expanduser().resolve()
if not path.is_file() or any(os.path.samefile(path, p) for p in shards):
return 0
g = Gguf(path)
if is_engram_file(g):
return 1
return int(int(g.kv.get("split.count", 0)) == split and int(g.kv.get("split.no", -1)) == split - 1
and [t[0] for t in g.tensors] == ["per_layer_token_embd.weight"])
+243 -172
View File
@@ -171,7 +171,7 @@ class Install(unittest.TestCase):
self.calls.append(("config", path.name))
patches = [mock.patch.object(setup, "download", lambda url, dst, what=None: self.calls.append(("get", url, dst))),
mock.patch.object(setup, "verify_sha256", lambda s, size, sha, own=False, exact=False: self.calls.append(("sha", s.name, own, exact))),
mock.patch.object(setup, "verify_sha256", lambda s, size, sha, own=False, also=(): self.calls.append(("sha", s.name, own))),
mock.patch.object(setup, "free_gb", lambda p: 900.0),
mock.patch.object(setup, "github_reachable", lambda timeout=10.0: self.github_up),
mock.patch.object(setup, "pip_install", lambda *a, **k: None),
@@ -420,23 +420,19 @@ class OfficialSets(unittest.TestCase):
fam = setup.MULTI_FILE_FAMILIES["deepseek41"]
self.assertEqual(list(fam["models"]), ["IST-DAS-2.00bpw", "IST-DAS-2.25bpw", "IST-DAS-1.75bpw", "UD-Q8_K_XL"]) # the official sets first
repo = "ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF"
self.assertEqual(setup.HF_REVISIONS[repo], "a419d74cd28d5b9f8c5e2b9077d11a609c17bc32")
self.assertEqual(setup.HF_REVISIONS[repo], "cb02422c900df489cea5833e8a92171224059b3c")
self.assertIs(setup.REPO_PINS[repo], setup.DSV41_ISTA_FILES)
self.assertNotIn("helcig/tmp-oct26-2", setup.HF_REVISIONS) # the first release's repository is only remembered as local names
self.assertEqual(setup.DSV41_ISTA_REPO, repo)
self.assertEqual(len(setup.DSV41_ISTA_FILES), 16) # 3 x 5 shards (the sixth shard of each split is the Engram) + the Engram
self.assertEqual(len(setup.DSV41_ISTA_FILES), 13) # 3 x 4 shards + the Engram
for n, (size, sha) in setup.DSV41_ISTA_FILES.items():
self.assertRegex(sha, r"^[0-9a-f]{64}$", n)
self.assertTrue(n == setup.DSV41_ISTA_ENGRAM or n.endswith("-of-00006.gguf"), n)
eng = setup.DSV41_ISTA_FILES["DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf"]
self.assertEqual(eng, (110_595_290_816, "3dac4c54893ad7aa89103c0028500eadc78e74112cef3a2930a97e67dc9fb4f3"))
self.assertEqual(eng, (110_595_290_816, "eb19f30d368d393784e1fc54fdfaffc427ebb2110bf3762fdf5a8fbb9a2d740a"))
self.assertEqual(setup.DSV41_ALL_FILES["dspark-DeepSeek-V4.1-Flash-1017-Q8_0.gguf"],
(7_976_914_240, "6ba6ac1b331c540691a209e7fc97dec2a24e295acb1e755c84c7d24a4373927a"))
sums = {m: sum(setup.DSV41_ALL_FILES[n][0] for n in fam["models"][m]["shards"]) for m in list(fam["models"])[:3]}
self.assertEqual(sums, {"IST-DAS-2.00bpw": 138238967104, "IST-DAS-2.25bpw": 155225898368, "IST-DAS-1.75bpw": 120721194336})
for m in list(fam["models"])[:3]: # five files of the set; the Engram is the sixth shard of the split
self.assertEqual(len(fam["models"][m]["shards"]), setup.DSV41_ISTA_SHARDS)
self.assertTrue(fam["models"][m]["shards"][0].endswith("-00001-of-00006.gguf"))
self.assertEqual(sums, {"IST-DAS-2.00bpw": 138238893056, "IST-DAS-2.25bpw": 155225824256, "IST-DAS-1.75bpw": 120721120256})
self.assertEqual(sums["IST-DAS-1.75bpw"], dsv41_fit.ISTA_SETS["IST-DAS-1.75bpw"]["set_bytes"])
self.assertEqual(sums["IST-DAS-2.00bpw"], dsv41_fit.ISTA_SETS["IST-DAS-2.00bpw"]["set_bytes"])
self.assertEqual(sums["IST-DAS-2.25bpw"], dsv41_fit.ISTA_SETS["IST-DAS-2.25bpw"]["set_bytes"])
@@ -446,8 +442,8 @@ class OfficialSets(unittest.TestCase):
for n in fam["models"][m]["shared"]:
self.assertIn(n, setup.DSV41_SHARED)
self.assertIn(n, setup.DSV41_ALL_FILES)
self.assertRegex(setup.DSV41_SHARED[setup.DSV41_ISTA_ENGRAM], r"ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF/resolve/a419d74c[0-9a-f]{32}/$")
self.assertRegex(fam["models"]["IST-DAS-2.25bpw"]["hf"], r"ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF/resolve/a419d74c[0-9a-f]{32}/$")
self.assertRegex(setup.DSV41_SHARED[setup.DSV41_ISTA_ENGRAM], r"ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF/resolve/cb02422c[0-9a-f]{32}/$")
self.assertRegex(fam["models"]["IST-DAS-2.25bpw"]["hf"], r"ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF/resolve/cb02422c[0-9a-f]{32}/$")
def test_shipped_profiles_match_their_hashes(self):
import hashlib
@@ -518,64 +514,153 @@ class SharedFiles(unittest.TestCase):
self.assertEqual(got, f)
class EarlierFourShardFiles(unittest.TestCase):
"""The four-shard files of the earlier releases are not the files of the six-shard sets (re-split on 2026-10-27): never taken for them."""
class LegacyFiles(unittest.TestCase):
"""Files of the first release (model-2.00bpw-0000N-of-00004.gguf, engram-IQ4_NL.gguf, often in a 2.00bpw/ folder) are the same weights: accepted."""
def test_no_four_shard_name_is_pinned_or_mapped(self):
self.assertEqual((setup.DSV41_LEGACY_FILES, setup.DSV41_LEGACY_NAMES), ({}, {}))
self.assertFalse([n for n in setup.DSV41_ALL_FILES if n.endswith("-of-00004.gguf") and ("GSQ-RCO" in n or n.startswith("model-"))])
self.assertFalse([n for n in setup.REPO_PINS["ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF"] if "-of-00004" in n])
def test_the_old_pins_are_the_old_files_and_the_unchanged_shards_match_today_s(self):
for i in (2, 3, 4): # same bytes: same size and SHA-256 under both names
new = setup.DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=i)
self.assertEqual(setup.DSV41_ALL_FILES[new], setup.DSV41_LEGACY_FILES["model-2.00bpw-%05d-of-00004.gguf" % i])
new = setup.DSV41_ISTA_SHARD.format(quant="IQ2_XS", i=i)
self.assertEqual(setup.DSV41_ALL_FILES[new], setup.DSV41_LEGACY_FILES["model-2.25bpw-%05d-of-00004.gguf" % i])
self.assertNotEqual(setup.DSV41_ALL_FILES[setup.DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=1)],
setup.DSV41_LEGACY_FILES["model-2.00bpw-00001-of-00004.gguf"]) # shard 1 and the Engram differ in their header only
self.assertNotIn("model-2.00bpw-00001-of-00004.gguf", setup.DSV41_ISTA_FILES) # (never downloaded under the old names)
self.assertNotIn("model-2.00bpw-00001-of-00004.gguf", setup.REPO_PINS["ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF"])
def test_pick_does_not_substitute_an_old_name(self):
def test_pick_prefers_today_s_name_then_the_old_one(self):
with tempfile.TemporaryDirectory() as d:
folder = Path(d)
new = setup.DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=2)
self.assertEqual(setup.dsv41_pick(folder, new), folder / new) # nothing there: where it will be downloaded
(folder / "model-2.00bpw-00002-of-00004.gguf").write_bytes(b"x")
self.assertEqual(setup.dsv41_pick(folder, new), folder / new) # where it will be downloaded
self.assertEqual(setup.dsv41_pick(folder, new).name, "model-2.00bpw-00002-of-00004.gguf")
(folder / new).write_bytes(b"y")
self.assertEqual(setup.dsv41_pick(folder, new).name, new)
def test_the_folder_with_six_shard_names_is_found_from_the_parent(self):
def test_the_folder_of_the_first_release_is_found_from_the_parent(self):
with tempfile.TemporaryDirectory() as d:
sub = Path(d) / "2.00bpw"
sub.mkdir()
first = setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards"][0]
(sub / first).write_bytes(b"x")
(sub / "model-2.00bpw-00001-of-00004.gguf").write_bytes(b"x")
fam = setup.MULTI_FILE_FAMILIES["deepseek41"]
a = argparse.Namespace(gguf_dir=d, models_dir=d)
self.assertEqual(setup.dsv41_folder(a, fam, "t", "IST-DAS-2.00bpw"), sub)
a2 = argparse.Namespace(gguf_dir=str(sub), models_dir=d)
self.assertEqual(setup.dsv41_folder(a2, fam, "t", "IST-DAS-2.00bpw"), sub)
class ConvertedEngram(unittest.TestCase):
"""ISTA-DASLab converted the Engram in place on 2026-10-27: same name and size, new hash. A copy from before must never be taken for the new one."""
def test_a_finish_mark_with_another_hash_is_stale_and_other_marks_are_not(self):
def test_the_old_engram_name_is_found(self):
with tempfile.TemporaryDirectory() as d:
f = Path(d) / "e.gguf"
f.write_bytes(b"x")
self.assertFalse(setup.dsv41_mark_is_stale(f, "a" * 64)) # no mark
f.with_name("e.gguf.done").write_text("2026-10-24 12:00")
self.assertFalse(setup.dsv41_mark_is_stale(f, "a" * 64)) # a mark with no hash in it: not stale by itself (it needs hashing)
f.with_name("e.gguf.done").write_text("sha256 " + "b" * 64)
self.assertTrue(setup.dsv41_mark_is_stale(f, "a" * 64))
f.with_name("e.gguf.done").write_text("sha256 " + "a" * 64)
self.assertFalse(setup.dsv41_mark_is_stale(f, "a" * 64))
sub = Path(d) / "2.00bpw"
sub.mkdir()
old = sub / "engram-IQ4_NL.gguf"
old.write_bytes(b"e")
a = argparse.Namespace(gguf_dir=d)
with mock.patch.dict(setup.DSV41_ALL_FILES, {"engram-IQ4_NL.gguf": (1, "0" * 64)}):
got = setup.dsv41_find_shared(a, setup.DSV41_ISTA_ENGRAM, sub, Path(d) / "shared")
self.assertEqual(got, old)
def test_the_persons_own_engram_with_another_hash_or_size_is_refused_and_says_why(self):
class SixShardLayout(unittest.TestCase):
"""ISTA-DASLab's six-shard layout (2026-10-27, llama.cpp b11870+) beside the pinned four-shard one: both are accepted from files already here,
setup still downloads the pinned four-shard files (the owner moves the default later)."""
def models(self):
fam = setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]
return {m: fam[m] for m in ("IST-DAS-2.00bpw", "IST-DAS-2.25bpw", "IST-DAS-1.75bpw")}
def test_the_download_pin_and_the_four_shard_tables_did_not_move(self):
repo = "ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF"
self.assertEqual(setup.HF_REVISIONS[repo], "cb02422c900df489cea5833e8a92171224059b3c")
self.assertEqual(len(setup.DSV41_ISTA_FILES), 13)
self.assertEqual(setup.DSV41_ISTA_FILES[setup.DSV41_ISTA_ENGRAM][1], "eb19f30d368d393784e1fc54fdfaffc427ebb2110bf3762fdf5a8fbb9a2d740a")
for m, d in self.models().items():
self.assertEqual(len(d["shards"]), 4, m)
self.assertTrue(all(n.endswith("-of-00004.gguf") for n in d["shards"]), m)
def test_the_six_shard_tables_are_five_files_a_set_with_the_hub_sizes_and_hashes(self):
self.assertEqual(len(setup.DSV41_ISTA6_FILES), 15)
for n, (size, sha) in setup.DSV41_ISTA6_FILES.items():
self.assertTrue(n.endswith("-of-00006.gguf"), n)
self.assertRegex(sha, r"^[0-9a-f]{64}$", n)
self.assertIn(n, setup.DSV41_ALL_FILES)
self.assertNotIn(n, setup.DSV41_ISTA_FILES) # never downloaded: not in the repository pin
self.assertNotIn(n, setup.REPO_PINS["ISTA-DASLab/DeepSeek-V4.1-Flash-1017-GSQ-RCO-GGUF"])
sums = {m: sum(setup.DSV41_ISTA6_FILES[n][0] for n in d["shards6"]) for m, d in self.models().items()}
self.assertEqual(sums, {"IST-DAS-2.00bpw": 138238967104, "IST-DAS-2.25bpw": 155225898368, "IST-DAS-1.75bpw": 120721194336})
for m, d in self.models().items():
self.assertEqual(len(d["shards6"]), setup.DSV41_ISTA6_SHARDS)
self.assertTrue(d["shards6"][0].endswith("-00001-of-00006.gguf"))
self.assertEqual(setup.DSV41_ISTA6_FILES[d["shards6"][0]][0], 5780704) # the metadata shard: no tensors
self.assertEqual(setup.DSV41_ISTA6_FILES["DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-00005-of-00006.gguf"],
(2969539840, "7c8dbee99890f05dbc420eba6f44393f5228d06248fe61e1ae8ed002449c7549"))
def test_the_converted_engram_has_the_pinned_ones_name_and_size_and_another_hash_that_is_accepted_beside_it(self):
size, sha = setup.DSV41_ENGRAM_CONVERTED
pinned = setup.DSV41_ISTA_FILES[setup.DSV41_ISTA_ENGRAM]
self.assertEqual(size, pinned[0])
self.assertNotEqual(sha, pinned[1])
self.assertEqual(setup.DSV41_SHA_ALSO, {setup.DSV41_ISTA_ENGRAM: (sha,)})
def test_verify_accepts_the_other_engram_hash_and_marks_it(self):
import hashlib
with tempfile.TemporaryDirectory() as d:
f = Path(d) / "e.gguf"
f.write_bytes(b"x" * 8)
with mock.patch.object(setup, "own_gguf_is_whole", return_value=True):
rc, out = run(setup.verify_sha256, f, 8, "0" * 64, own=True, exact=True)
real = hashlib.sha256(b"x" * 8).hexdigest()
rc, out = run(setup.verify_sha256, f, 8, "0" * 64, own=True, also=(real,))
self.assertNotEqual(rc, 1, out)
self.assertIn("converted version", out)
self.assertEqual(f.with_name("e.gguf.done").read_text(), "sha256 " + real)
rc, out = run(setup.verify_sha256, f, 8, "0" * 64, own=True, also=(real,)) # the mark is enough the second time
self.assertNotEqual(rc, 1, out)
self.assertNotIn("checking", out)
f2 = Path(d) / "f.gguf"
f2.write_bytes(b"y" * 8)
with mock.patch.object(setup, "own_gguf_is_whole", return_value=False):
rc, out = run(setup.verify_sha256, f2, 8, "0" * 64, own=True, also=(real,)) # another file is still checked as before
self.assertEqual(rc, 1, out)
self.assertIn("before ISTA-DASLab converted it", out)
self.assertTrue(f.exists()) # the person's file is left as it is
rc, out = run(setup.verify_sha256, f, 9, "0" * 64, own=True, exact=True)
self.assertEqual(rc, 1, out)
self.assertIn("before ISTA-DASLab's 2026-10-27 conversion", out)
rc, out = run(setup.verify_sha256, f, 8, "0" * 64, own=True) # any other file of the person's is still used as it is
self.assertNotEqual(rc, 1, out)
self.assertIn("uses it as it is", out)
def test_layout_of_the_files_in_a_folder(self):
d = self.models()["IST-DAS-2.00bpw"]
four, six, legacy = list(d["shards"]), list(d["shards6"]), [setup.DSV41_LEGACY_NAMES[n] for n in d["shards"]]
of = lambda have: setup.dsv41_layout_of(d, set(have).__contains__)
self.assertEqual(of([]), "four") # nothing there: the pinned files are what setup downloads
self.assertEqual(of(four), "four")
self.assertEqual(of(legacy), "four") # the first release's names are four-shard files
self.assertEqual(of(six), "six")
self.assertEqual(of(six[:2]), "six") # an incomplete six-shard set is still told as six: the missing ones are named
self.assertEqual(of(four + six), "four") # both whole: the pinned set, as before
self.assertEqual(of(four[:2] + six), "six") # a stray four-shard file beside the whole six-shard set
self.assertEqual(of(four[:2] + six[:2]), "four") # neither whole
def test_parts_name_what_is_missing_in_the_layout_that_is_there(self):
d = self.models()["IST-DAS-2.25bpw"]
have = set(d["shards6"]) - {d["shards6"][2]}
layout, names, missing = setup.dsv41_parts(d, have.__contains__)
self.assertEqual((layout, names, missing), ("six", list(d["shards6"]), [d["shards6"][2]]))
have = set(d["shards"][:3])
layout, names, missing = setup.dsv41_parts(d, have.__contains__)
self.assertEqual((layout, len(names), missing), ("four", 4, [d["shards"][3]]))
def test_the_pack_says_which_layout_it_was_made_from(self):
with tempfile.TemporaryDirectory() as t:
pack = Path(t)
self.assertIsNone(setup.dsv41_pack_layout(pack))
(pack / "tensors.txt").write_text("file 0 x-00001-of-00006.gguf\nfile 1 y.gguf\nt a BF16 0 0 1 1\n")
self.assertEqual(setup.dsv41_pack_layout(pack), "six")
(pack / "tensors.txt").write_text("file 0 x-00001-of-00004.gguf\nt a BF16 0 0 1 1\n")
self.assertEqual(setup.dsv41_pack_layout(pack), "four")
(pack / "tensors.txt").write_text("file 0 model.gguf\nt a BF16 0 0 1 1\n")
self.assertIsNone(setup.dsv41_pack_layout(pack))
def test_the_folder_with_six_shard_names_is_found_from_the_parent(self):
with tempfile.TemporaryDirectory() as t:
sub = Path(t) / "2.00bpw"
sub.mkdir()
(sub / self.models()["IST-DAS-2.00bpw"]["shards6"][0]).write_bytes(b"x")
fam = setup.MULTI_FILE_FAMILIES["deepseek41"]
self.assertEqual(setup.dsv41_folder(argparse.Namespace(gguf_dir=t, models_dir=t), fam, "t", "IST-DAS-2.00bpw"), sub)
class Smallest(unittest.TestCase):
@@ -585,12 +670,17 @@ class Smallest(unittest.TestCase):
fam = setup.MULTI_FILE_FAMILIES["deepseek41"]
d = fam["models"]["IST-DAS-1.75bpw"]
self.assertEqual(d["recipe"], "ista")
self.assertEqual(d["shards"], [f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-{i:05d}-of-00006.gguf" for i in range(1, 6)])
self.assertEqual(d["shards"], [f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-{i:05d}-of-00004.gguf" for i in range(1, 5)])
self.assertEqual(d["shared"], fam["models"]["IST-DAS-2.00bpw"]["shared"]) # the same Engram, drafter and metadata shard
self.assertEqual(setup.DSV41_ISTA_FILES[d["shards"][0]],
(5780704, "3e8ddd11441edd4bc19bacaef5dbe38818af2cbdf0820fb70f1d2d851fcc192a"))
self.assertEqual(setup.DSV41_ISTA_FILES[d["shards"][4]][0], 2969539840)
self.assertEqual(sum(setup.DSV41_ISTA_FILES[n][0] for n in d["shards"]), 120_721_194_336)
(39358830464, "6e3f0d5ff53d00428ec32c079db9e8255cb410ccaa435e5342aaa8a47fe1339d"))
self.assertEqual(setup.DSV41_ISTA_FILES[d["shards"][3]][0], 2188841824)
self.assertEqual(sum(setup.DSV41_ISTA_FILES[n][0] for n in d["shards"]), 120_721_120_256)
self.assertTrue(all(n not in setup.DSV41_LEGACY_NAMES.values() for n in d["shards"])) # no first-release names for it
for n, (size, sha) in setup.DSV41_NEW_SHARD1.items(): # shard 1 after ISTA's 2026-10-26 template update
self.assertIn(n, setup.DSV41_ISTA_FILES)
self.assertNotEqual(setup.DSV41_ISTA_FILES[n][0], size)
self.assertNotEqual(setup.DSV41_ISTA_FILES[n][1], sha)
cmd = setup.dsv41_pack_cmd(Path("/m"), d["shards"], Path("/s/e.gguf"), Path("/s/m.gguf"), Path("/s/d.gguf"), Path("/p"))
self.assertIn("--dspark-noise-token", cmd)
self.assertNotIn("--skip-tensors", cmd)
@@ -640,20 +730,15 @@ class InstallOfficial(Install):
get = [c for c in self.calls if c[0] == "get"]
folder = self.root / "models" / "deepseek-v4.1-flash-IST-DAS-2.00bpw"
shared = self.root / "models" / "deepseek-v4.1-flash-shared"
self.assertEqual([c[2] for c in get][:5], [folder / f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-{i:05d}-of-00006.gguf" for i in range(1, 6)])
self.assertEqual([c[2] for c in get][5:], [shared / setup.DSV41_ISTA_ENGRAM, shared / setup.DSV41_SHARD.format(i=1),
self.assertEqual([c[2] for c in get][:4], [folder / f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-{i:05d}-of-00004.gguf" for i in range(1, 5)])
self.assertEqual([c[2] for c in get][4:], [shared / setup.DSV41_ISTA_ENGRAM, shared / setup.DSV41_SHARD.format(i=1),
shared / setup.DSV41_DSPARK])
self.assertTrue(get[0][1].endswith("/DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00001-of-00006.gguf"))
self.assertTrue(get[0][1].endswith("/DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-00001-of-00004.gguf"))
self.assertNotIn("/2.00bpw/", get[0][1]) # the repository is flat
self.assertEqual(sum(1 for c in self.calls if c[0] == "sha"), 8)
self.assertEqual({c[1] for c in self.calls if c[0] == "sha" and c[3]}, {setup.DSV41_ISTA_ENGRAM}) # only the Engram is checked exactly
self.assertEqual(sum(1 for c in self.calls if c[0] == "sha"), 7)
pack = [c for c in self.calls if c[0] == "run"][-1][1]
self.assertIn("--engram-meta", pack)
self.assertNotIn("--skip-tensors", pack)
shards = pack[pack.index("--shards") + 1:pack.index("--engram")]
self.assertEqual(len(shards), 5) # the five files of the set: the Engram is the sixth shard, passed as --engram
self.assertTrue(pack[pack.index("--engram") + 1].endswith(setup.DSV41_ISTA_ENGRAM))
self.assertNotIn(setup.DSV41_ISTA_ENGRAM, shards)
def test_the_second_set_does_not_download_the_engram_again(self):
shared = self.root / "models" / "deepseek-v4.1-flash-shared"
@@ -661,26 +746,25 @@ class InstallOfficial(Install):
shared_names = (setup.DSV41_ISTA_ENGRAM, setup.DSV41_SHARD.format(i=1), setup.DSV41_DSPARK)
for n in shared_names:
(shared / n).write_bytes(b"x")
(shared / (n + ".done")).write_text("sha256 " + setup.DSV41_ALL_FILES[n][1] if n == setup.DSV41_ISTA_ENGRAM else "ok") # (the Engram's mark names its hash)
(shared / (n + ".done")).write_text("ok")
tiny = {n: (1, setup.DSV41_ALL_FILES[n][1]) for n in shared_names} # the stand-in files are one byte long
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista(model="IST-DAS-2.25bpw")
self.assertEqual(rc, 0, out)
got = [c[2].name for c in self.calls if c[0] == "get"]
self.assertEqual(got, [f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-{i:05d}-of-00006.gguf" for i in range(1, 6)]) # only the five shards
self.assertEqual(got, [f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XS-{i:05d}-of-00004.gguf" for i in range(1, 5)]) # only the four shards
def test_the_persons_own_six_shard_files_are_used_as_they_are_nothing_is_downloaded_but_the_small_files(self):
def test_the_first_releases_files_are_used_as_they_are_nothing_is_downloaded_but_the_small_files(self):
own = self.root / "own"
sub = own / "2.00bpw"
sub.mkdir(parents=True)
names = [setup.DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=i) for i in range(1, 6)]
for n in names:
(sub / n).write_bytes(b"GGUF")
(sub / setup.DSV41_ISTA_ENGRAM).write_bytes(b"E")
for i in range(1, 5):
(sub / f"model-2.00bpw-{i:05d}-of-00004.gguf").write_bytes(b"GGUF")
(sub / "engram-IQ4_NL.gguf").write_bytes(b"E")
(own / "dspark").mkdir()
(own / "dspark" / setup.DSV41_DSPARK).write_bytes(b"D")
tiny = {n: (4, "0" * 64) for n in names}
tiny[setup.DSV41_ISTA_ENGRAM] = (1, "0" * 64)
tiny = {n: (4, "0" * 64) for n in setup.DSV41_LEGACY_FILES if n.startswith("model-2.00bpw")}
tiny["engram-IQ4_NL.gguf"] = (1, "0" * 64)
tiny[setup.DSV41_DSPARK] = (1, "0" * 64)
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista(gguf_dir=str(own))
@@ -689,10 +773,96 @@ class InstallOfficial(Install):
self.assertEqual(got, [setup.DSV41_SHARD.format(i=1)]) # only the 5.8 MB metadata shard
pack = [c for c in self.calls if c[0] == "run"][-1][1]
shards = pack[pack.index("--shards") + 1:pack.index("--engram")]
self.assertEqual(shards, names) # the five files, as they are
self.assertTrue(pack[pack.index("--engram") + 1].endswith(setup.DSV41_ISTA_ENGRAM)) # the Engram, the sixth shard, beside them
self.assertEqual(shards, [f"model-2.00bpw-{i:05d}-of-00004.gguf" for i in range(1, 5)]) # packed from the files as they are
self.assertTrue(pack[pack.index("--engram") + 1].endswith("engram-IQ4_NL.gguf"))
self.assertIn("model", pack[pack.index("--model") + 1] + "model")
self.assertEqual(Path(pack[pack.index("--model") + 1]), sub)
def six_shard_folder(self, quant="IQ2_XXS", engram=True):
"""A folder of the person's own with ISTA-DASLab's six-shard files of 2026-10-27 (stand-ins of 4 bytes) and the drafter beside it."""
own = self.root / "own6"
own.mkdir(parents=True)
names = [setup.DSV41_ISTA6_SHARD.format(quant=quant, i=i) for i in range(1, setup.DSV41_ISTA6_SHARDS + 1)]
for n in names:
(own / n).write_bytes(b"GGUF")
if engram:
(own / setup.DSV41_ISTA_ENGRAM).write_bytes(b"E")
(own / setup.DSV41_DSPARK).write_bytes(b"D")
tiny = {n: (4, "0" * 64) for n in names}
tiny[setup.DSV41_ISTA_ENGRAM] = (1, "0" * 64)
tiny[setup.DSV41_DSPARK] = (1, "0" * 64)
return own, names, tiny
def test_the_persons_six_shard_files_are_used_where_they_are_and_packed_with_the_engram_as_the_sixth(self):
own, names, tiny = self.six_shard_folder()
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista(gguf_dir=str(own))
self.assertEqual(rc, 0, out)
self.assertIn("six-shard files of 2026-10-27", out)
self.assertEqual([c[2].name for c in self.calls if c[0] == "get"], [setup.DSV41_SHARD.format(i=1)]) # only the 5.8 MB metadata shard
self.assertEqual([c[1] for c in self.calls if c[0] == "sha"][:5], names) # the five files are checked by name
pack = [c for c in self.calls if c[0] == "run"][-1][1]
self.assertEqual(pack[pack.index("--shards") + 1:pack.index("--engram")], names)
self.assertTrue(pack[pack.index("--engram") + 1].endswith(setup.DSV41_ISTA_ENGRAM))
self.assertEqual(Path(pack[pack.index("--model") + 1]), own)
def test_six_shard_files_without_the_engram_fetch_the_pinned_engram_and_nothing_else_big(self):
own, names, tiny = self.six_shard_folder(engram=False)
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista(gguf_dir=str(own))
self.assertEqual(rc, 0, out)
get = [c for c in self.calls if c[0] == "get"]
self.assertEqual(sorted(c[2].name for c in get), sorted([setup.DSV41_ISTA_ENGRAM, setup.DSV41_SHARD.format(i=1)]))
engram = next(c for c in get if c[2].name == setup.DSV41_ISTA_ENGRAM)
self.assertIn("/resolve/cb02422c900df489cea5833e8a92171224059b3c/", engram[1]) # the pin did not move
def test_a_folder_with_both_layouts_whole_is_used_as_the_pinned_four_shard_set(self):
own, names, tiny = self.six_shard_folder()
four = setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards"]
for n in four:
(own / n).write_bytes(b"GGUF")
tiny[n] = (4, "0" * 64)
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista(gguf_dir=str(own))
self.assertEqual(rc, 0, out)
pack = [c for c in self.calls if c[0] == "run"][-1][1]
self.assertEqual(pack[pack.index("--shards") + 1:pack.index("--engram")], four)
self.assertNotIn("six-shard files of 2026-10-27", out)
def make_pack(self, names):
pack = self.root / "data" / "packs" / "deepseek-v4.1-flash-ist-das-2.00bpw"
(pack / "tokenizer").mkdir(parents=True, exist_ok=True)
(pack / "tokenizer" / "vocab.json").write_text("{}")
(pack / "ds4.txt").write_text("vision.num_hidden_layers 32\nimage_token_id 129264\n") # (the tower is there: only the files differ)
(pack / "tensors.txt").write_text("".join(f"file {i} {n}\n" for i, n in enumerate(names)) + "t embed.weight BF16 0 0 1 1\n")
def pack_runs(self):
return [c for c in self.calls if c[0] == "run" and any(str(x).endswith("pack_gguf.py") for x in c[1])]
def test_a_pack_made_from_the_other_layout_is_made_again_and_one_from_the_same_layout_is_kept(self):
own, names, tiny = self.six_shard_folder()
four = setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards"]
self.make_pack(four + [setup.DSV41_ISTA_ENGRAM]) # a pack of the four-shard files, the six-shard files now
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista(gguf_dir=str(own))
self.assertEqual(rc, 0, out)
self.assertIn("made from the four-shard files of this set", out)
self.assertEqual(len(self.pack_runs()), 1)
self.make_pack(names + [setup.DSV41_ISTA_ENGRAM]) # a pack of the six-shard files: kept
self.calls.clear()
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista(gguf_dir=str(own))
self.assertEqual(rc, 0, out)
self.assertNotIn("building it again", out)
self.assertEqual(len(self.pack_runs()), 0)
def test_a_four_shard_pack_is_kept_for_the_pinned_four_shard_files(self):
self.make_pack(setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards"] + [setup.DSV41_ISTA_ENGRAM])
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
self.assertNotIn("building it again", out)
self.assertEqual(len(self.pack_runs()), 0)
def test_pack_info_profile_smoke_and_the_launch_flags(self):
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
@@ -707,105 +877,6 @@ class InstallOfficial(Install):
self.assertIn("test question answered sensibly", out)
self.assertTrue(Path(a[a.index("--pack") + 1]).match("*packs/deepseek-v4.1-flash-ist-das-2.00bpw"))
def test_an_engram_downloaded_before_the_conversion_is_fetched_again_in_the_same_run(self):
shared = self.root / "models" / "deepseek-v4.1-flash-shared"
shared.mkdir(parents=True)
names = (setup.DSV41_ISTA_ENGRAM, setup.DSV41_SHARD.format(i=1), setup.DSV41_DSPARK)
for n in names:
(shared / n).write_bytes(b"x")
(shared / (n + ".done")).write_text("ok")
mark = shared / (setup.DSV41_ISTA_ENGRAM + ".done")
mark.write_text("sha256 " + "0" * 64) # what the old Engram's finish mark holds
tiny = {n: (1, setup.DSV41_ALL_FILES[n][1]) for n in names}
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
got = [c[2].name for c in self.calls if c[0] == "get"]
self.assertIn(setup.DSV41_ISTA_ENGRAM, got) # fetched in this run, not hashed and deleted
self.assertNotIn(setup.DSV41_DSPARK, got) # the files with no stale mark stay
self.assertIn("from before ISTA-DASLab converted it", out)
self.assertFalse(mark.exists())
def hashless_engram(self, content: bytes):
"""An Engram whose finish mark is a timestamp (a download interrupted before its check wrote the hash), with a one-byte stand-in pin."""
import hashlib
shared = self.root / "models" / "deepseek-v4.1-flash-shared"
shared.mkdir(parents=True)
names = (setup.DSV41_ISTA_ENGRAM, setup.DSV41_SHARD.format(i=1), setup.DSV41_DSPARK)
for n in names:
(shared / n).write_bytes(content if n == setup.DSV41_ISTA_ENGRAM else b"x")
(shared / (n + ".done")).write_text("2026-10-28 23:00" if n == setup.DSV41_ISTA_ENGRAM else "ok")
pin = hashlib.sha256(b"x").hexdigest()
tiny = {n: (1, pin if n == setup.DSV41_ISTA_ENGRAM else setup.DSV41_ALL_FILES[n][1]) for n in names}
return shared / setup.DSV41_ISTA_ENGRAM, tiny, pin
def test_an_engram_with_a_hashless_mark_is_hashed_and_kept_when_it_matches(self):
engram, tiny, pin = self.hashless_engram(b"x")
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
self.assertNotIn(setup.DSV41_ISTA_ENGRAM, [c[2].name for c in self.calls if c[0] == "get"]) # kept: no 110 GB download
self.assertTrue(engram.exists())
self.assertEqual(engram.with_name(engram.name + ".done").read_text(), "sha256 " + pin) # and it has its hash mark now
self.assertNotIn("from before ISTA-DASLab converted it", out)
def test_an_engram_with_a_hashless_mark_that_does_not_match_is_replaced_in_the_same_run(self):
engram, tiny, pin = self.hashless_engram(b"y")
with mock.patch.dict(setup.DSV41_ALL_FILES, tiny):
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
self.assertIn(setup.DSV41_ISTA_ENGRAM, [c[2].name for c in self.calls if c[0] == "get"]) # fetched in this run
self.assertFalse(engram.exists()) # (the mocked download writes nothing)
self.assertIn("from before ISTA-DASLab converted it", out)
def test_the_estimate_counts_the_whole_engram_when_its_mark_is_stale_and_nothing_when_it_is_current(self):
folder = self.root / "models" / "deepseek-v4.1-flash-IST-DAS-2.00bpw"
shared = self.root / "models" / "deepseek-v4.1-flash-shared"
folder.mkdir(parents=True)
shared.mkdir(parents=True)
for n in setup.MULTI_FILE_FAMILIES["deepseek41"]["models"]["IST-DAS-2.00bpw"]["shards"]:
(folder / n).write_bytes(b"x")
(folder / (n + ".done")).write_text("ok")
for n in (setup.DSV41_SHARD.format(i=1), setup.DSV41_DSPARK):
(shared / n).write_bytes(b"x")
(shared / (n + ".done")).write_text("ok")
def engram(mark):
(shared / setup.DSV41_ISTA_ENGRAM).write_bytes(b"x")
(shared / (setup.DSV41_ISTA_ENGRAM + ".done")).write_text(mark)
engram("sha256 " + "0" * 64) # the old Engram's mark
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
self.assertIn("Download: 111 GB to fetch", out) # the Engram's 110.6 GB, nothing else
engram("sha256 " + setup.DSV41_ISTA_FILES[setup.DSV41_ISTA_ENGRAM][1]) # the current Engram's mark
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
self.assertIn("Nothing to download", out)
def test_a_pack_made_from_the_four_shard_files_is_made_again_and_one_from_the_six_shard_files_is_kept(self):
pack = self.root / "data" / "packs" / "deepseek-v4.1-flash-ist-das-2.00bpw"
def make(names):
(pack / "tokenizer").mkdir(parents=True, exist_ok=True)
(pack / "tokenizer" / "vocab.json").write_text("{}")
(pack / "ds4.txt").write_text("vision.num_hidden_layers 32\nimage_token_id 129264\n") # (the tower is there: only the files differ)
(pack / "tensors.txt").write_text("".join(f"file {i} {n}\n" for i, n in enumerate(names)) + "t embed.weight BF16 0 0 1 1\n")
def packs():
return [c for c in self.calls if c[0] == "run" and any(str(x).endswith("pack_gguf.py") for x in c[1])]
make([f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ2_XXS-{i:05d}-of-00004.gguf" for i in range(1, 5)] + ["../deepseek-v4.1-flash-shared/engram-IQ4_NL.gguf"])
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
self.assertIn("made from other files of this set", out)
self.assertEqual(len(packs()), 1) # made again
make([setup.DSV41_ISTA_SHARD.format(quant="IQ2_XXS", i=i) for i in range(1, 6)] + ["../deepseek-v4.1-flash-shared/" + setup.DSV41_ISTA_ENGRAM])
rc, out = self.install_ista()
self.assertEqual(rc, 0, out)
self.assertNotIn("made from other files of this set", out)
self.assertEqual(len(packs()), 1) # kept: no second pack_gguf run
def test_an_incomplete_pack_stops_with_the_missing_file(self):
self.packinfo_ok = False
patches = [mock.patch.object(setup, "dsv41_pack_info", lambda exe, pack, libs: (False, " MISSING x.gguf (1.00 GB wanted)")),
@@ -842,9 +913,9 @@ class InstallSmallest(InstallOfficial):
rc, out = self.install_ista(model="IST-DAS-1.75bpw", ram=36.0)
self.assertEqual(rc, 0, out)
get = [c for c in self.calls if c[0] == "get"]
self.assertEqual([c[2].name for c in get][:5], [f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-{i:05d}-of-00006.gguf" for i in range(1, 6)])
self.assertEqual([c[2].name for c in get][:4], [f"DeepSeek-V4.1-Flash-1017-GSQ-RCO-IQ1_M-{i:05d}-of-00004.gguf" for i in range(1, 5)])
self.assertTrue(get[0][1].startswith(setup.hf(setup.DSV41_ISTA_REPO)))
self.assertIn("a419d74cd28d5b9f8c5e2b9077d11a609c17bc32", get[0][1])
self.assertIn("cb02422c900df489cea5833e8a92171224059b3c", get[0][1])
self.assertIn("239 GB", out)
a = self.cfg["args"]
self.assertEqual(a[a.index("--dspark") + 1], "auto")