[PR #3955] [CLOSED] [Engine] pack older DeepSeek GGUF metadata with exact source geometry #4849

Closed
opened 2026-11-07 16:30:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3955
Author: @Tsury
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: fix/dsv41-legacy-gguf-metadata


📝 Commits (1)

  • ac61f6a fix(dsv41): read legacy GGUF metadata and omitted sparse geometry

📊 Changes

2 files changed (+77 additions, -1 deletions)

View changed files

📝 tests/terminal/test_pack_gguf_engram.py (+46 -0)
📝 tools/dsv41/pack_gguf.py (+31 -1)

📄 Description

Older DeepSeek-V4.1 GGUF conversions can have supported tensors but fail during packing. The pinned mrfakename Q2_K uses engram.key_length and engram.pad_id; current packing expects head_dim and pad_token_id, so write_engram raises TypeError: list indices must be integers or slices, not NoneType. Those files also omit the sparse KV/index source lists and candidate geometry entirely.

The packer now accepts those two older Engram names. An explicit --config-json option fills omitted sparse geometry from the exact source model configuration. It checks existing core/sparse geometry for disagreement instead of replacing it. This does not rewrite GGUF metadata or tensors and does not change engine code or inference defaults.

Example:

python tools/dsv41/pack_gguf.py --model /path/to/Q2_K --out /path/to/pack --config-json /path/to/source-model/config.json

The pinned source config agrees with the official 1017 config: Engram dimension256/pad2; KV source layers2,8,14,20; candidate layer20/top-k2048/block8. This is the source of the missing values, not a guess based on architecture size.

Validation on Linux/Python3.14, base 7dd5cf18e68c639a8773e096c5c79f971ea2a9f5:

  • Passed: python3 tests/terminal/test_pack_gguf_engram.py (5 tests). The new legacy-Engram case first reproduced the TypeError on the base implementation. It now writes the expected DSE1 header and identical bytes to current names. Canonical values retain precedence. The source-config case checks restored geometry and rejects a conflict.
  • Passed: full pack CLI with all ten real Q2_K tensor directories/metadata retained from bounded HTTP Range reads. Temporary sparse files had the published logical sizes but contained no weight data. Packing produced47,286 tensor entries, correct source/candidate geometry, and two Engram layers with24 hash columns. The resulting Engram hash-table binary was byte-identical to the current-format Orca1017 header's table.
  • Passed: target Python3.15.1 packer --help exposes the option; syntax checks and git diff --check.
  • Not run: live model loading or inference for this repair. Weights are still downloading. Header/packing checks do not establish numerical correctness or performance. No backend code changed, so CUDA/HIP/SYCL builds are outside this Python metadata fix.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3955 **Author:** [@Tsury](https://github.com/Tsury) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/dsv41-legacy-gguf-metadata` --- ### 📝 Commits (1) - [`ac61f6a`](https://github.com/Niko1221/Strata/commit/ac61f6ac9d04f744f2e3fdf25610ab51fe76ba36) fix(dsv41): read legacy GGUF metadata and omitted sparse geometry ### 📊 Changes **2 files changed** (+77 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/terminal/test_pack_gguf_engram.py` (+46 -0) 📝 `tools/dsv41/pack_gguf.py` (+31 -1) </details> ### 📄 Description Older DeepSeek-V4.1 GGUF conversions can have supported tensors but fail during packing. The pinned [mrfakename Q2_K](https://huggingface.co/mrfakename/DeepSeek-V4.1-Flash-1017-abliterated-GGUF/tree/b82300670252bda21f520037ec692dccada41d85/Q2_K) uses `engram.key_length` and `engram.pad_id`; current packing expects `head_dim` and `pad_token_id`, so `write_engram` raises `TypeError: list indices must be integers or slices, not NoneType`. Those files also omit the sparse KV/index source lists and candidate geometry entirely. The packer now accepts those two older Engram names. An explicit `--config-json` option fills omitted sparse geometry from the exact source model configuration. It checks existing core/sparse geometry for disagreement instead of replacing it. This does not rewrite GGUF metadata or tensors and does not change engine code or inference defaults. Example: ```sh python tools/dsv41/pack_gguf.py --model /path/to/Q2_K --out /path/to/pack --config-json /path/to/source-model/config.json ``` The [pinned source config](https://huggingface.co/mrfakename/DeepSeek-V4.1-Flash-1017-abliterated/blob/517efab9ccfef7f714dbd7d679f181a86f43ccf9/config.json) agrees with the official 1017 config: Engram dimension256/pad2; KV source layers2,8,14,20; candidate layer20/top-k2048/block8. This is the source of the missing values, not a guess based on architecture size. Validation on Linux/Python3.14, base `7dd5cf18e68c639a8773e096c5c79f971ea2a9f5`: - Passed: `python3 tests/terminal/test_pack_gguf_engram.py` (5 tests). The new legacy-Engram case first reproduced the TypeError on the base implementation. It now writes the expected DSE1 header and identical bytes to current names. Canonical values retain precedence. The source-config case checks restored geometry and rejects a conflict. - Passed: full pack CLI with all ten real Q2_K tensor directories/metadata retained from bounded HTTP Range reads. Temporary sparse files had the published logical sizes but contained no weight data. Packing produced47,286 tensor entries, correct source/candidate geometry, and two Engram layers with24 hash columns. The resulting Engram hash-table binary was byte-identical to the current-format Orca1017 header's table. - Passed: target Python3.15.1 packer `--help` exposes the option; syntax checks and `git diff --check`. - Not run: live model loading or inference for this repair. Weights are still downloading. Header/packing checks do not establish numerical correctness or performance. No backend code changed, so CUDA/HIP/SYCL builds are outside this Python metadata fix. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:30:51 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4849
No description provided.