mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4348] [CLOSED] [Engine] GGUF reader: size the integer tensors, so a complete DeepSeek first shard is accepted and a cut one refused #5017
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5017
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4348
Author: @lu123bing
Created: 10/27/2026
Status: ❌ Closed
Base:
main← Head:fix-gguf-integer-tensor-geometry📝 Commits (1)
7e508c8gguf reader: size the integer tensors, so a complete DeepSeek first shard is accepted and a cut one refused📊 Changes
3 files changed (+48 additions, -8 deletions)
View changed files
📝
tests/terminal/test_own_files.py(+22 -2)📝
tools/gguf_reader.py(+2 -0)📝
tools/test_setup_shard_check.py(+24 -6)📄 Description
Problem and result
tools/gguf_reader.pysizes every tensor fromBLOCK_GEOMETRY(elements per block, bytes per block), and that table has no row for the integer typesGGML_TYPESalready names (I8, I16, I32, I64).strata_control/gguf_preflight.py:165reads "no geometry" as "unsupported file", so a complete GGUF whose tensor directory holds an integer tensor is refused:setup's own-file fallback (setup.py:3088,own_gguf_is_whole→False) stops with "it may be cut short or another version";my-own-model.gguf: it stores weights in a format Strata does not read;tools/iq_pack.py:165refuses the file as "unsupported or truncated tensor".IST-DASLab's DeepSeek-V4.1 first shard stores its Engram hash parameters this way (
tools/dsv41/pack_gguf.py,int_tensors_to_engram:engram_token_mapI32,engram_primes/engram_offsets/engram_multipliersI64).The same hole in the other direction:
setup.check_shardsdecides whether a shard is whole witht.expected_bytes() or 0(setup.py:3324), so a shard cut inside an integer tensor passes as whole and the engine fails much later, at the first tensor that runs past the end — the failure that check exists to catch.After the change the reader sizes the four types, so the complete file is accepted and the cut one is refused.
Related discussion
#4256 reports this refusal from the fallback for an IST-DASLab first shard, names
BLOCK_GEOMETRYas the suspect and records that he could not identify the tensor that triggers it. This does not depend on which shard it is, and it fixes the mechanism. That issue's own size stop for the pinned 0.2.6 files is handled separately byDSV41_NEW_SHARD1(setup.py:710), which this leaves alone — the fallback still has to accept a complete file outside the pins, such as ISTA's ownpatch_chat_template.pyoutput or a fine-tune. No new feature and no default change, so no scope note.Not this change: #4237 reports the same DeepSeek set refused as
incomplete_or_invalid_shard_set, which is the app's folder/name recognition; #4160 is a modified Qwen set refused as an unknown size. Both are different checks.Approach
Four rows in
BLOCK_GEOMETRY, one value per block, with the valuestools/dsv41/ista_intake.py:112already uses for the same types. The quantised encodings are untouched and an unknown type is still refused; the effect is limited to the four types, in the places that size a tensor from this table — the preflight in front of setup and the app,setup.whole_shard,setup.check_shardsand the tools that read a tensor's size.Validation
Environment:
mainat5e8a4ccaplus this branch, Linux, Python 3.14, no GPU. Commands run from the repository root.Passed:
python -m pytest tests/terminal -q: 10 failed, 1868 passed, 49 skipped, 343 subtests passed, 21 min. The same 10 ids fail on a clean worktree ofmainwithout this branch, so they are this machine, not the change: a HIP library path expected in Windows form, a SYCL package choice, llama.cpp'sgguf-pynot installed,Strata-data/free-space detection, three TUI text assertions, three light-theme colour assertions, one telemetry message mismatch.python -m pytest tests/terminal/test_own_files.py -q: 28 passed (the newIntegerTensorsclass is two of them).python tools/test_setup_shard_check.py: 4 tests, OK (two new).IntegerTensorstests withProfileError: GGUF tensor has an unsupported encoding or shape(strata_control/gguf_preflight.py:165),test_a_complete_gguf_with_integer_tensors_is_wholewithown_gguf_is_whole→False, andtest_a_shard_cut_inside_an_integer_tensor_is_still_refusedwithSystemExitnot raised (setup.py:3324). With the rows they pass.BLOCK_GEOMETRY["I32"]at(1, 9)and at(1, 2), and["I8"]at(1, 4), it fails; the fixture's bytes never come from that table, so a changed row moves the expectation.inspect_metadatarefuses the complete file before and reports{'F32': 1, 'I32': 1, 'I64': 1}after;check_shardsaccepts a copy cut 8 bytes inside the I64 tensor before and refuses it (is short: 240 of 256 bytes) after;models.plan_importreportsmy-own-model.gguf: it stores weights in a format Strata does not readbefore and no encoding issue after.Failed:
None observed.
Not run:
The C++ builds and anything that runs an engine (CUDA, HIP, SYCL, Metal): no GPU here, and no C++ or engine file is touched. Real shard files: they are tens of GB, so the fixtures are the same v3 header and tensor directory, not the weights. Windows and macOS.
Limits
include/strata/artifact/gguf_reader.hpp) with I8 but not I16/I32/I64, andsrc/core/native_dense.cpp:319refuses a tensor it cannot size. This change stops the Python check in front of setup and the app from turning a valid file away; it does not make the engine read a type it does not read. F64 was already Python-only in the same table, so the asymmetry is older than this change.tools/iq_pack.pyshares that table and used "no geometry" as "unsupported tensor": a tensor of these types now gets past that look-up and classifies as native (tools/iq_pack.py:288). That tool builds the Qwen packs; this change does not make its output right for a file with integer tensors, and no such pack was built here.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.