Repository navigation
Studio: offer vLLM or SGLang when the default engine cannot run a quantized checkpoint - #13135
Conversation
…ntized checkpoint
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7434ead5da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| method = method.strip().lower() | ||
| if method not in _MANAGED_ENGINE_QUANTIZATIONS: | ||
| return None |
There was a problem hiding this comment.
Normalize compressed-tensors quantization aliases
Checkpoints using the established compressed_tensors spelling never receive an offer because the method is only lowercased and then compared with the hyphenated key. The repository's existing quantization loader explicitly treats compressed-tensors, compressed_tensors, and sparseml as the same compressed-tensors family, so these legacy checkpoints still enter the Default-engine failure path instead of the new dialog. Normalize underscores to hyphens and map the supported legacy alias before this lookup.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: checkpoints spelled compressed_tensors keep exactly the behaviour they have on main (the existing refusal); the offer covers the spelling transformers and llm-compressor write today.
| engine_precision: "auto", | ||
| engine_parallelism: "tensor", | ||
| }; | ||
| engineSwitched = true; |
There was a problem hiding this comment.
Skip the Default-engine upgrade gate after switching engines
After this branch switches the request to vLLM or SGLang, execution continues using the Default-engine validation result, including requires_transformers_upgrade. A newly supported architecture can therefore prompt for—and require—the Studio Transformers overlay even though the selected managed engine runs in its own environment and will not use that overlay; declining the irrelevant upgrade aborts the managed load. Once engineSwitched is set, suppress the Default-engine upgrade gate or derive the requirement from a managed-engine validation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing here: the gates now run on the chosen engine's own /validate answer, the same one a load gets when vLLM or SGLang is picked in run settings. Whether managed loads should skip the transformers upgrade gate is a separate question for that existing path.
…lackwell; no offer for audio
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 757aacdbcf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if name != "sglang" or method != "compressed-tensors": | ||
| return True | ||
| # SGLang 0.5.20's compressed-tensors NVFP4 needs SM 10.0 (get_min_capability 100, no | ||
| # Marlin fallback; vLLM's starts at 7.5), so it is offered for these on Blackwell only. |
There was a problem hiding this comment.
Apply the Blackwell gate only to NVFP4 checkpoints
When a compressed-tensors checkpoint uses another format such as FP8 or W4A16 on an Ampere/Hopper host, method is still compressed-tensors, so this branch applies the SM 10.0 restriction and incorrectly removes SGLang from the offer. The restriction described here is specific to the NVFP4 scheme; inspect quantization_config.format before applying it so other compressed-tensors formats can still offer SGLang.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: SGLang is left out for every compressed-tensors format below SM 10.0 on purpose, since vLLM covers those formats on Ampere and Hopper and stays offered. Nothing that worked before is refused.
| return any( | ||
| float(row[1]) >= 10.0 for row in _driver_rows(None) or () if len(row) == 2 | ||
| ) |
There was a problem hiding this comment.
Check the GPUs selected for the SGLang load
On a mixed-generation host, a single B200 makes this return true even when the request selects only H100/A100 GPUs (or the B200 is outside Studio's visible set). The follow-up managed validation only applies the engine's general SM 8.0 support check and does not repeat this NVFP4-specific SM 10.0 requirement, so choosing SGLang can pass preflight, unload the resident model, and then fail during engine startup. Evaluate the resolved requested GPU IDs and require every GPU used by the load to meet the scheme requirement.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: a host mixing Blackwell with older GPUs and picking only the older ones for an NVFP4 SGLang load is outside what this dialog targets; that load fails with SGLang's own error and nothing silent happens.
…g chats and replaces
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 305e575be5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!nativePathToken) { | ||
| Object.assign( | ||
| validation, | ||
| await validateModel({ |
There was a problem hiding this comment.
Revalidate the chat-template override before unloading
When the checkpoint has a saved chatTemplateOverride, this managed-engine revalidation drops it; validateModel also does not serialize it and ValidateModelRequest does not declare it. The subsequent /load does send chat_template_override, but core/inference/managed_engine.py::validate_load rejects every override for vLLM/SGLang. Consequently the preflight passes, the current resident is unloaded, and /load then returns 400 and forces a disruptive rollback. Propagate the effective override through the validation API so this incompatibility is rejected before unloading.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: /validate has never carried chat_template_override, so a load that picks vLLM or SGLang in run settings with a saved override takes the same path today. Here it also needs an override saved for a checkpoint the Default engine has never run.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 305e575be5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ); | ||
| if (abortCtrl.signal.aborted) throw new Error("Cancelled"); | ||
| if (!stopDecision.proceed) throw new Error("Model load cancelled."); | ||
| keepsOthers = false; |
There was a problem hiding this comment.
Restore every kept model after a failed engine switch
When Keep loaded models is enabled with multiple resident slots, setting keepsOthers to false makes this a replacing load, and the backend's _retire_kept_models unloads every extra slot before managed-engine startup. If startup then fails, the rollback at use-chat-model-runtime.ts:3094 reloads only previousCheckpoint, leaving all other previously kept models unloaded. Fresh evidence in this revision is that the new rollback bookkeeping restores the primary model but neither snapshots nor reloads the entries in loadedNow; preserve or restore those extra slots as part of the failed switch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: this is the rollback every replacing load already has (kept extra slots are retired, the primary is restored on failure), including a vLLM or SGLang load chosen in run settings.
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…-switch revalidate in the pin contract
…pt-models note, show engine check errors in the offer dialog
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d669a1b43
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!engine) { | ||
| throw new Error( | ||
| `${displayName} is quantized with ${engineOffer.quantization}, which the default engine cannot run. Set Inference engine to ${engineOffer.engines[0] === "sglang" ? "SGLang" : "vLLM"} in its run settings to load it.`, |
There was a problem hiding this comment.
Treat cancelling the engine offer as cancellation
When the user clicks the dialog's Cancel button, confirmManagedEngineIfNeeded resolves to null without aborting the load, so this branch throws a normal failure. The surrounding handlers then replace the loading toast with an error and populate modelsError/lastModelLoadError, even though no load or unload was attempted. Route this through the same user-cancellation path used when the subsequent replacement prompt is declined.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Keeping this one as is on purpose. Cancel here means the user chose not to use vLLM / SGLang, and the toast is the only place they learn why the pick did not load and what to set instead (Inference engine in run settings). It matches what main does for the same pick, where the Default load fails with that refusal, and nothing was unloaded. The replacement prompt is different: there the user already chose the engine and only declined replacing the loaded models, which is a pure cancel.
…e engine revalidation with the load
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…load (unslothai#15139) The model picker, the compare pane and auto-load each built two payloads from the same settings: one for the `/validate` preflight and one for `/load`. `validateModel` then re-serialized the first through a hand-kept allow-list. That is 13 payload literals across `use-chat-model-runtime.ts`, `shared-composer.tsx`, `chat-adapter.ts` and `chat-api.ts`, and every new load setting had to be added to each one. The history shows the copies drifting apart: - unslothai#9410 added Checkpoints and the draft KV dtype to every load and never to the allow-list. - unslothai#13596 (vLLM/SGLang KV dtype, seed, memory limit) had to edit the picker, compare and `chat-api.ts` separately. - The managed-engine offer (unslothai#13135, then unslothai#13229) and GGUF settings preservation (unslothai#9562, then unslothai#11311) each landed on the picker first and needed a follow-up PR for compare and auto-load. The preflight exists so Studio refuses a load before it unloads the working model, and also to guard training. When `/validate` judges a different command from the one `/load` runs, it approves a load that `/load` then refuses after the unload, or refuses one that would fit. ## Changes - **One request, sent twice.** Each path builds one `LoadModelRequest` and sends it to both `/validate` and `/load`. Only the load-only fields are added at the `/load` call: request id, lease, force flags and `alongside`. - **The allow-list is gone.** `/validate`'s body is the load request; the route ignores load-only fields. `validateRequestBody` fills defaults for the non-nullable fields only. - **`llamaServerLoadFields`** owns the one rule for llama-server's knobs, which the three paths used to spell out with slightly different gating: - reasoning budget, batch sizes, server tuning and pass-through args are sent for GGUF only; - diffusion GGUF requests omit custom reasoning overrides, server tuning and pass-through args, while still forwarding batch sizes; - blank values are omitted, never sent as null. - **The picker re-baselines once.** On a model switch it re-baselines its per-model settings before `/validate`, instead of mirroring that reset in a second set of `validate*` variables. - **New module.** `lib/load-request.ts` holds the three helpers. Production code is 225 lines shorter. ## Preflight and load now agree - **The three dropped settings now reach `/validate`.** `validateModel` dropped `ctx_checkpoints`, `spec_draft_cache_type` and `tensor_split`. Checkpoints affect sizing; a load with Checkpoints set was priced at the default 32. Forwarding the draft KV dtype and GPU split makes validation apply the same explicit-setting precedence over inherited flags as loading. The training coexistence guard does not directly price draft KV memory. - **The picker and compare preflights now send the speculative mode and depth.** They omitted `speculative_type` and `spec_draft_n_max`, so validation used the default Auto mode, which already counts some drafters but can differ from the selected mode. The preflight now receives the same selected values as loading. Auto-load already sent them. - **A model switch with a staged run-settings config is now sized like the load.** The picker's preflight used Auto layers and no context pin, while `/load` used the staged layer count and context length. - **Compare and auto-load no longer send llama-server's pass-through args or tuning to a diffusion GGUF.** The diffusion runner takes none of them, and the picker already left them out. ## Validation - **Wire check:** the same GGUF request was sent through the real `chat-api.ts` of each checkout, comparing what `/validate` receives with what `/load` receives. On `main`, `/validate` is missing `tensor_split`, `spec_draft_cache_type` and `ctx_checkpoints`; here it is missing nothing. - **Contract test:** `chat-load-request-one-builder.test.ts` reads `ValidateModelRequest` from `studio/backend/models/inference.py`. It fails if any field it prices cannot ride `LoadModelRequest` or is not forwarded. It also table-tests the llama-server knob rule and checks that every path sends one request. - **Frontend:** `npm test` gives 13,857 passed. The 3 failures are HTML/TextEdit charset decoding tests that fail the same way on `main` in this environment. Typecheck is clean with both `bun check` and `tsc`. - **Python contract tests:** the 30 files in `tests/studio` that read these sources give 807 passed and 63 skipped. The two Playwright files cannot import here, on `main` too. - **The auto-load harness** (`test_chat_autoload_failure_gate.py`) now inlines the real `load-request.ts` instead of a copy; all 81 scenarios pass. - **Rewritten tests:** text-matching tests that counted the duplicated literals now assert one request per path. The rule they pinned is tested behaviourally in the new file. | Case | Before | After | |---|---|---| | GGUF load with Checkpoints, draft KV dtype or a per-GPU split | `/validate` sent none of the three; used default checkpoints and could resolve inherited flags differently | Same fields as `/load` | | Picker or compare load with a DFlash/DSpark drafter | Preflight sized Auto rather than the selected speculative mode | Selected mode forwarded, as in `/load` | | Model switch from a staged config with a context length and manual layers | Preflight sized Auto context and Auto layers | Sized like `/load` | | Compare or auto-load of a diffusion GGUF with remembered extra args | Args and tuning sent to a runner that takes none | Not sent, as the picker already did | Not in this PR: auto-load still ignores a model's saved engine (vLLM/SGLang) and loads it on the default engine. That looks deliberate (background loads avoid starting a managed engine), so it is left as is. --------- Co-authored-by: Daniel Han <[email protected]>
Follow-up to #13043 for #11728.
#13043 made the hub and the load error point at the optional engines. This makes the load itself do it: picking a compressed-tensors (NVFP4, FP8, W4A16, ...), AWQ or GPTQ checkpoint in chat with the Default engine now opens a dialog instead of starting a load that is guaranteed to fail.
The dialog only appears where the backend's own
support_reason(engine)says the engine can run: Linux x86_64 or Windows x64 (through Studio's private WSL2 distro), NVIDIA compute capability 8.0+ and a new enough driver. Mac, AMD, CPU-only, Windows ARM and older NVIDIA see exactly what they saw before.Changes
Backend
/api/inference/validatereturnsmanaged_engine_offer: {quantization, engines}for a Default-engine, non-GGUF, non-adapter, non-audio request whose checkpointconfig.json(ortext_config) sayscompressed-tensors, orawq/gptqwhile no AWQ / GPTQ package is importable (Studio ships none).engineslists only the engines this host can run, vLLM first. SGLang is listed for compressed-tensors only on SM 10.0+ GPUs: its NVFP4 scheme needs Blackwell (get_min_capability100 in 0.5.20), while vLLM's falls back to Marlin from SM 7.5.config.jsoncomes from the Hub cache that resolving the model already filled (0.08 ms per pick instead of a 45 ms Hub round trip), in a worker thread inside the existing offline guard. The GPU check only runs for these checkpoints, and any failure returns no offer, so validation never fails because of it.Frontend
ManagedEngineOfferDialog(root mounted, like the transformers upgrade dialog) and a small store: one open offer at a time, a newer load declines the older one, and cancelling the load closes the dialog.selectModelwaits on the dialog right after validation, validates again as the chosen engine, then sends the same/loadwith it (precision and parallelism reset to model default, no 4-bit conversion). The loaded engine then shows in the run settings as usual.EngineInstallis exported and reused unchanged, so install progress, cancel, errors and the Windows restart state behave exactly as in Settings and run settings. An install started from the dialog stays mounted until it hands the load over.Not changed: the compare pane, the startup auto-load and API callers still get the #13043 refusal and hint; no per-model setting is written (a second load of the same model is one click because the engine is reused).
Testing
unsloth/Qwen3.8-27B-NVFP4and answer correctly.unsloth/Qwen3.8-27B-NVFP4on Default, at this branch:vllm, and chat answers "391" to "What is 17 * 23?".1c946d1) the same pick runs a Default load that fails with the compressed-tensors refusal./api/inference/validateon this branch: NVFP4 andQwen/Qwen2.5-7B-Instruct-AWQget{engines: [vllm, sglang]}, plainunsloth/Qwen3.8-27Bgets none; on main none of them has the field. A cold GPU probe is resolved inside validate rather than reported as unsupported.studio/backend/tests/test_managed_engine_offer.py(30 cases),test_compressed_tensors_load_error_message.pystill passes.studio/frontend/tests/managed-engine-offer.test.ts: choose, decline, supersede, abort, ordering before the preliminary unload, Keep loaded models, install hand-over. Fullnpm test(11,127),tsc -bandvite buildpass; eslint reports no new problems.Picking the NVFP4 checkpoint in chat, before and after:
Install and load from the dialog, then chat on vLLM:
With vLLM already installed it is one click; Cancel leaves everything as it was: