mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5075] [CLOSED] [Other] quant_formats --hf: give the header its file size for the bounds checks #5302
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#5302
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/5075
Author: @Tsury
Created: 11/3/2026
Status: ❌ Closed
Base:
main← Head:fix-quant-formats-hf📝 Commits (1)
edd81a4quant_formats --hf: give the header its file size for the bounds checks📊 Changes
2 files changed (+74 additions, -3 deletions)
View changed files
📝
tools/quant_formats.py(+7 -3)➕
tools/test_quant_formats_hf.py(+67 -0)📄 Description
Problem and result
On v0.2.10 (
ffa80d73),tools/quant_formats.py --hf REPO REV DIRfails on every repository before it prints anything:gguf_reader's header bounds checks (c15a90b2) readself._sizeandself._pos, whichGGUFFile.__init__sets from the open file.quant_formats.Headerreuses the parser over HTTP range requests and has its own__init__, which never set them. Local paths are not affected (they useGGUFFile).After this change,
Headertakes the file's size from the Hugging Face tree entry (size, which the listing already returns), so the same bounds checks apply to a remote header: a complete header parses, and a cut one is refused with aValueErrorthat names the file, asGGUFFiledoes.Validation
On
ffa80d73+ this change, Linux, Python 3.14:python3 tools/quant_formats.py --hf huihui-ai/Huihui-Qwen3.8-Flash-Next-abliterated-v2-GGUF 411f1f7349c9711e6f75aa8d20e1612eb3a4d55d unsloth-UD-Q4_K_XL-V2prints the role table (routed gate/up Q4_K with Q5_K in layer 2, down Q5_1 with Q8_0 in layers 2, 4, 30, 46, 47; PLE table IQ4_NL 26.82 GiB). Before the change: the error above.python -m unittest tools.test_quant_formats_hf(new, 2 tests): it fails with the sameAttributeErrorwithout the change.python -m unittest tools.test_gguf_reader_malformed.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.