mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #327] tools/mtp_fetch.py silently saves wrong data when a mirror ignores the Range header - MTP acceptance stays 0 with no visible error #154
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#154
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?
Originally created by @lifeidle on GitHub (Oct 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/327
Summary
On first setup, MTP acceptance was 0 in every configuration —
drafts accepted 0 of 0on defaults, and0 of 765withspec_min_p=0(windows forced open). The engine loaded fine and chat worked; only speculation was dead, with no visible error anywhere.Root cause: 20 of 31 fetched
mtp.*tensor files did not contain tensors at all — they contained the beginning of their safetensors shard (JSON header + unrelated data). The mirror ignored the HTTP Range header and returned200with the whole file;tools/mtp_fetch.pykept the firstn_bytes, which is exactly the shard's header region.Why it was invisible
Two checks that look sufficient are not:
The failure mode is fully silent: the engine loads the weights, decodes fine (they are garbage but bounded), and only the drafter collapses —
dprob=NaN, draft tokens pinned at 0, and the window logic keepsT=1so most users just see "MTP doesn't help".How it was found
drafts accepted 0 of 0is the offered count →Twas always 1, the drafter was never given a chance (earlier reading: "all drafts rejected" — wrong)spec_min_p=0):drafts accepted 0 of 765— proposals exist and are 100% wrongdprob=NaN, draft ids pinned at 0 → NaN enters at the firstfc_embeddingmatmulf32norm weights at ~2.1e37 magnitude from tensor #11 on,q8_0scales = inf{"__metadata__"...— the shard's own safetensors headerFull data: https://github.com/lifeidle/qwen3.8-flash-next-5090-laptop-256k/blob/main/docs/mtp-corruption-postmortem.md
Result after re-fetching the 20 files (~110 MB; the two 5 GB expert tensors were fine)
Suggested fix in
tools/mtp_fetch.pyWhen a Range was requested, verify the response is actually partial:
and optionally assert the saved blob does not begin with a safetensors header (
[u64 len][b'{"']). One more layer: since the shard headers are already downloaded byinventory, a spot check that the first bytes are not{"would have caught this immediately.Environment
huggingface.cowas proxied); mirrors/proxies are exactly where Range headers get dropped, so this is not an exotic path@Niko1221 commented on GitHub (Oct 1, 2026):
Confirmed. 0.1.32: mtp_fetch requires HTTP 206 with a matching Content-Range, re-reads an inventory from another repository, and checks per-tensor sha256 for the pinned revision so a corrupt install is detected and fetched again.
@Niko1221 commented on GitHub (Oct 1, 2026):
Fixed in 0.1.32: HTTP 206 + Content-Range required, per-tensor SHA-256 checked (a corrupt tensor is fetched again), another repository's inventory is re-read. Thanks!
@lifeidle commented on GitHub (Oct 2, 2026):
Wonderful — thanks for the lightning-fast fix! Verified that both checks we suggested (206 + Content-Range enforcement, and per-tensor hashes against a trusted reference) made it into v0.1.32, plus the cross-repo inventory re-read is a nice extra layer we hadn't thought of.
One note for anyone reading this thread: our postmortem with the full investigation trail and the corruption-detection/repair scripts is here — lifeidle/qwen3.8-flash-next-strata-5090-laptop-24gb. We'll upgrade to v0.1.32 and confirm.