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: fix pinned rows in the model picker (#11943)
Michael Hanf97de4e3dd7b
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 8e848177af7..aee0851fef2 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@@ -1235,12 +1235,13 @@ function ModelRow({</span>) : null}<span className="min-w-0 flex-1 truncate">{name}</span>- {/* Here it eats name width instead of moving the meta columns. */}+ {/* Here it eats name width instead of moving the meta columns. self-center: on the+ baseline the empty dot sat the tag low. */}{aligned && loaded && (<DotTagtone="success"label="Loaded"- className="ml-2 h-[calc(18px*var(--ui-space-scale,1))] shrink-0 gap-1 rounded-md px-1.5"+ className="ml-2 h-[calc(18px*var(--ui-space-scale,1))] shrink-0 gap-1 self-center rounded-md px-1.5"dotClassName="size-[calc(5px*var(--ui-space-scale,1))]"/>)}@@ -4536,7 +4537,13 @@ export function HubModelPicker({validated: boolean;downloaded: ReadonlySet<string>;visionByRepo: ReadonlyMap<string, boolean>;- }>({ validated: false, downloaded: new Set(), visionByRepo: new Map() });+ sizes: ReadonlyMap<string, number>;+ }>({+ validated: false,+ downloaded: new Set(),+ visionByRepo: new Map(),+ sizes: new Map(),+ });const prunePinnedQuantValidation = useCallback((repoId: string, quant: string) => {const key = pinKey(repoId, quant);@@ -4566,17 +4573,24 @@ export function HubModelPicker({{ preferLocalCache: true },);const normalized = normalizeGgufVariantsResponse(response);+ const downloaded = normalized.variants.filter(+ (variant) => variant.downloaded === true,+ );return {repoId,hasVision: normalized.hasVision,- downloaded: normalized.variants- .filter((variant) => variant.downloaded === true)- .map((variant) => pinKey(repoId, variant.quant)),+ downloaded: downloaded.map((variant) =>+ pinKey(repoId, variant.quant),+ ),+ sizes: downloaded.map(+ (variant) =>+ [pinKey(repoId, variant.quant), variant.size_bytes] as const,+ ),};} catch {// If the backend cannot verify a quant, hiding the direct-load row is safer than claiming a// missing file is downloaded.- return { repoId, hasVision: undefined, downloaded: [] };+ return { repoId, hasVision: undefined, downloaded: [], sizes: [] };}}),).then((groups) => {@@ -4591,6 +4605,7 @@ export function HubModelPicker({: [[group.repoId, group.hasVision] as const],),),+ sizes: new Map(groups.flatMap((group) => group.sizes)),});}});@@ -4642,14 +4657,45 @@ export function HubModelPicker({return rows;}, [pinnedIds, pinnedQuants, pinnedCachedModelRows]);+ // A repo whose only quant is pinned moves its sole-quant row into Pinned instead of showing+ // twice. Multi-quant repos stay, since their row picks the other quants.+ const pinnedSoleQuantRows = useMemo(() => {+ const rows = new Map<+ string,+ { repo: (typeof sortedCachedGguf)[number]; sole: SoleDownloadedQuant }+ >();+ for (const entry of pinnedQuants) {+ const sole = soleQuants.quants.get(entry.repoId);+ const repo = sortedCachedGguf.find((c) => c.repo_id === entry.repoId);+ if (sole && repo && sole.variant.quant === entry.quant) {+ rows.set(pinKey(entry.repoId, entry.quant), { repo, sole });+ }+ }+ return rows;+ }, [pinnedQuants, soleQuants.quants, sortedCachedGguf]);+ const pinnedSoleQuantRepoIds = useMemo(+ () => new Set([...pinnedSoleQuantRows.values()].map(({ repo }) => repo.repo_id)),+ [pinnedSoleQuantRows],+ );+// Split downloaded models so non-Unsloth repos get their own "Other models" section above Fine-tuned.const unslothCachedGguf = useMemo(- () => visibleCachedGguf.filter((c) => isUnslothPublisherRepoId(c.repo_id)),- [visibleCachedGguf],+ () =>+ visibleCachedGguf.filter(+ (c) =>+ isUnslothPublisherRepoId(c.repo_id) &&+ !pinnedSoleQuantRepoIds.has(c.repo_id),+ ),+ [visibleCachedGguf, pinnedSoleQuantRepoIds],);const otherCachedGguf = useMemo(- () => visibleCachedGguf.filter((c) => !isUnslothPublisherRepoId(c.repo_id)),- [visibleCachedGguf],+ () =>+ visibleCachedGguf.filter(+ (c) =>+ !isUnslothPublisherRepoId(c.repo_id) &&+ !pinnedSoleQuantRepoIds.has(c.repo_id),+ ),+ [visibleCachedGguf, pinnedSoleQuantRepoIds],);const unslothCachedModelRows = useMemo(() =>@@ -5004,7 +5050,9 @@ export function HubModelPicker({keys.push(...pinnedRows.map((row) =>row.entry- ? makeModelOptionKey("pinned-quant", row.key)+ ? pinnedSoleQuantRows.has(row.key)+ ? makeModelOptionKey("downloaded-gguf", row.entry.repoId)+ : makeModelOptionKey("pinned-quant", row.key): makeModelOptionKey("downloaded-model", row.model.repo_id),),);@@ -5123,6 +5171,7 @@ export function HubModelPicker({collapsedConnectedGroups,pinnedRows,pinnedCollapsed,+ pinnedSoleQuantRows,downloadedCollapsed,fineTunedRows,fineTunedCollapsed,@@ -5638,6 +5687,9 @@ export function HubModelPicker({// A pinned quant: repo name with the quant as a grey chip, loaded in one click.const renderPinnedQuantRow = (entry: { repoId: string; quant: string }) => {+ // Its repo's own sole-quant row, with that row's load target and selection state.+ const soleRow = pinnedSoleQuantRows.get(pinKey(entry.repoId, entry.quant));+ if (soleRow) return renderSoleQuantGgufRow(soleRow.repo, soleRow.sole);const optionKey = makeModelOptionKey("pinned-quant",pinKey(entry.repoId, entry.quant),@@ -5654,6 +5706,13 @@ export function HubModelPicker({pinnedQuantValidation.visionByRepo.get(entry.repoId) === false? false: undefined;+ // Same size and vision mark as this quant's row below.+ const sizeBytes = pinnedQuantValidation.sizes.get(+ pinKey(entry.repoId, entry.quant),+ );+ const hasVision =+ pinnedQuantValidation.visionByRepo.get(entry.repoId) ??+ sortedCachedGguf.find((c) => c.repo_id === entry.repoId)?.has_vision;return (<divkey={optionKey}@@ -5666,8 +5725,11 @@ export function HubModelPicker({tooltipText={`${entry.repoId} (${ggufQuantDetailLabel(entry.quant,)})`}- meta="GGUF"+ meta={+ sizeBytes ? `GGUF · ${formatBytes(sizeBytes)}` : "GGUF"+ }quantChip={ggufQuantChipLabel(entry.quant)}+ showVision={hasVision}// Same runtime gate the sole-quant row applies: a pinned quant can belong to an image, video// or audio task, which load through the media planner, so the KV estimator would measure// the wrong runtime and fall back to the file size.diff --git a/studio/frontend/tests/model-picker-pinned-row-fixes.test.ts b/studio/frontend/tests/model-picker-pinned-row-fixes.test.tsnew file mode 100644index 00000000000..149f32abd46--- /dev/null+++ b/studio/frontend/tests/model-picker-pinned-row-fixes.test.ts@@ -0,0 +1,52 @@+// 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 pickers = readSrc(+ "features/model-picker/components/model-selector/pickers.tsx",+);++test("the Loaded tag beside a name is centred, not on the baseline", () => {+ assert.match(+ pickers,+ /label="Loaded"\s*className="ml-2 [^"]*\bself-center\b[^"]*"/,+ );+});++test("a repo whose only quant is pinned is not listed again below Pinned", () => {+ assert.match(pickers, /if \(sole && repo && sole\.variant\.quant === entry\.quant\) \{/);+ for (const list of ["unslothCachedGguf", "otherCachedGguf"]) {+ assert.match(+ pickers,+ new RegExp(+ `const ${list} = useMemo\\([\\s\\S]*?!pinnedSoleQuantRepoIds\\.has\\(c\\.repo_id\\)`,+ ),+ );+ }+});++test("a pinned quant row shows its size and vision mark", () => {+ assert.match(pickers, /sizes: new Map\(groups\.flatMap\(\(group\) => group\.sizes\)\)/);+ assert.match(+ pickers,+ /meta=\{\s*sizeBytes \? `GGUF · \$\{formatBytes\(sizeBytes\)\}` : "GGUF"\s*\}/,+ );+ assert.match(pickers, /quantChip=\{ggufQuantChipLabel\(entry\.quant\)\}\s*showVision=\{hasVision\}/);+});++test("that repo's pinned row is its own sole-quant row", () => {+ // Same load target, filename and selection state as the row it replaces.+ assert.match(+ pickers,+ /const renderPinnedQuantRow = [^\n]*\n(?:\s*\/\/[^\n]*\n)*\s*const soleRow = pinnedSoleQuantRows\.get\(pinKey\(entry\.repoId, entry\.quant\)\);\n\s*if \(soleRow\) return renderSoleQuantGgufRow\(soleRow\.repo, soleRow\.sole\);/,+ );+ // Keyed by repo, so the selected-option lookup (`::${value}`) still finds it.+ assert.match(+ pickers,+ /pinnedSoleQuantRows\.has\(row\.key\)\s*\?\s*makeModelOptionKey\("downloaded-gguf", row\.entry\.repoId\)/,+ );+});