[GH-ISSUE #2902] setup: SHA-256 check is wrong for large shards and deletes correct files #1175

Closed
opened 2026-11-04 01:49:06 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Astemiir on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2902

Summary

The SHA-256 check in setup.py is wrong for large files (the failures we see are 43–50 GB shards): it rejects a correct file, deletes it, downloads it again, and the next attempt fails the same way. Small files hash fine, so the bug only shows on the big model shards.

What happens

checking Qwen3.8-Flash-Next-UD-IQ4_XS-00002-of-00003.gguf (SHA-256, 49.8 GB) ...
[X] ... has the wrong SHA-256 (cd6e40937ddf0f39d68748f1f086b423565fcb8a6d0a32f4ac52a5be35d8f744,
    expected 577a38a2392b40ca2193cea502e1d92f60b8cd370675d308e0ec21885d9daaa7): deleted

After a fresh 49.8 GB download the check reports another value (ec899c68…); shard 3 (43.8 GB) fails the same way (e2f8d605… vs expected d4634e6d…).

Proof that the bytes are fine and the check is not

  • Same file, external hasher (certutil -hashfile <file> SHA256): 577a38a2… — exactly the lfs.oid the Hub publishes for unsloth/Qwen3.8-Flash-Next-GGUF, both on main and on the commit pinned in setup.py (38bb39ee…).
  • Shard 3, same external hasher: d4634e6d… — its Hub oid. Setup's own check on those same bytes said e2f8d605… and deleted the file.

Environment: Windows 10 19045, Python 3.13.13, Strata 0.1.45.

Correct way to verify these files

Use an external hasher instead of hashlib:

  • Windows: certutil -hashfile "<file>" SHA256
  • macOS / Linux: shasum -a 256 "<file>"

and compare the result with the file's lfs.oid from the Hub API
(https://huggingface.co/api/models/<repo>/tree/<ref>/<dir>?expand=true).

Also: do not delete on a mismatch

Rename the file to <name>.bad and keep it. Then a mismatch costs a re-check, not another 50 GB download, and the user still has the bytes for a manual verification.

Workaround for users today

Put <file>.done next to the file containing sha256 <expected> — verify_sha256 then skips the check. The whole (checked against its own tensor directory) form written by whole_shard is not enough for a pinned hash: it still re-hashes.

Originally created by @Astemiir on GitHub (Oct 17, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2902 ## Summary The SHA-256 check in `setup.py` is wrong for large files (the failures we see are 43–50 GB shards): it rejects a correct file, deletes it, downloads it again, and the next attempt fails the same way. Small files hash fine, so the bug only shows on the big model shards. ## What happens ``` checking Qwen3.8-Flash-Next-UD-IQ4_XS-00002-of-00003.gguf (SHA-256, 49.8 GB) ... [X] ... has the wrong SHA-256 (cd6e40937ddf0f39d68748f1f086b423565fcb8a6d0a32f4ac52a5be35d8f744, expected 577a38a2392b40ca2193cea502e1d92f60b8cd370675d308e0ec21885d9daaa7): deleted ``` After a fresh 49.8 GB download the check reports another value (`ec899c68…`); shard 3 (43.8 GB) fails the same way (`e2f8d605…` vs expected `d4634e6d…`). ## Proof that the bytes are fine and the check is not * Same file, external hasher (`certutil -hashfile <file> SHA256`): **`577a38a2…`** — exactly the `lfs.oid` the Hub publishes for `unsloth/Qwen3.8-Flash-Next-GGUF`, both on `main` and on the commit pinned in `setup.py` (`38bb39ee…`). * Shard 3, same external hasher: **`d4634e6d…`** — its Hub oid. Setup's own check on those same bytes said `e2f8d605…` and deleted the file. Environment: Windows 10 19045, Python 3.13.13, Strata 0.1.45. ## Correct way to verify these files Use an external hasher instead of `hashlib`: * Windows: `certutil -hashfile "<file>" SHA256` * macOS / Linux: `shasum -a 256 "<file>"` and compare the result with the file's `lfs.oid` from the Hub API (`https://huggingface.co/api/models/<repo>/tree/<ref>/<dir>?expand=true`). ## Also: do not delete on a mismatch Rename the file to `<name>.bad` and keep it. Then a mismatch costs a re-check, not another 50 GB download, and the user still has the bytes for a manual verification. ## Workaround for users today Put `<file>.done` next to the file containing `sha256 <expected>` — `verify_sha256` then skips the check. The `whole (checked against its own tensor directory)` form written by `whole_shard` is not enough for a pinned hash: it still re-hashes.
Author
Owner

@Astemiir commented on GitHub (Oct 17, 2026):

Short version, @Niko1221:

  • verify_sha256 in setup.py gives a wrong SHA-256 on large files (our failures are 43–50 GB shards). Small files are fine, so it only shows on the model shards.
  • The bytes are correct: certutil -hashfile <file> SHA256 on the same file returns exactly the Hub's lfs.oid (577a38a2… for shard 2, d4634e6d… for shard 3), while setup reported cd6e4093… / e2f8d605… and deleted both.
  • Reliable check: use an external hasher — certutil -hashfile "<file>" SHA256 on Windows, shasum -a 256 "<file>" on macOS/Linux — and compare with the lfs.oid from the Hub API. Treated as a bug in the hashing path, not in the download.
  • On a mismatch, please do not delete: rename to <name>.bad and keep it. Then a wrong check costs a re-check, not another 50 GB download.
  • Workaround we use meanwhile: a <file>.done containing sha256 <expected> makes setup skip the check (whole (checked against its own tensor directory) is not enough for a pinned hash).
<!-- gh-comment-id:6234857205 --> @Astemiir commented on GitHub (Oct 17, 2026): Short version, @Niko1221: * `verify_sha256` in `setup.py` gives a wrong SHA-256 on large files (our failures are 43–50 GB shards). Small files are fine, so it only shows on the model shards. * The bytes are correct: `certutil -hashfile <file> SHA256` on the same file returns exactly the Hub's `lfs.oid` (`577a38a2…` for shard 2, `d4634e6d…` for shard 3), while setup reported `cd6e4093…` / `e2f8d605…` and deleted both. * Reliable check: use an external hasher — `certutil -hashfile "<file>" SHA256` on Windows, `shasum -a 256 "<file>"` on macOS/Linux — and compare with the `lfs.oid` from the Hub API. Treated as a bug in the hashing path, not in the download. * On a mismatch, please do not delete: rename to `<name>.bad` and keep it. Then a wrong check costs a re-check, not another 50 GB download. * Workaround we use meanwhile: a `<file>.done` containing `sha256 <expected>` makes setup skip the check (`whole (checked against its own tensor directory)` is not enough for a pinned hash).
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271357183 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#1175
No description provided.