mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4827] [Engine] use a downloaded GGUF of another length when it is a whole GGUF file #5199
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#5199
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/4827
Author: @Requiem4Eternity
Created: 10/31/2026
Status: 🔄 Open
Base:
main← Head:setup/3777-download-of-another-build📝 Commits (3)
a9ca1f3[Engine] a downloaded GGUF of another length is used, not deleted, when it is whole3c09719Merge branch 'refs/heads/main' into setup/3777-download-of-another-build6a6f034Merge branch 'refs/heads/main' into setup/3777-download-of-another-build📊 Changes
2 files changed (+17 additions, -7 deletions)
View changed files
📝
setup.py(+8 -5)📝
tools/test_setup_ownfiles.py(+9 -2)📄 Description
Problem and result: a downloaded GGUF that is a whole GGUF file but a few bytes longer than the published one stops setup. A user with
Qwen3.8-Flash-Next-Gyro-S-TQ1_0.ggufgot a file of 58,487,015,904 bytes, 96 bytes (three 32-byte alignment blocks) more than the 58,487,015,808 inGYRO_FILES, because it was built with different padding. The file is complete and loads; setup saidso the only way forward was to throw away a 58 GB file that works. The same check already had the right answer for
--gguf-dir(own=True): a whole GGUF of another length is used with a warning. After this change a download gets that answer too, and the person seesRelated discussion: #3777 (the report above). This is the small fix described there. The
own=Truebranch is unchanged and is not the problem being fixed.Approach: a second early return, next to the one for
--gguf-dirand below it, for a downloaded file whose length differs and whose header reads as a whole GGUF:The rule is kept on the download path rather than moved up to the top of the function, so that no other caller of
verify_sha256changes:download()also checks the Vulkan SDK tarball, the image model's files and whateverready_fetchfetches, and the vision encoder goes through it too. Those stay on exactly the code they ran before.The rest is unchanged:
[X]text for a download is unchanged, so nothing that reads it has to change;check_shardsbefore this code runs;--gguf-dirbranch is untouched, including itshave > 0guard.A file of the published length reads the same path it did.
Cost of keeping it here:
own_gguf_is_wholeruns twice for a file from--gguf-dirwhose header does not read as a whole GGUF, and the warning text appears twice in the source. Both are the price of not reaching the other callers. The repeated text is what the code looked like before, too.What a person sees afterwards. A downloaded file accepted this way is not marked as finished, because it is not the published file: the warning is printed again on the next run, after one header read, and no SHA-256 is computed for it. The line
... downloadedthatdownload()prints after its check follows the warning, which reads oddly but states what happened.Validation:
Passed:
python -m unittest tools.test_setup_ownfiles tools.test_setup_gyro tests.terminal.test_download_integrity tests.terminal.test_own_filesat
a9ca1f3a, Python 3.12.5 on macOS 15 (arm64):Ran 77 tests ... OK. The new cases intools/test_setup_ownfiles.py::test_other_lengthscover a download 96 bytes long (accepted, no longer refused), a file that is not a GGUF at the same length (still refused with the old message, and still on disk afterwards) and an own file that is cut short (still refused).Failed:
python -m unittest tools.test_setup_unsloth: 43 failures, 1 error. The same set fails onmainatc62d5e3awithout this change (43 failures, 1 error), so it is not part of this branch; they look like tests that need a different environment.Not run:
No CUDA, HIP or SYCL build, and no engine run: the change is in
setup.py, not in the engine, and it does not touch anything that compiles. No--yessetup against a real published model, and no download of a mismatched file from the network.Limits: the rule trusts the GGUF header. A file whose tensor directory fits inside its length is used even if the last bytes are padding of a different build; if the data itself is damaged, that shows when the model is loaded, or in the SHA-256 check when the length matches, not here.
Where the real-file evidence comes from
The three questions this change answers ("is a file 96 bytes longer used? is a cutoff file refused? is the model file still intact afterwards?") are about real 58 GB files, and a wrong answer costs an hour and a download to find out. The checks were therefore also run on real files, not only on the small GGUFs the unit tests build: a model that is whole with 96 extra bytes, whole at its own length (accepted, with the warning above), and one that is cut short (refused by
check_shards) were each fed tosetup.check_shardsandsetup.verify_sha256themselves, with the published length taken fromGYRO_FILES.That drill is not part of this branch and nothing in setup imports it. It is on the branch
drill/setup-size-check, which is this branch plustools/setup_size_check_drill.py, for a maintainer who wants to see it on their own hardware:It calls
check_shardsandverify_sha256themselves rather than restating their rules, and prints setup's own words for each case. What a case should do is not listed in the script: it comes fromown_gguf_is_whole()on the same bytes, so the tool reports what setup does instead of defining what it should do.The model file is only read: one copy is made beside it, every case reshapes only the last few blocks of that copy, and the copy is deleted at the end, including after an interrupt or an error. Nothing is renamed or moved and no byte of the model file is written, so whatever happens it is where it was with the bytes it had. It needs one copy's worth of free space, which
--work-dircan move to another drive.Checked on that branch, with the files made read-only first (
chmod 444) so that any write would have failed: 4 GGUF files (512, 506, 518 and 513 bytes, aligned and not) x 4 case orders = 16 runs, every run leaving the file's SHA-256 unchanged and no copy behind; an interrupt in the middle of a run, with the same result; and the script run on the 58,487,015,904-byte model from #3777 on a Windows machine, the copy beside it on the F: drive: 3 cases, all as expected, and the file still 58,487,015,904 bytes with its original SHA-256 afterwards.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.