Repository navigation
bloomery-serve, model-hf: a --hf repo's architecture picks the seats that check the arguments before the fetch - #958
Conversation
…that check the arguments before the fetch With no --model or --head, arguments only some seats refuse no longer pass the early check on the strength of a seat the file will never pick. The start reads the repo's listing and the architecture of the file the fetch would open (a GGUF set's first shard's header by HTTP Range, a checkpoint's config.json through its folder map) and ends with the refusal of the seats that may serve it: --prefill steps on a Qwen3.8 repo is the qwen38 seat's refusal, and --parallel 2 on a Nemotron repo the nemotron seat's, both before the download. Arguments every seat takes read nothing, and a repo that cannot be read that way (HF_HUB_OFFLINE, no network) leaves them to the picked seat after the fetch, as before. A folder map names its header's architecture from the config alone (FolderMap::architecture), which its header now uses too.
There was a problem hiding this comment.
Verdict: CLEAN: I built three failure scenarios against the seat narrowing and the repo header read, and the code blocks each of them.
Non-blocking
⚠ The "no GGUF set, then checkpoint" rule now has a third copy: crates/gpu-gates/src/model_file/fetch.rs:282 repeats gguf_sets + checkpoint_files + pick from Client::resolve_drafts (crates/hf/src/fetch.rs:659) and offline_set (line 724). The PR body says it uses "the existing rules", but it copies them. If the rule in hf changes, the early check reads another file than the fetch and may refuse arguments the real seat takes. Direction: put the choice (set's first file, or checkpoint's config.json) in one hf function that all three call, only if it removes more lines than it adds.
Checked
- Duplicates: 14 new items checked. One duplicate of an existing rule (the ⚠ above). dryer reported 0 pairs in
crates/model-hf;gpu-gateswas not searched, so I grepped it by hand. - Complexity: crapper flagged
drive::early(27 → 29). The growth is one closure and one argument.any_seatwas split intoeach_refusal, which lowers its own nesting. - Silent failure: 6 sites followed.
held(r).ok()drops every read error, so the start goes on and the fetch reports the same error by name. This is documented and the new test pins it (early(None, ..)with a failing reader).shard_headersurfaces the remove error and the create error. - Failure scenarios built and refuted: (1)
seats_ofreturns an empty list, soany_seatprints a refusal with no lines. The qwen3 seat answersNonefor every architecture, sonamed(None)is never empty. (2) The qwen3 seat serves a file whose architecture another seat names, so the narrowed list misses the real seat.Family::oftakes only the qwen3moe, qwen35moe, qwen35 and llama programs, and no other seat names those. (3) A fixed/tmpname is pre-made as a link.File::create_newrefuses it and the check passes; the new test pins this. - Tests:
a_repo_s_model_picks_the_seats_that_check_before_the_fetch. Mutantrefused.len() < seats.len()→<=turns the qwen4exp and nemotron cases green on anErrthey expect, so they go red. Dropping theDecidepush for backbones turns theqwen35case red.a_shard_header_is_never_written_through_an_existing_path: truncating open instead ofcreate_newturns it red (the body shows it). - Gates: no pin moved. The
Model::servesmirror intools/hf-arch-check.pyfollows the rename, including the self-test's doctored arm. - Escape catalog: none matched (no shell changes).
Notes
- The PR body names head
9d43ddfd…, but the PR head is8139eb6f…. Say which commit the card runs used. - The speed claim is absent. No performance finding: the new work runs once at start, not in a decode step.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/model_file.rs … and carries a gate run on the author's card, which counts as verified.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
--model없이--hf로 시작할 때, 일부 seat만 거절하는 인자를 모델을 받기 전에 그 repo의 seat 기준으로 거절하게 고쳤습니다.Part of #565.
What and why
Without
--modelor--head, the model file picks the seat, so the argument check before the download could only refuse what every seat refuses. An argument that only some seats refuse passed that check and failed after the whole download. For example--prefill stepsis taken only by the glm and mimo2 seats, and--parallel 2is refused by Nemotron.Now, when the seats disagree about the arguments, the start reads the
--hfrepo's file list and the architecture of the model it holds, and ends with the refusal of the seats that may serve that model, still before the download. The read is the first GGUF shard's header by HTTP Range (a sparse file created exclusively, so an existing file or symlink at that path is refused and never written through, and removed afterwards), or a checkpoint'sconfig.json. No weights are fetched. A start every seat accepts reads nothing extra. UnderHF_HUB_OFFLINE, or when the repo cannot be read, the check passes as before and the seat checks again after the fetch.model-hf:FolderMap::architecture(the nemotron_h map included) gives thegeneral.architectureeach map writes in its header, andfolder::architecturereads it from aconfig.jsonthrough the samemodel_typelookupopenuses.gpu-gates:model_file::repo_architecture(built with thehffeature, so the defaultbloomery-servebuild runs the read) picks the file a fetch would open first with the existing rules and reads its architecture and<arch>.decision.type.bloomery_serve.rsgainsModel::serves_arch,seats_ofand aheldargument onearly. The list of seats it names always contains the seat a real start would use, so it never refuses an argument the real seat accepts.docs/serving.mddescribes the new behavior.Release notes: Fixed:
bloomery-serve --hf <repo>without--modelnow refuses an argument the repo's model cannot take (for example--prefill stepson Qwen3.8, or--parallel 2on Nemotron) before the download starts.Code shape
servesheld by architecture string moved intoModel::serves_arch, andservescalls it. The repo read reusesgguf_sets,pick,checkpoint_files,sparse_shardandgguf::inventory_of. Each map's architecture string has one owner, the header it already writes.model_type) is a named error. The check passes on it by design, and the fetch then reports the same failure by name.cargo fmtis clean on what I touched.Duplication found or removed (
path:line): none.What I ran
Head
9d43ddfdc2483f3910ff2e8747b165a3f866c32don top of822b3f181d644bf109a6c021ecbcabdfac9c14e4. Hardware is below.On a DGX Spark, the new test first fails with the repo read switched off (rc 101), then passes with it on:
a_repo_s_model_picks_the_seats_that_check_before_the_fetchpanics with--hf o/r --prefill steps: (),test result: FAILED. 0 passed; 1 failed, rc 101.drive::tests:test result: ok. 7 passed; 0 failed.model-hf:test result: ok. 12 passed; 0 failed.a_small_qwen3_folder_opens_as_a_qwen3moe_fileanda_target_opens_whatever_its_mtp_layer_holdsnow also assert thatfolder::architectureequals the architectureopenwrites in its header.The built
bloomery-servebinary, an emptyBLOOMERY_CACHE, network on,timeout 45:--prefill steps: rc 1, 0hfrecords, 0 cache bytes. First line:bloomery-serve: --hf unsloth/Qwen3.8-Flash-Next-GGUF:UD-Q4_K_XL holds a qwen4exp model, and no seat that may serve it takes these arguments, each refusing them as follows (--model names the seat):--prefill steps: rc 1, 0hfrecords, 0 cache bytes. First line:bloomery-serve: --hf nvidia/Qwen3.8-Flash-Next-FP4-Local holds a qwen4exp model, and no seat that may serve it takes these arguments, each refusing them as follows (--model names the seat):--parallel 2: rc 1, 0hfrecords, 0 cache bytes. First line:bloomery-serve: --hf nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF:Q4_K_M holds a nemotron_h model, and no seat that may serve it takes these arguments, each refusing them as follows (--model names the seat):--prefill steps,HF_HUB_OFFLINE=1: rc 1, 0hfrecords, 0 cache bytes. It passes the early check and stops at the fetch withno listing (HF_HUB_OFFLINE is set).The Qwen3.8 refusal names
--model qwen38: unknown argument "--prefill". No temporary header file was left in the temp directory after the runs.On an RTX 5090 machine and a CPU host, for the exclusive header file and the
hf-only build:model_file::fetch::tests:test result: ok. 4 passed; 0 failed. The newa_shard_header_is_never_written_through_an_existing_pathrefuses a pre-made symlink, leaves the target's bytes unchanged, then readsgeneral.architecture(qwen4exp) with one Range read and leaves no file. WithFile::create_newreplaced by a truncatingOpenOptions::open, it panics:test result: FAILED. 0 passed; 1 failed, rc 101.model-hf:test result: ok. 113 passed; 0 failed; 3 ignored.checkpointsucceeds (rc 0). The Qwen3.8 GGUF case refuses with the same first line as above, rc 1,cache_bytes=0, no header file left in/tmp. WithHF_HUB_OFFLINE=1it stops at the fetch withno listing (HF_HUB_OFFLINE is set), rc 1,cache_bytes=0.just gate-gpu-qwen3-serve(--model qwen3-q4_k_m,BLOOMERY_BOX_LOCAL=1): 132 PASS, 1 FAIL (completion_ids_are_the_cli_ids:cli split (host, card, ctx) Some((4608, 1536, 262144)) against the server's Some((4606, 1538, 262144))), thenref_manifest: cannot read /root/bloomery-data/ref_qwen35moe_vis_chatids_e1/MANIFEST.tsv: Permission denied, rc 1. Upstream main gives the same 132 PASS, 1 FAIL and the same Permission denied on that machine, so both come from outside this change.The two Nemotron seat gates on the RTX 5090 machine, at the head above:
gate-gpu-nemotron-serveonnvidia/NVIDIA-Nemotron-3-Nano-4B-GGUFQ4_K_M (revisionba223d14, sha256 checked):check parallel_above_one_is_refused: PASSwithbloomery-serve: --parallel 2: the nemotron body holds one sequence and no resident slots; the seat serves --parallel 1, the other seven checks pass, thenPASSED: gate_nemotron_serve, rc 0.gate-gpu-nemotron-h-moe-serveon thenemotron-boltfixture:check parallel_above_one_is_refused: PASS, the other seven checks pass, thenPASSED: gate_nemotron_serve, rc 0.This PR makes no speed claim.
Hardware (if the change is for a machine)
DGX Spark,
nvidia-smi --query-gpu=name,driver_version --format=csv,noheaderprintsNVIDIA GB10, 595.84. It ran the three test commands and the four binary cases. An RTX 5090 machine ran thehf-only build, the two binary cases,just gate-gpu-qwen3-serveand the two Nemotron seat gates; a CPU host ran the twocargo testcommands.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.