mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 21:05:40 +07:00
[GH-ISSUE #1915] [Bug]: ModelScope: a truncated shard is renamed to its final name — HEAD gives no Content-Length (total=0 in download()) #756
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#756
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 @moondrop12138 on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1915
What happened
Installing with
STRATA_SOURCE=modelscopeon a mainland-China network (Windows),--family coder --model IQ1_M --context 65536 --vision no. Step 5, downloadingIQ1_M/Qwen3.8-Flash-Next-GSQ-RCO-IQ1_M-00001-of-00002.gguf(29,608,446,496 bytes per ModelScope's file API): the stream ended cleanly at 5,466,520,256 bytes after ~7 minutes (~13 MB/s). Nodownload interrupted (...); retrying in 10 s ...line appeared — the socket simply reached EOF — and setup then printed:Expected: an interrupted download resumes (as it already does when
totalis known), and a short file is never renamed to its final name.What made this possible: ModelScope's
/resolve/HEAD responses carry noContent-Length(verified with curl, with and without an HTTP proxy):So in
download()(setup.py @61b3fb5)totalstays 0, and withtotal == 0the whole safety net is off:5466.5 MBwith no denominator — which is the visible tell;if not total or have >= total: break(line 1522). A connection reset would raiseOSErrorand be retried withRange, but a clean FIN after partial data looks exactly like a complete download;if total and part.stat().st_size != total:(line 1528);part.replace(dst)(line 1531) promotes the 5.4 GB fragment to the shard's real filename.Only afterwards does
verify_sha256()'s size check againstms_meta()(line 1634) fail. And because the.parthas already been renamed away, the "delete it and run setup again (the download restarts)" instruction discards the 5.4 GB that a.part-aware message could have resumed. (Manual recovery does work: rename the fragment back to…gguf.partand rerun — I did exactly that after the fix below, and the download resumed from 5.47 GB, ~17 MB/s on a direct connection.)This is the same
total == 0defect as #1797 (GitHub's codeload endpoint), a third trigger host and a different aftermath: there, a truncated archive's.donemark sticks and every rerun dies withBadZipFile; here, a truncated GGUF shard silently receives its final name and the user is told to restart a 29.6 GB download that could have resumed.Suggested fix.
ms_meta()already knows the file's published size before the download starts (anddownload()consults it right after, for the hash). Use it astotalwhen HEAD has none:and reuse
metaat the end of the function instead of fetching it again:With
totalset, the existing retry loop already does the right thing on a premature EOF (it re-requests withRange: bytes={have}-and appends), so no other change is needed — the three skipped defences (progress denominator, resume-on-early-EOF, final size check) all come back. A more general variant for any host that strips the length: whentotalis still 0, parse it from the first 206 response'sContent-Range: bytes 0-…/29608446496.Nice-to-have: when the final check does fail, the message could offer "keep it as
<name>.partto resume" instead of "delete it".Strata version, GPU, OS
setup.py @
61b3fb5(main, 2026-10-10; ready-made engine 0.1.42) · RTX 5070 Ti 16 GB · Windows 10.0.26200 · Python 3.11.15 ·STRATA_SOURCE=modelscope,--family coder --model IQ1_M --context 65536 --vision noLog
The excerpt above is the whole failure: the progress line without a denominator, then the size check. The run's setup.log contains no
download interruptedline — the early close was a clean EOF. For comparison, the same file after the suggested fix (resumed, minutes into the rerun):@qiuzan2001 commented on GitHub (Oct 15, 2026):
Reproduced on Linux with main
296b59d2: a local server answers HEAD withoutContent-Length, then sends a GET withContent-Length: 3145728that delivers 1 MiB and closes.setup.download()prints[ok] model shard downloaded, renames the 1,048,576-byte file to its final name and writes its.donemark, becausetotal == 0from the HEAD turns off the length checks. Open PR #2287 fixes it: itstools/test_setup_download_length.pypasses on that branch (14 OK) and fails against main'ssetup.py(7 failures, 3 errors).@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:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.