Repository navigation
[Other] use published size when download length probes fail - #2287
KeyanHu-git wants to merge 4 commits into
Conversation
Use published ModelScope sizes and validated GET response lengths before promoting a partial download. Resume incomplete chunked bodies, recover complete partial files after HTTP 416, and retain unverifiable transfers as .part files. Reuse metadata for the final SHA-256 check. Add local HTTP regressions for early EOF, Range validation, 416 recovery, ModelScope metadata reuse, chunked responses and unknown/zero lengths. Fixes Niko1221#1915 Signed-off-by: Keyan Hu <177766066+KeyanHu-git@users.noreply.github.com>
|
Hi @Niko1221, could you take a look at this fix for #1915 when you have a chance? The early-EOF regression cases reproduce the issue on main and pass with the patch on Windows. I also submitted #2288 for the GGUF validation issues in #1919. I’d appreciate your thoughts on its handling of unknown tensor sizes: it reports that completeness cannot be verified and asks the user to keep the file, instead of counting the unknown size as zero. Thanks for your time! |
…its Content-Length Source: Niko1221#2287 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…up robustness, conversation cache memory) Serve: Niko1221#2290 Niko1221#2284 Niko1221#2285 Niko1221#2170 Niko1221#2140 Niko1221#2278. Setup: Niko1221#2161 Niko1221#2287. Engine: Niko1221#2253 Niko1221#2265 Niko1221#2247 Niko1221#2217 Niko1221#2243. New opt-in engine flags: --session-state-codec (enabled in the local configs), --conversation-cache-park-gain and --drop-file-cache (left off: no measured benefit on the RX 7600 XT box). Bench: bench/results/upstream-prs-2026-10-13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the pull request. 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 review 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:
The rules are in CONTRIBUTING.md. |
|
/reopen |
|
Reopened, thank you. A maintainer will pick it up from here. If it conflicts with main, rebase it first; that speeds up review. |
…e response length) — integ batch 18
…2287) When HEAD and the one-byte range probe both gave no length, download() took an early EOF as a finished file even though the repository pin (or ModelScope's published size) names the size. The published size now stands in for the length, so the existing resume, retry and parallel code publishes the file only after it has all its bytes; a size that disagrees with the pin is still refused before the transfer and the SHA-256 check is unchanged. Ported from PR #2287 by KeyanHu-git with its tests (tools/test_setup_download_length.py).
|
Thanks. Confirmed: with no length from either probe, an early EOF is taken as complete. Under review for 0.2.7. Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7 |
HEAD と 1 バイトの範囲の問い合わせのどちらも長さを返さないと、download() は早く来た EOF を ダウンロードの終わりと取っていた。固定の大きさ(または ModelScope の公開の大きさ)を長さの代わりにし、 続きからの再開・やり直し・並列の経路が、全部のバイトがそろってからファイルを出すようにする。 固定と違う大きさは転送の前に断り、SHA-256 の確かめは変わらない。upstream Niko1221#2287。
…の 1) serve の変更 - 宣言していない名前の tool call を文のまま返すとき、その名前を strata_rejected_tool_calls で答えに添え、/metrics/prometheus で数える(upstream 805ebe1、Niko1221#3796) - 名前空間つきの tool は namespace=member、namespace_member、member だけの綴りでも受け、`__` を `_` に潰した綴りも宣言した tool として読む(upstream fd8d37e、805ebe17b、Niko1221#3972) - Chat Completions の tool の結果を、答えた call の順に並べ直す(upstream 11237f8、Niko1221#3395) - message のない chat の要求は 400 にする(upstream 8a3ca07) - --host :: で IPv6 で待ち受ける(upstream eba3106、Niko1221#3212) - /v1/responses の max_output_tokens は 0 と -1 を上限なしとして受け、答えに timings を付ける(upstream 9c2d35d、a0fc88abd、Niko1221#4036、Niko1221#3291) - response_format の repair_latex_escapes で、LaTeX のエスケープで壊れた JSON を直してから検査する(upstream 2cc6ea1、Niko1221#2893) - 1 トークンの答えには decode の速さを出さない(upstream 5d5c26d) - elastic な画像エンコーダーが起動できなければ 503 を返す(upstream 092c7d1、Niko1221#2435) - lifeline の識別は子プロセスの開始時刻にし、sampler は壊れた source に耐える(upstream b3db5a1、Niko1221#3590、Niko1221#3407) - web ページ: 答えを追うのは読み手が離れていないあいだだけ(upstream 89a68d8)、広い窓を使い狭い画面に収める(upstream ad1a310、Niko1221#3176) setup の変更 - cmake と ninja は venv のものを先に取り、CMakeLists.txt が求める 3.24 より古い cmake は使わない(upstream 5bfce4b、Niko1221#3822) - 別の generator で configure された build フォルダーは作り直す(upstream bf994ca、Niko1221#4038) - ダウンロードの長さが取れなければ公開されている大きさを使う(upstream a1d2fd7、Niko1221#2287) - 2 分データが来ないダウンロードは止まっていると言う(upstream ed0c893、Niko1221#3567) - --rope-scale は有限で 1 以上の値だけ受ける(upstream a332cc9、Niko1221#3393) - pip の記録はどの OS が書いたかを覚え、別の OS の記録は信じない(upstream fb3bae2、Niko1221#3634) tools の変更 - gguf_reader.py はヘッダーの読みに上限を置き、壊れた metadata を ValueError にする(upstream 409f246、Niko1221#2288、Niko1221#1919) - strata_bench.py は amd-smi しかない ROCm 7 以降でも AMD のカードの名前を書く(upstream c471588、Niko1221#3630) - calibrate.py は計測の途中でエンジンが落ちても、その候補だけを落として続ける(upstream 41188ec、Niko1221#3317) - chat.py は端末で fenced code block に色を付ける(upstream 3e81173、PR Niko1221#1895) - 試験: llama.cpp の gguf-py がなければ test_iq_pack は skip、ほか試験の穴 3 つ(upstream 5b14fe2、Niko1221#3236) fork に合わせて変えたこと: upstream の docs/DETAILS.md の差分は取らず、文書は別に書く。logprobs(upstream 9ea0449)は fork にすでにあり、allowed_token_ids は見送り。Control(strata_control)に依る setup の変更と、fork にない機能(presets の警告、Delete a model、queue timeout の badge)は取らない。
Problem and result
When HEAD and the one-byte range probe both fail to provide a length,
download()treats an early EOF as completion even if Strata already has the file's published size. A short file is renamed out of.part, and verification either stops with a size error or, without a published hash, marks the fragment as finished.Use the published size for transfer completion as well as verification. The existing downloader then resumes an interrupted transfer, keeps partial bytes when retries run out, and publishes the file only after receiving the expected length.
Related discussion
#1915. Version 0.2 added a range probe, which covers missing HEAD length when that probe succeeds. This fix covers the remaining case where both probes lack a size. The original ModelScope URL supplied Content-Length when checked on October 22; the regression below reproduces the remaining condition with a local HTTP server.
Approach
After the transport probes, fall back to the repository pin's size, or ModelScope's published size when there is no pin. Reuse the existing metadata lookup for hash verification.
The production diff moves the metadata lookup and adds a two-line fallback. Serial retries, parallel transfers, source identity and checksum verification retain their existing implementations.
Validation
Base:
011c9e60(0.2.2 / engine 0.1.47). Final revision:7527e00f. Python 3.12 on macOS and Windows.Passed: all 8 focused tests on both systems. They cover early EOF with a pin, metadata with and without a hash, exhausted retries preserving
.part, parallel transfer after a failed initial probe, an already complete.part, a transport/pin size conflict and a wrong hash. Six of these fail on the unmodified base; the size-conflict and hash checks pass on both.The early-EOF fixture supplies 262,144 of 2,633,785 bytes before closing. The patched serial transfer resumes at byte 262,144 and produces the exact original bytes. Exhausting retries preserves those 262,144 bytes without a final file or
.donemark.Failed: the combined suite passes 36/37 on both macOS and Windows. The shared redirect test counts the first piece twice (
[0, 0, 1, …, 40]instead of[0, 1, …, 40]). It uses a successful HEAD length, so this fallback is not entered. The production code for that path is unchanged. The same 37 tests on unmodified main report 4 failures and 3 errors on both systems, including the six focused regressions above.Not run: another multi-gigabyte transfer through the original reporter's network. All transfer tests above use real HTTP requests to a local server; published metadata is supplied by the fixture.
Limits
If neither transport probes nor published metadata provide a size, the existing unknown-length behavior remains. The fallback does not replace hash verification or change which model files Strata accepts.