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: show Run settings gear on every GGUF quant row (#16660)
Michael Han707851b6a5ff
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsxindex 56a865e0092..6c2b10c7798 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx@@ -2800,7 +2800,8 @@ function GgufVariantExpander({// The prefix test misses marker-less relative dirs, so ask the listing.const checkpointIsLocal = isLocalPath || resolvedLocally;- const handleVariantClick = useCallback(+ // The gear hands the config page this same meta, so its Load downloads or loads as the row does.+ const variantSelectMeta = useCallback(// `filename` is required: the diffusion pages gate their GGUF branch on meta.ggufFilename.(quant: string,@@ -2809,9 +2810,9 @@ function GgufVariantExpander({sizeBytes?: number,downloadPresentation?: ModelSelectorChangeMeta["downloadPresentation"],contextLength: number | null = nativeContext,- ) => {+ ): ModelSelectorChangeMeta => {const isAvailable = isLocalPath || downloaded === true;- onSelect(repoId, {+ return {source: sourceOverride ?? (isLocalPath ? "local" : "hub"),isLora: false,// Only for a quant already in the pinned snapshot: a new download lands elsewhere.@@ -2825,13 +2826,11 @@ function GgufVariantExpander({isGguf: variantsAreGguf,isVision: variantVisionHint,pipelineTag,- });+ };},[- repoId,loadId,isLocalPath,- onSelect,sourceOverride,nativeContext,pipelineTag,@@ -2962,6 +2961,16 @@ function GgufVariantExpander({() => h3PickerHasOnlyPrunedBuilds(displayVariants ?? []),[displayVariants],);+ const variantHasMenu = (v: GgufVariantDetail): boolean =>+ (v.downloaded === true || v.partial === true) &&+ Boolean(+ allowPin ||+ (v.update_available && onUpdateVariant) ||+ onDeleteVariant ||+ !isLocalPath,+ );+ // Rows without a menu hold its slot, so every gear and size lines up with the downloaded rows.+ const reserveMenuSlot = (displayVariants ?? []).some(variantHasMenu);// A diffusion GGUF's companion set is per family, not repo-wide; group by dependency_key so totals are right.const footprintVariants = useMemo(() => {@@ -3154,21 +3163,20 @@ function GgufVariantExpander({const unusableLocal = isLocalPath && v.partial === true;const keyBase = `${repoId}:${v.filename}`;const variantOptionKey = makeModelOptionKey("gguf-variant", keyBase);+ const selectMeta = variantSelectMeta(+ v.quant,+ v.filename,+ v.downloaded,+ expectedBytes,+ pendingDrafterPresentation(v),+ variantContext,+ );const rowButton = (<buttontype="button"{...variantList.getOptionProps(variantOptionKey, false)}disabled={unusableLocal}- onClick={() =>- handleVariantClick(- v.quant,- v.filename,- v.downloaded,- expectedBytes,- pendingDrafterPresentation(v),- variantContext,- )- }+ onClick={() => onSelect(repoId, selectMeta)}className={cn("flex min-w-0 flex-1 items-center justify-between gap-2 rounded-full py-1 pl-2 pr-1.5 text-left text-sm transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",unusableLocal &&@@ -3243,7 +3251,7 @@ function GgufVariantExpander({)}</div>) : null,- <div key={v.filename} className="flex items-center">+ <div key={v.filename} className="group/quant flex items-center">{/* Nested button triggers are not accessible. */}{companionBytes === null ? (rowButton@@ -3258,108 +3266,101 @@ function GgufVariantExpander({</TooltipContent></Tooltip>)}- {v.downloaded && onConfigure && (+ {/* Every quant, downloaded or not: settings are set before the download starts. */}+ {!unusableLocal && onConfigure && (<ModelLoadSettingsActionariaLabel={`Inference settings for ${repoId} ${v.quant}`}- className="relative left-0.5"- onConfigure={() =>- onConfigure(repoId, {- source: sourceOverride ?? (isLocalPath ? "local" : "hub"),- isLora: false,- loadId,- ggufVariant: v.quant,- isDownloaded: true,- expectedBytes,- contextLength: variantContext,- isGguf: variantsAreGguf,- isVision: variantVisionHint,- })- }+ className={cn(+ "relative left-0.5",+ // Always shown once on device; otherwise only on row hover or focus.+ v.downloaded !== true &&+ "opacity-0 transition-opacity focus-visible:opacity-100 group-hover/quant:opacity-100 group-focus-within/quant:opacity-100 [@media(hover:none)]:opacity-100",+ )}+ onConfigure={() => onConfigure(repoId, selectMeta)}/>)}- {(v.downloaded || v.partial === true) &&- (allowPin ||- (v.update_available && onUpdateVariant) ||- onDeleteVariant ||- !isLocalPath) && (- <ModelRowMenu- ariaLabel={`More options for ${repoId} ${v.quant}`}- iconClassName="size-3"- cachePath={- isLocalPath ? undefined : { repoId, variant: v.quant }- }- pin={- allowPin && v.downloaded- ? {- pinned: pinnedKeys.includes(pinKey(repoId, v.quant)),- pinLabel: "Pin",- unpinLabel: "Unpin",- onToggle: () => togglePinnedQuant(repoId, v.quant),- }- : undefined- }- update={- v.update_available && onUpdateVariant- ? {- title: updateVariantTitle,- description: renderUpdateVariantDescription?.(- v.quant,- ) ?? (- <>- This will update{" "}- <span className="font-medium text-foreground">- {repoId} ({v.quant})- </span>- {"."}- </>- ),+ {!variantHasMenu(v) && reserveMenuSlot && (+ <span className="size-5 shrink-0" aria-hidden={true} />+ )}+ {variantHasMenu(v) && (+ <ModelRowMenu+ ariaLabel={`More options for ${repoId} ${v.quant}`}+ iconClassName="size-3"+ cachePath={+ isLocalPath ? undefined : { repoId, variant: v.quant }+ }+ pin={+ allowPin && v.downloaded+ ? {+ pinned: pinnedKeys.includes(pinKey(repoId, v.quant)),+ pinLabel: "Pin",+ unpinLabel: "Unpin",+ onToggle: () => togglePinnedQuant(repoId, v.quant),+ }+ : undefined+ }+ update={+ v.update_available && onUpdateVariant+ ? {+ title: updateVariantTitle,+ description: renderUpdateVariantDescription?.(+ v.quant,+ ) ?? (+ <>+ This will update{" "}+ <span className="font-medium text-foreground">+ {repoId} ({v.quant})+ </span>+ {"."}+ </>+ ),+ repoId,+ variant: v.quant,+ disabled: updateDisabled,+ onConfirm: () =>+ onUpdateVariant(v.quant, expectedBytes),+ onUpdated: () => setRefreshKey((key) => key + 1),+ }+ : undefined+ }+ del={+ onDeleteVariant+ ? {+ title: deleteVariantTitle,+ impact: {repoId,variant: v.quant,- disabled: updateDisabled,- onConfirm: () =>- onUpdateVariant(v.quant, expectedBytes),- onUpdated: () => setRefreshKey((key) => key + 1),- }- : undefined- }- del={- onDeleteVariant- ? {- title: deleteVariantTitle,- impact: {- repoId,- variant: v.quant,- cachePath: v.cache_ref ?? v.cache_path,- },- description: renderDeleteVariantDescription?.(- v.quant,- ) ?? (- <>- This will remove{" "}- <span className="font-medium text-foreground">- {repoId} ({v.quant})- </span>{" "}- from disk. You can re-download it later.- </>- ),- successMessage:- getDeleteVariantSuccessMessage?.(v.quant) ??- `Deleted ${repoId} ${v.quant}`,- disabled: deleteDisabled,- onConfirm: async () => {- await onDeleteVariant(v.quant, v.cache_ref ?? v.cache_path);- if (isChatGgufTask(pipelineTag)) {- await reconcileGgufPinsAfterDelete(repoId, hfToken);- } else if (pinnedKeys.includes(pinKey(repoId, v.quant))) {- togglePinnedQuant(repoId, v.quant);- }- setRefreshKey((key) => key + 1);- },- }- : undefined- }- />- )}+ cachePath: v.cache_ref ?? v.cache_path,+ },+ description: renderDeleteVariantDescription?.(+ v.quant,+ ) ?? (+ <>+ This will remove{" "}+ <span className="font-medium text-foreground">+ {repoId} ({v.quant})+ </span>{" "}+ from disk. You can re-download it later.+ </>+ ),+ successMessage:+ getDeleteVariantSuccessMessage?.(v.quant) ??+ `Deleted ${repoId} ${v.quant}`,+ disabled: deleteDisabled,+ onConfirm: async () => {+ await onDeleteVariant(v.quant, v.cache_ref ?? v.cache_path);+ if (isChatGgufTask(pipelineTag)) {+ await reconcileGgufPinsAfterDelete(repoId, hfToken);+ } else if (pinnedKeys.includes(pinKey(repoId, v.quant))) {+ togglePinnedQuant(repoId, v.quant);+ }+ setRefreshKey((key) => key + 1);+ },+ }+ : undefined+ }+ />+ )}</div>,];})}diff --git a/studio/frontend/tests/model-picker-gguf-quant-settings.test.ts b/studio/frontend/tests/model-picker-gguf-quant-settings.test.tsnew file mode 100644index 00000000000..48ad5d5b7bb--- /dev/null+++ b/studio/frontend/tests/model-picker-gguf-quant-settings.test.ts@@ -0,0 +1,79 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import { readSrc } from "./helpers/kit.ts";++const picker = readSrc(+ "features/model-picker/components/model-selector/pickers.tsx",+);++function quantRowGear(): string {+ const start = picker.indexOf(+ "ariaLabel={`Inference settings for ${repoId} ${v.quant}`}",+ );+ assert.ok(start > 0, "the quant row has a settings gear");+ const open = picker.lastIndexOf(+ "{",+ picker.lastIndexOf("<ModelLoadSettingsAction", start),+ );+ return picker.slice(open, picker.indexOf("/>", start) + 2);+}++test("every GGUF quant row offers Run settings, downloaded or not", () => {+ const gear = quantRowGear();+ assert.match(gear, /^\{!unusableLocal && onConfigure && \(/);+ // Download state picks visibility only, never whether the gear renders.+ assert.doesNotMatch(gear.split("\n")[0], /downloaded/);+ // Every quant list renders through the expander, so no list keeps its own gate.+ assert.equal(+ picker.match(+ /ariaLabel=\{`Inference settings for \$\{repoId\} \$\{v\.quant\}`\}/g,+ )?.length,+ 1,+ );+});++test("the gear targets the row's own quant and pick, without downloading", () => {+ const gear = quantRowGear();+ // Same meta as the row click, so Load from the page downloads or loads as the row would.+ assert.match(+ gear,+ /onConfigure=\{\(\) => onConfigure\(repoId, selectMeta\)\}/,+ );+ assert.match(picker, /onClick=\{\(\) => onSelect\(repoId, selectMeta\)\}/);+ const meta = picker.slice(+ picker.indexOf("const variantSelectMeta = useCallback("),+ picker.indexOf("const budgetFraction"),+ );+ assert.match(meta, /ggufVariant: quant,/);+ assert.match(meta, /isDownloaded: isLocalPath \? true : downloaded,/);+ assert.match(meta, /loadId: downloaded === true \? loadId : undefined,/);+ // Building the meta must not itself start anything.+ assert.doesNotMatch(meta, /onSelect\(|download\(/);+});++test("the gear stays visible on device and reveals on hover or focus otherwise", () => {+ assert.ok(+ picker.includes(+ '<div key={v.filename} className="group/quant flex items-center">',+ ),+ );+ assert.match(+ quantRowGear(),+ /v\.downloaded !== true &&\s*"opacity-0 transition-opacity focus-visible:opacity-100 group-hover\/quant:opacity-100 group-focus-within\/quant:opacity-100 \[@media\(hover:none\)\]:opacity-100"/,+ );+});++test("a quant without a menu keeps its slot so gears line up", () => {+ assert.match(+ picker,+ /const reserveMenuSlot = \(displayVariants \?\? \[\]\)\.some\(variantHasMenu\);/,+ );+ assert.match(+ picker,+ /\{!variantHasMenu\(v\) && reserveMenuSlot && \(\s*<span className="size-5 shrink-0" aria-hidden=\{true\} \/>\s*\)\}\s*\{variantHasMenu\(v\) && \(\s*<ModelRowMenu/,+ );+});diff --git a/studio/frontend/tests/model-picker-partial-downloads.test.ts b/studio/frontend/tests/model-picker-partial-downloads.test.tsindex c7cf0d638e6..593e5dfdc0c 100644--- a/studio/frontend/tests/model-picker-partial-downloads.test.ts+++ b/studio/frontend/tests/model-picker-partial-downloads.test.ts@@ -572,7 +572,7 @@ test("a torn quant inside the expander keeps its own menu", () => {// A partial still occupies disk, so its quant row needs reveal and delete.assert.match(PICKERS,- /\{\(v\.downloaded \|\| v\.partial === true\) &&\n\s*\(allowPin \|\|/,+ /const variantHasMenu = \(v: GgufVariantDetail\): boolean =>\n\s*\(v\.downloaded === true \|\| v\.partial === true\) &&\n\s*Boolean\(\n\s*allowPin \|\|/,"the menu follows disk, not completeness",);// Pinning an unloadable quant would put a dead row at the top of the list.@@ -581,7 +581,8 @@ test("a torn quant inside the expander keeps its own menu", () => {/pin=\{\n\s*allowPin && v\.downloaded\n\s*\? \{/,"pin stays for complete quants only",);- assert.ok(PICKERS.includes("{v.downloaded && onConfigure && ("));+ // Settings follow loadability: only a local folder short a shard has nothing to configure.+ assert.ok(PICKERS.includes("{!unusableLocal && onConfigure && ("));});test("a torn quant is labelled, not left looking undownloaded", () => {