Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: keep auto-load and compare panes off the default engine for compressed-tensors, AWQ and GPTQ checkpoints (#13229)
Daniel Han86c5ac21440e
diff --git a/studio/frontend/src/features/chat/api/chat-adapter.ts b/studio/frontend/src/features/chat/api/chat-adapter.tsindex afc8097d31f..d7790414804 100644--- a/studio/frontend/src/features/chat/api/chat-adapter.ts+++ b/studio/frontend/src/features/chat/api/chat-adapter.ts@@ -3520,6 +3520,12 @@ async function autoLoadSmallestModel(options?: AutoLoadOptions): Promise<{validateFailures += 1;return false;}+ // Engine choice is the picker dialog's; the default engine would decompress and crawl (#8861).+ if (validation.managed_engine_offer) {+ hadNonTrustFailure = true;+ validateFailures += 1;+ return false;+ }return true;}diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsxindex f1121a1524c..c68dd1eb15c 100644--- a/studio/frontend/src/features/chat/shared-composer.tsx+++ b/studio/frontend/src/features/chat/shared-composer.tsx@@ -149,6 +149,7 @@ import { confirmRemoteCodeIfNeeded } from "@/features/security";import {DEFAULT_MAX_SEQ_LENGTH,DEFAULT_PER_MODEL_CONFIG,+ confirmManagedEngineIfNeeded,isServedByMlx,savedContextPin,resolveResidentInitialConfig,@@ -1745,7 +1746,7 @@ export function SharedComposer({// with no explicit context loads at native (0 -> n_ctx_train), not the session maxSeqLength.const effectiveCustomContextLength = ownConfig.customContextLength;const paneEngine = targetIsGguf ? "auto" : (ownConfig.engine ?? "auto");- const paneEngineFields = {+ let paneEngineFields = {engine: paneEngine,engine_precision: ownConfig.enginePrecision ?? "auto",engine_parallelism: ownConfig.engineParallelism ?? "tensor",@@ -1774,7 +1775,8 @@ export function SharedComposer({effectiveCustomContextLength,effectiveMaxSeqLength,);- const validation = await validateModel({+ // Re-run as the engine the offer dialog picks, so its settings are checked before /load.+ const panePayload = () => ({model_path: sel.id,hf_token: currentStore.hfToken || null,max_seq_length: compareMaxSeqLength,@@ -1819,8 +1821,48 @@ export function SharedComposer({...serverTuningLoadPayload(ownConfig),}: {}),- }, { signal: compareSignal });+ });+ const validation = await validateModel(panePayload(), {+ signal: compareSignal,+ });throwIfCompareCancelled(compareSignal);+ // Same offer as the primary picker: the default engine cannot run it (#8861).+ const engineOffer =+ paneEngine === "auto" ? validation.managed_engine_offer : null;+ if (engineOffer) {+ const engine = await confirmManagedEngineIfNeeded(+ sel.id,+ engineOffer,+ compareSignal,+ );+ throwIfCompareCancelled(compareSignal);+ if (!engine) {+ throw new Error(+ `${compareModelDisplayName(sel.id)} 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.`,+ );+ }+ paneEngineFields = {+ engine,+ engine_precision: "auto",+ engine_parallelism: "tensor",+ load_in_4bit: false,+ ...(ownConfig.selectedGpuIds !== undefined+ ? {+ gpu_ids:+ reconcilePersistedGpuIds(+ ownConfig.selectedGpuIds,+ ownConfig.selectedGpuIndexKind,+ false,+ ) ?? undefined,+ }+ : {}),+ };+ Object.assign(+ validation,+ await validateModel(panePayload(), { signal: compareSignal }),+ );+ throwIfCompareCancelled(compareSignal);+ }// Upgrade dialog first (mirrors the primary load path).if (validation.requires_transformers_upgrade) {const upgraded = await confirmTransformersUpgradeIfNeeded({diff --git a/studio/frontend/tests/auto-load-validate-budget.test.ts b/studio/frontend/tests/auto-load-validate-budget.test.tsindex 419b06737b5..ceba3da9458 100644--- a/studio/frontend/tests/auto-load-validate-budget.test.ts+++ b/studio/frontend/tests/auto-load-validate-budget.test.ts@@ -425,10 +425,10 @@ test("every dead-ended /validate is counted, and no passing one is", () => {"failure, so a dead backend would otherwise POST once per cached repo",);- // Exactly the dead ends: two refusals and one rejection, nothing on the passing path.+ // Exactly the dead ends: three refusals and one rejection, nothing on the passing path.assert.equal(body.split(increment).length - 1,- 3,+ 4,"a new branch out of canAutoLoad must decide, explicitly, whether it spends the budget",);});diff --git a/studio/frontend/tests/managed-engine-offer-background-loads.test.ts b/studio/frontend/tests/managed-engine-offer-background-loads.test.tsnew file mode 100644index 00000000000..2456043cbcb--- /dev/null+++ b/studio/frontend/tests/managed-engine-offer-background-loads.test.ts@@ -0,0 +1,166 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// Auto-load skips, and compare panes offer, what managed_engine_offer flags, like the picker (#13135, #8861).++import assert from "node:assert/strict";+import test from "node:test";+import { readSrc } from "./helpers/kit.ts";++const OFFER = {+ quantization: "compressed-tensors",+ engines: ["vllm", "sglang"],+};++const adapter = readSrc("features/chat/api/chat-adapter.ts");+const guardStart = adapter.indexOf("async function canAutoLoad(");+const decisionStart = adapter.indexOf(+ "if (\n validation.requires_trust_remote_code",+ guardStart,+);+const decisionEnd = adapter.indexOf("return true;\n }", decisionStart);+assert.ok(+ guardStart >= 0 && decisionStart > guardStart && decisionEnd > decisionStart,+);+const autoLoadDecision = new Function(+ "validation",+ "state",+ `let { blockedByTrustRemoteCode, hadNonTrustFailure, validateFailures } = state;+ const out = (ok) => ({ ok, blockedByTrustRemoteCode, hadNonTrustFailure, validateFailures });+ ${adapter.slice(decisionStart, decisionEnd).replaceAll("return false;", "return out(false);")}+ return out(true);`,+) as (+ validation: Record<string, unknown>,+ state: Record<string, unknown>,+) => { ok: boolean; hadNonTrustFailure: boolean; validateFailures: number };+const fresh = () => ({+ blockedByTrustRemoteCode: false,+ hadNonTrustFailure: false,+ validateFailures: 0,+});++test("auto-load skips a checkpoint the default engine cannot run", () => {+ const result = autoLoadDecision({ managed_engine_offer: OFFER }, fresh());+ assert.equal(result.ok, false);+ assert.equal(+ result.validateFailures,+ 1,+ "a skipped candidate spends the validate budget",+ );+ assert.equal(result.hadNonTrustFailure, true);+});++test("auto-load still loads an ordinary checkpoint", () => {+ for (const offer of [undefined, null]) {+ assert.equal(+ autoLoadDecision({ managed_engine_offer: offer }, fresh()).ok,+ true,+ );+ }+});++const composer = readSrc("features/chat/shared-composer.tsx");+const paneStart = composer.indexOf("const engineOffer =");+const paneEnd = composer.indexOf("// Upgrade dialog first", paneStart);+assert.ok(paneStart >= 0 && paneEnd > paneStart);+const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;+const paneDecisionBody = new AsyncFunction(+ "paneEngine",+ "validation",+ "deps",+ `const { sel, compareModelDisplayName, confirmManagedEngineIfNeeded, validateModel, panePayload,+ throwIfCompareCancelled, compareSignal, ownConfig, reconcilePersistedGpuIds } = deps;+ let paneEngineFields = { engine: paneEngine };+ ${composer.slice(paneStart, paneEnd)}+ return paneEngineFields;`,+);+const sel = { id: "unsloth/Qwen3.8-27B-NVFP4" };++/** Runs the pane's offer step; `choice` is what the dialog answers. */+async function paneDecision(+ paneEngine: string,+ validation: Record<string, unknown>,+ choice: string | null = null,+ ownConfig: Record<string, unknown> = {},+) {+ const asked: unknown[] = [];+ let revalidated = 0;+ const fields = await paneDecisionBody(paneEngine, validation, {+ sel,+ compareModelDisplayName: (id: string) => id.split("/").pop() ?? id,+ confirmManagedEngineIfNeeded: async (model: string, offer: unknown) => {+ asked.push([model, offer]);+ return choice;+ },+ panePayload: () => ({}),+ validateModel: async () => {+ revalidated += 1;+ return { managed_engine_offer: null, revalidated: true };+ },+ throwIfCompareCancelled: () => {},+ compareSignal: undefined,+ ownConfig,+ reconcilePersistedGpuIds: (ids: number[] | null) => ids,+ });+ return { fields, asked, revalidated, validation };+}++test("a default-engine compare pane offers vLLM and loads with the pick", async () => {+ const run = await paneDecision(+ "auto",+ { managed_engine_offer: OFFER },+ "vllm",+ );+ assert.deepEqual(run.asked, [[sel.id, OFFER]]);+ assert.deepEqual(run.fields, {+ engine: "vllm",+ engine_precision: "auto",+ engine_parallelism: "tensor",+ load_in_4bit: false,+ });+ assert.equal(+ run.revalidated,+ 1,+ "re-validated as the chosen engine before /load",+ );+ assert.equal(run.validation.revalidated, true);+});++test("the pane's saved GPU pick survives the switch to the offered engine", async () => {+ const run = await paneDecision(+ "auto",+ { managed_engine_offer: OFFER },+ "vllm",+ { selectedGpuIds: [1, 2], selectedGpuIndexKind: "physical" },+ );+ assert.deepEqual(run.fields.gpu_ids, [1, 2]);+});++test("declining the offer refuses the load and names the engine", async () => {+ await assert.rejects(+ paneDecision("auto", { managed_engine_offer: OFFER }, null),+ /Qwen3\.8-27B-NVFP4 is quantized with compressed-tensors, which the default engine cannot run\. Set Inference engine to vLLM/,+ );+ await assert.rejects(+ paneDecision(+ "auto",+ { managed_engine_offer: { quantization: "awq", engines: ["sglang"] } },+ null,+ ),+ /Set Inference engine to SGLang/,+ );+});++test("a pane already on vLLM or SGLang, or an ordinary checkpoint, is not asked", async () => {+ for (const [engine, validation] of [+ ["vllm", { managed_engine_offer: OFFER }],+ ["sglang", { managed_engine_offer: OFFER }],+ ["auto", { managed_engine_offer: null }],+ ["auto", {}],+ ] as const) {+ const run = await paneDecision(engine, { ...validation });+ assert.deepEqual(run.asked, []);+ assert.equal(run.revalidated, 0);+ assert.deepEqual(run.fields, { engine });+ }+});