mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #91] [MERGED] GGUF reader: refuse a duplicate tensor name at open, naming the tensor and the file #2449
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#2449
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/91
Author: @Avicennasis
Created: 9/28/2026
Status: ✅ Merged
Merged: 9/29/2026
Merged by: @Niko1221
Base:
main← Head:c/gguf-dup-name📝 Commits (1)
c80131egguf reader: a duplicate tensor name is refused at open, naming the tensor and the file📊 Changes
3 files changed (+105 additions, -0 deletions)
View changed files
📝
CMakeLists.txt(+6 -0)📝
include/strata/artifact/gguf_reader.hpp(+6 -0)➕
src/artifact/gguf_reader_test.cpp(+93 -0)📄 Description
One fail-closed change on the GGUF reader, with a test that runs without a model or a GPU. (Companion PR: setup names a missing or short shard and
verifyreads back the manifest sha256.)gguf_reader.hpp: a duplicate tensor name is refused at openGgufFile::find()is first-match over the tensor directory. A GGUF that carries one name twice therefore resolves that name to whichever entry came first; the other tensor's bytes are never read and nothing says so. GGUF has no index that could arbitrate between the two, so refusal is the whole fix:parse()keeps a set of the names it has seen and throws on the second sighting, naming both the tensor and the file:(llama.cpp's
gguf_init_from_filerefuses the same way.)find()itself is unchanged - the directory it walks is now unique.Reproduction:
gguf_reader_test(new, registered underSTRATA_BUILD_TESTSbesidestrata-gguf, links onlystrata_artifact) writes a minimal GGUF v3 by hand - no metadata, two F32[8] tensors, 32-byte alignment - and opens it with the reader:tensors().size() == 2,find()sees both;On
mainthe second file opens and 3 of the 4 checks fail; with the change all 4 pass. The fixture was cross-checked against gguf-py'sGGUFReaderat the pinned llama.cpp commit and againststrata-gguf(tensors 2, data_start 128, size 192). The file is closed before it is removed, for Windows.What I ran, and where
Linux x86_64 (Ubuntu 24.04, AMD Ryzen 7 5800X - no AVX-512, no NVIDIA GPU), gcc 13.3.0, CMake 3.28.3, Python 3.12.3. The CUDA targets were not built (
STRATA_ENABLE_CUDA=OFF); this is a claim about my machine, not yours.cmake -B build-cpu -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_BUILD_TESTS=ON -DSTRATA_GGML_DIR=<llama.cpp at 3cf0325>- the published tree has notests/, so I added an emptytests/CMakeLists.txtlocally (not committed), anddequant_bf16_testlinksCUDA::cudartoutside the CUDA guard, so a stub imported target was injected for configure only. Both are pre-existing; not touched here.cmake --build build-cpu -j8 -- -k: every target built exceptdequant_bf16_test(cuda_runtime.habsent - expected without a toolkit; it is not a ctest).ctest: 9 tests; 8 passed.gguf_reader_testpassed (4/4 rows).expert_multi_testfails on this CPU with the kernel's own refusal (missing AVX512F ... AVX512-VBMI); the branch touches nothing undersrc/kernels.git diff --checkclean.Branch is on
c1e9033(0.1.20); happy to rebase if it has moved by the time you look.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.