Repository navigation
bloomery-serve: the seat's flags and levers are checked before the driver is asked and the model fetched - #908
juliankang4 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: one rule ("may the --hf repo's projector be picked") is now written twice in vision_seat::Flags, with two different sources for the repo fact.
Must fix
1. One owner for "the repo may supply the projector"
crates/gpu-gates/src/vision_seat.rs:157 check_source spells !cfg!(vision) || !from_repo || self.no_mmproj (with no --mmproj). may_pick, line 169 spells the same rule as vision && mmproj none && !no_mmproj && hf_repo(). They are equal today. When one changes (a new way to disable the projector, a non---hf source), the early check and encoder disagree: the start passes the check and then picks no projector, or the reverse.
Cost: the duplicate is new in this diff. Folding it now removes lines.
Fix: pass the repo fact in, and use the one rule in both places.
fn check_source(&self, from_repo: bool) -> Result<(), GateError> {
match self.mmproj()? {
None if self.sets_limits() && !self.may_pick(from_repo) => Err(
"--image-min-tokens/--image-max-tokens without --mmproj: no image input to bound"
.into(),
),
_ => Ok(()),
}
}
fn may_pick(&self, from_repo: bool) -> bool {
cfg!(feature = "vision") && self.mmproj.is_none() && !self.no_mmproj && from_repo
}In encoder (line 188) call self.may_pick(crate::model_file::hf_repo().is_some()).
Non-blocking
⚠ A lever the seat does not read is reported twice: crates/gpu-gates/src/bind.rs:505. check_seat calls at_main_with_flags, which prints each "X is not applied" line (levers/src/lib.rs:3093). The start now calls it in early and again in run. With no --model, it is called once per seat tried. A set Direct lever (read elsewhere) therefore prints two or more times. Direction: have the early call suppress the notes, or read the levers once and hand them to run.
Checked
- Duplicates: about 30 new items checked. One hit (finding 1).
check_seat,refuse_plain_width,check_residency_feedandcheck_headeach remove copies. dryer searchedcrates/serveonly and found no pair. TheResidencyAtblock appears in bothds41::checkandds41::run; the two short copies cost less than an owner, so not raised. - Complexity:
early(new, 27) andqwen38::check(new, 24),ds41::check(new, 18): new functions, complex on their own;earlyhas four jobs (source, head, decide seat, generative view). A split would add functions, so none is asked.qwen3::parse_args,glm::parse_args,qwen38::parse_args,SeatFlags::parse,Flags::take: one added call each, even growth. - Silent failure: 9 sites followed (
levers.expect, twounreachable!,.transpose,then_some,file_snapshotcachedErr,referenceUTF-8,viewErr,any_seat). Each ends in a named error or an unreachable behind the check that precedes it. - Tests: mutants tried in words:
earlycall removed fromrun(serve_preflightrefusal tests go red);check_headcomparison flipped (conflict assertion red);--leversdropped fromserve_takes_value(serve_options_skip_values_and_keep_switchesred);--ctx-sizecheck moved after the fetch (clean_refusalfindsfirst start, red). - Gates: no pin moved. No band, tolerance or lint level changed.
- Escape catalog: no match. No shell script changed.
- Performance: load-time and start-up code only. No decode or prefill path touched.
Notes
gpu.jsonevidence is false: the PR body has a gate result and the card name, but nonvidia-smiline and no commit hashes. The body listsjust contrib-check --tier t0,tools/check-recipes.shandcargo check --workspaceas not run.
Card check: needs-gpu. This pull request changes crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/bin/bloomery_serve_ds41.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
…iver is asked and the model fetched A start with --model reads the seat's own levers and parser on the arguments as the seat will see them, so --help, a flag the seat does not take, a value it refuses and a refused lever end the start before --hf downloads anything; the qwen38 and decide seats hold the ubatch size to the engine's there too. A --head selects the decision seat before these checks. Without --model or --head, every seat checks them and one taking them is enough, since the model file picks the seat; the refusal of an argument every seat refuses names each seat's text once. The decision candidate applies the same embedding restriction as a named decision seat. Head/seat conflicts are checked by the same owner as the final head selection. Output-only handlers distinguish option words from values, including the device list and each seat's record schema. The ds41 seat chooses its placement in run, so its parser reads no card; its --ctx is held to the fewest slots the start serves, and the qwen3 seat's --cache-type-k word to its formats. The decide seat, named or picked by the file, reads the arguments as its own start does, without llama-server's placement variables, so a split mode the generative seats refuse does not end a decision start. Checks that need the model stay after the fetch, the glm seat's image token limit with no --mmproj among them, since the --hf repo may hold a projector to bound. A key file is read once per process, so the check and the seat take the same keys, a pipe's included.
85b4684 to
e0df07b
Compare
There was a problem hiding this comment.
Verdict: CLEAN: the one must-fix of the last review is fixed, and the new lines add no failure path.
Since the last review:
- Must-fix 1 (one owner for "the repo may supply the projector"): fixed.
may_pick(from_repo)is the only spelling of the rule.check_source(line 159) andencoder(line 185) both call it. The test at line 1394 covers both values offrom_repo. - ⚠ A lever the seat does not read is reported twice: still open, crates/gpu-gates/src/bind.rs:512.
check_seatandrunboth callat_main_with_flags, so a set Direct lever prints its "not applied" note more than once. Direction: suppress the notes in the early call, or read the levers once and hand them torun. This does not block the merge.
Checked
- Duplicates: 2 new items checked in this interdiff (
may_pickparameter, the changed test), none duplicated. dryer searchedcrates/serveonly and found no pair. - Complexity: the new commits touch no function crapper flagged.
- Silent failure: 1 site followed.
from_repocomes fromhf_repo().is_some()at both call sites, so a missing source stays a named error. - Tests: mutant "
from_repoignored inmay_pick" turnsa_repository_can_supply_limits_only_in_a_vision_buildred oncheck_source(false). - Gates: no pin moved.
- Escape catalog: no match. No shell script changed.
Notes
gpu.jsonevidence is false: the PR body has a gate result and the card name, but nonvidia-smiline and no commit hashes.
Card check: needs-gpu. This pull request changes crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/bin/bloomery_serve_ds41.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
Superseded by #912. |
bloomery-serve가 모르는 flag, 잘못된 값, 모델 출처 누락,--help와--levers를--hf다운로드와 GPU 확인보다 먼저 처리하도록 고칩니다.Part of #565.
What and why
bloomery-serveread a seat's flags and levers only after it had asked the driver and fetched the model with--hf. A typo such as--ctx-size abc, an unknown flag, a bad lever value, or--model qwen38 --helptherefore ended after a large download, and without a model file the seat's help never appeared.Now the launcher checks the arguments as far as that needs no model, card or network.
bloomery-serve --model qwen38 --hf o/r --ctx-size abcends with the argument error before the driver check and the download. With--modelor--head, the selected seat's--help,--leverstable and refusals of flags, values and levers come first. Without either flag the model file picks the seat, so every seat checks the arguments and the start ends only when all of them refuse; the message lists each refusal once with the seats that give it. The picked seat reads the arguments again after the download, as before.Each seat's
checkis one entry intobind::check_seat, which runs the same levers read andparse_argsthat the seat'srunuses and hands the typed result torun, so the early check and the real start share one owner. What needs the model (architecture, a context bound by the file, a draft the file supports) is still checked after the fetch. A generative start with llama-server placement flags resolves its overrides after device discovery, so its levers,--leversincluded, are read there.Also in this change:
--ctx-sizewith--parallelfor at least one position per slot,-ubfor its range in the Qwen3.8 and decide seats, draft, feed, steps and residency combinations (GLM and the tiered seats sharetiered::check_residency_feed), a missing model source, an explicit tier larger than the card, and--parallel 2on Nemotron.--mmprojwith--no-mmproj, image token limits on a build without vision or with no projector to bound, and zero or inverted limits are refused in one place,vision_seat::Flags. Limits with a repository that can supply the projector are accepted.--headand--head-configare checked against the seat word indecide::check_head, whichpickalso calls.--aliasvalue that spells a switch (--levers,--list-devices,--version,--cpu_moe) is read as a value. Every launcher scan reads values throughllama_launch::serve_option. The qwen3 and decide seats do not take--alias, anddocs/serving.mdsays so.--api-key-fileand--chat-template-fileare read once per path at start, throughserve::flag::file_snapshot, so a pipe such as/dev/stdinserves after the early check has parsed the flags.docs/serving.mdsays so.Release notes: Fixed:
bloomery-serverefuses a bad flag, value or lever, and answers--helpand--levers, before it asks the driver or downloads the model.Code shape
bind::check_seatwith its ownparse_args; there is no second parser. The placement view the launcher builds isllama_launch::seat_view, whichLauncher::placeduses too. Source words go throughhf::source, head checks throughdecide::check_head, image limits throughvision_seat::Flags. The refusal of a draft width without a draft has one owner,bind::refuse_plain_width, which every seat calls.checkthat calls their existing parser, and their model-specific refusals stay in their own files. No common owner gained a per-model branch.pickcarried moved intodecide::check_head, the image-flag refusals intovision_seat::Flags, and the GLM and tiered steps and residency refusals intotiered::check_residency_feed. Nothing this change made unused is left.cargo fmtandcargo clippyare clean on what I touched:cargo clippy -p bloomery-gpu-gates -p bloomery-serve --all-targets -- -D warningsexit 0.Duplication found or removed (
path:line), or "none": the head-flag refusal inpickand the image-flag refusals in the seat parsers now live incrates/serve/src/decide.rs(check_head) andcrates/gpu-gates/src/vision_seat.rs(Flags). GLM's and the tiered seats' steps and residency refusals are one function,crates/gpu-gates/src/bin/shared/serve_seats/tiered.rs(check_residency_feed). The sixteen candidates the duplicate scan reported are the seats'checkentries, which callbind::check_seatwith their own parser, or refusals that differ by model.What I ran
The gate below ran on a DGX Spark (see Hardware). The change touches no device code and no decode or prefill path, and no speed claim is made.
The recipe runs the
bloomery-serveandbloomery-serve-ds41unit tests and the newtests/serve_preflight.rs, which starts the binary with an empty model cache and checks that each refusal comes with the argument error and no driver or download output. I added--test serve_preflightto that recipe, and added the two hardware caseshw_preflight_normal_inputs_reach_the_fetchandhw_a_device_list_alias_reaches_the_selected_seat(both#[ignore], they need a CUDA 13 driver) to the GLM serve-start recipe. To reproduce the ordering, start a seat with an empty model cache:Not run on this head:
just contrib-check --tier t0andtools/check-recipes.sh.cargo check --workspaceandpython3 tools/model_tax.py check.#[ignore]hardware cases, the test file built with thevisionfeature, and a build on a DGX Spark.Hardware
DGX Spark, NVIDIA GB10, driver 595.84.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.