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: model picker hides empty uploads and fades models this device cannot run (#14935)
Michael Han9f59a73ff908
diff --git a/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts b/studio/frontend/src/features/hub/hooks/use-hub-model-search.tsindex 65bfc7eaa10..e59c6c9b1c9 100644--- a/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts+++ b/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts@@ -21,6 +21,7 @@ import { EMBEDDING_TAGS, estimateSizeFromDtypes } from "../lib/hf-model-meta";import { mergeTaskIterators } from "../lib/merge-task-iterators";import { detectBaseModel } from "../lib/model-capabilities";import { isGgufLike } from "../lib/model-identifiers";+import { ggufRepoParams } from "@/lib/model-size";import { type FreshRankable, rankFresh } from "../lib/fresh-ranking";import { type ProviderLogo, resolveOwnerProviderLogo } from "../lib/provider-logos";import {@@ -190,6 +191,7 @@ function makeMapModel(keepUnsupportedTags: boolean,idSuffix: string,deviceType: string | null,+ hideEmptyUploads = false,) {const suffixLower = idSuffix.toLowerCase();return (raw: unknown): HfModelResult | null => {@@ -228,6 +230,15 @@ function makeMapModel(if (excludeGguf && isGguf) {return null;}+ // The Hub derives gguf metadata and the "gguf" tag from uploaded files: neither means none yet.+ if (+ hideEmptyUploads &&+ isGgufLike(m.name) &&+ !m.gguf &&+ !m.tags?.some((tag) => tag.toLowerCase() === "gguf")+ ) {+ return null;+ }const pipelineTag = m.task ?? m.pipeline_tag;const quantMethod = m.config?.quantization_config?.quant_method;// Drop runtime-unloadable models before they reach the row list. Discover opts out via@@ -261,7 +272,9 @@ function makeMapModel(likes: m.likes ?? 0,private: m.private,gated: m.gated,- totalParams: m.safetensors?.total ?? m.gguf?.total,+ totalParams:+ m.safetensors?.total ??+ (m.gguf ? ggufRepoParams(m.name, m.gguf.total) : undefined),estimatedSizeBytes: estimateSizeFromDtypes(m.safetensors?.parameters),isGguf,baseModel: detectBaseModel(m.tags),@@ -859,6 +872,8 @@ export function useHubModelSearch(ownerScope?: "unsloth" | "all";enabled?: boolean;keepUnsupportedTags?: boolean;+ /** Drop "-GGUF" repos with no GGUF files uploaded yet. The Hub page keeps them listed. */+ hideEmptyUploads?: boolean;channel?: HfModelSearchChannel | null;filters?: ModelSearchFilters;},@@ -874,6 +889,7 @@ export function useHubModelSearch(ownerScope = "all",enabled = true,keepUnsupportedTags = false,+ hideEmptyUploads = false,channel = null,filters,} = options ?? {};@@ -1172,12 +1188,14 @@ export function useHubModelSearch(keepUnsupportedTags,channelIdSuffix,deviceType,+ hideEmptyUploads,),[excludeGguf,keepUnsupportedTags,channelIdSuffix,deviceType,+ hideEmptyUploads,],);const search = useHubPaginatedSearch(createIter, mapModel, { enabled });diff --git a/studio/frontend/src/features/hub/lib/model-search-filters.ts b/studio/frontend/src/features/hub/lib/model-search-filters.tsindex ed1f89e0b53..adab7ae11dc 100644--- a/studio/frontend/src/features/hub/lib/model-search-filters.ts+++ b/studio/frontend/src/features/hub/lib/model-search-filters.ts@@ -1,6 +1,8 @@// 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 { ggufRepoParams } from "../../../lib/model-size.ts";+/** Who uploaded a model: the unsloth org, any other organization, or a personal account. */export type HubUploader = "unsloth" | "organization" | "personal";@@ -115,7 +117,10 @@ export async function* filterModelListing(const model = raw as ListingModel;if (!matchesRange(- model.safetensors?.total ?? model.gguf?.total,+ model.safetensors?.total ??+ (model.gguf+ ? ggufRepoParams(model.name, model.gguf.total)+ : undefined),filters.minParams,filters.maxParams,)diff --git a/studio/frontend/src/features/hub/lib/view-models.ts b/studio/frontend/src/features/hub/lib/view-models.tsindex 00ed84cfbe2..ec7a4dfd554 100644--- a/studio/frontend/src/features/hub/lib/view-models.ts+++ b/studio/frontend/src/features/hub/lib/view-models.ts@@ -14,6 +14,7 @@ import type {ModelFormatFilter,} from "../types";import { estimateSizeFromDtypes, isGgufLike } from "./hf-model-meta";+import { ggufRepoParams } from "@/lib/model-size";import {type CapabilityKey,detectBaseModel,@@ -187,7 +188,10 @@ export function toHfModelResult(raw: unknown): HfModelResult | null {private: model.private,gated: model.gated,totalParams:- finiteNumber(model.safetensors?.total) ?? finiteNumber(model.gguf?.total),+ finiteNumber(model.safetensors?.total) ??+ (model.gguf+ ? ggufRepoParams(model.name, finiteNumber(model.gguf.total))+ : undefined),estimatedSizeBytes: estimateSizeFromDtypes(model.safetensors?.parameters),isGguf,baseModel: detectBaseModel(model.tags),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 b4383211792..5390828574c 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@@ -113,6 +113,7 @@ import {type ModelMemorySource,useModelMemory,} from "@/hooks/use-model-memory";+import type { GpuInfo } from "@/hooks/use-gpu-info";import { useVramBudgetFraction } from "@/hooks/use-vram-budget-fraction";import { copyToClipboard } from "@/lib/copy-to-clipboard";import { diffusionRouteSearch } from "@/lib/diffusion-route-search";@@ -870,6 +871,19 @@ function isOverBudget(status?: GgufFitClass | VramFitStatus | null): boolean {);}+/** A checkpoint (non-GGUF) row's verdict. A CPU backend chats with GGUF only, so a checkpoint+ * cannot run there at any size; elsewhere no GPU means nothing to judge it against. */+function checkpointFit(+ estGb: number,+ gpu: Pick<GpuInfo, "available" | "backend" | "budgetKnown" | "memoryTotalGb">,+ chat: boolean,+): VramFitStatus | null {+ if (chat && gpu.budgetKnown && gpu.backend === "cpu") return "exceeds";+ return estGb > 0 && gpu.available+ ? checkVramFit(estGb, gpu.memoryTotalGb)+ : null;+}+/** VRAM verdict: an info mark that names itself on hover, rather than a shouted pill. */function VramBadge({status,@@ -1274,6 +1288,8 @@ function ModelRow({className?: string;}) {const exceeds = isOverBudget(vramStatus);+ // With no GPU every load runs from RAM: `ram` keeps its warning but is not an overage to dim.+ const dimmed = exceeds && !(vramStatus === "ram" && !(gpuGb && gpuGb > 0));const showVramTooltip =vramEst != null && vramEst > 0 && gpuGb != null && gpuGb > 0;const vramTooltipText =@@ -1434,9 +1450,9 @@ function ModelRow({"flex w-full items-center",alignMeta === "device" ? DEVICE_META_GAP : "gap-1",// Over budget reads as a dimmed row, which scans; hover restores it. The selected row keeps full weight.- exceeds &&+ dimmed &&!selected &&- "opacity-60 transition-opacity group-hover/row:opacity-100 group-focus-visible/row:opacity-100",+ "opacity-55 transition-opacity group-hover/row:opacity-100 group-focus-visible/row:opacity-100 dark:opacity-50",)}><span className="flex min-w-0 flex-1 items-baseline">@@ -3289,6 +3305,7 @@ export function HubModelPicker({sortDirection: "desc",pinUnslothFirst: true,keepUnsupportedTags: true,+ hideEmptyUploads: true,accessToken,// Only Recommended renders Hub results, so keep the Hub hooks idle on other tabs and preserve// offline-local behavior. Search rows render only with a query (showHfSection); browse reads@@ -3303,6 +3320,7 @@ export function HubModelPicker({sortDirection: "desc",pinUnslothFirst: true,keepUnsupportedTags: true,+ hideEmptyUploads: true,accessToken,enabled: online && section === "recommended",});@@ -3324,6 +3342,7 @@ export function HubModelPicker({sortBy: recommendedSort,sortDirection: "desc",pinUnslothFirst: false,+ hideEmptyUploads: true,accessToken,enabled: communityDiscoveryEnabled && debouncedQuery.trim().length > 0,});@@ -3333,6 +3352,7 @@ export function HubModelPicker({sortBy: recommendedSort,sortDirection: "desc",pinUnslothFirst: false,+ hideEmptyUploads: true,accessToken,enabled: communityRecommendedEnabled && debouncedQuery.trim().length === 0,});@@ -4368,9 +4388,7 @@ export function HubModelPicker({const est = r.totalParams? estimateLoadingVram(r.totalParams, "qlora"): 0;- const status =- est > 0 && gpu.available ? checkVramFit(est, gpu.memoryTotalGb) : null;- map.set(r.id, { meta, status, est });+ map.set(r.id, { meta, status: checkpointFit(est, gpu, !task), est });}return map;}, [@@ -5998,16 +6016,13 @@ export function HubModelPicker({const detail = r.totalParams ? formatCompact(r.totalParams) : null;if (r.totalParams) {const est = estimateLoadingVram(r.totalParams, "qlora");- const status = gpu.available- ? checkVramFit(est, gpu.memoryTotalGb)- : null;- map.set(r.id, { est, status, detail });+ map.set(r.id, { est, status: checkpointFit(est, gpu, !task), detail });} else {map.set(r.id, { est: 0, status: null, detail });}}return map;- }, [results, gpu]);+ }, [results, gpu, task]);const recommendedVramMap = useMemo(() => {const map = new Map<@@ -6041,11 +6056,8 @@ export function HubModelPicker({}if (totalParams) {const est = estimateLoadingVram(totalParams, "qlora");- const status = gpu.available- ? checkVramFit(est, gpu.memoryTotalGb)- : null;const detail = formatCompact(totalParams);- map.set(id, { est, status, detail });+ map.set(id, { est, status: checkpointFit(est, gpu, !task), detail });}}return map;diff --git a/studio/frontend/src/lib/model-size.ts b/studio/frontend/src/lib/model-size.tsindex 5e0e5826398..a335674aef0 100644--- a/studio/frontend/src/lib/model-size.ts+++ b/studio/frontend/src/lib/model-size.ts@@ -21,3 +21,15 @@ export function parseParamCountB(id: string): number | null {const v = Number.parseFloat(m[1]);return Number.isFinite(v) ? v : null;}++/** A GGUF repo's parameter count. The Hub reads `gguf.total` from one file of its choosing, which+ * can be a drafter or vision projector (1.6B on a 120B repo), so a larger name token wins. */+export function ggufRepoParams(+ id: string,+ ggufTotal: number | undefined,+): number | undefined {+ const fromName = (parseParamCountB(id) ?? 0) * 1e9;+ const total = ggufTotal ?? 0;+ const largest = Math.max(fromName, total);+ return largest > 0 ? largest : undefined;+}diff --git a/studio/frontend/tests/hub-search-empty-uploads.test.ts b/studio/frontend/tests/hub-search-empty-uploads.test.tsnew file mode 100644index 00000000000..4d0f39abae1--- /dev/null+++ b/studio/frontend/tests/hub-search-empty-uploads.test.ts@@ -0,0 +1,82 @@+// 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 { readFileSync } from "node:fs";+import test from "node:test";+import ts from "@typescript/typescript6";+import { classifyUnslothSupport } from "../src/features/hub/lib/unsloth-support.ts";+import { ggufRepoParams } from "../src/lib/model-size.ts";++const source = readFileSync(+ new URL("../src/features/hub/hooks/use-hub-model-search.ts", import.meta.url),+ "utf8",+);+const start = source.indexOf("function makeMapModel(");+assert.notEqual(start, -1);+const end = source.indexOf("\n}\n", start) + 2;+const makeMapModel = new Function(+ "classifyUnslothSupport", "EMBEDDING_TAGS", "isGgufLike", "estimateSizeFromDtypes", "detectBaseModel", "ggufRepoParams",+ ts.transpileModule(source.slice(start, end), { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText ++ "; return makeMapModel;",+)(+ classifyUnslothSupport,+ new Set<string>(),+ (id: string) => /-gguf$/i.test(id),+ () => undefined,+ () => null,+ ggufRepoParams,+);++// unsloth/MiniMax-M3.1-Flash-GGUF as the listing reported it while only README.md was uploaded.+const PLACEHOLDER = {+ name: "unsloth/MiniMax-M3.1-Flash-GGUF",+ pipeline_tag: "image-text-to-text",+ tags: ["unsloth", "image-text-to-text", "base_model:MiniMaxAI/MiniMax-M3.1-Flash", "region:us"],+};+const UPLOADED = [+ { name: "unsloth/flint-GGUF", gguf: { total: 39785287456 }, tags: ["gguf", "unsloth"] },+ // A mirror that drops expand=gguf still reports the tag.+ { name: "unsloth/Qwen3-8B-GGUF", tags: ["gguf"] },+ // A non-GGUF repo is never judged by this rule.+ { name: "unsloth/FLUX.1-dev-FP8", tags: ["diffusers"] },+ { name: "unsloth/MiniMax-M3.1-Flash", safetensors: { total: 220490854016 }, tags: [] },+];++test("the picker drops a GGUF repo with nothing uploaded yet", () => {+ const map = makeMapModel(false, true, "", "cuda", true);+ assert.equal(map(PLACEHOLDER), null);+ for (const raw of UPLOADED) assert.equal(map(raw)?.id, raw.name);+});++test("listings that do not opt in keep the placeholder", () => {+ assert.equal(makeMapModel(false, true, "", "cuda")(PLACEHOLDER)?.id, PLACEHOLDER.name);+});++test("every Hub listing in the model picker opts in", () => {+ const picker = readFileSync(+ new URL("../src/features/model-picker/components/model-selector/pickers.tsx", import.meta.url),+ "utf8",+ );+ const calls = picker.split("useHubModelSearch(").slice(1);+ assert.ok(calls.length >= 4);+ for (const call of calls) {+ const options = call.slice(0, call.indexOf("});"));+ assert.match(options, /hideEmptyUploads: true/);+ }+});++test("a GGUF repo's size is its largest reading, not the drafter the Hub sampled", () => {+ const map = makeMapModel(false, true, "", "cuda", true);+ // The Hub's gguf.total here comes from a 1.6B DFlash drafter shipped beside the 120B quants.+ const nemotron = map({+ name: "unsloth/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-GGUF",+ gguf: { total: 1632922404, architecture: "dflash" },+ tags: ["gguf"],+ });+ assert.equal(nemotron?.totalParams, 120e9);+ // Metadata stays when it is the larger, more exact figure, or the name has no size.+ assert.equal(map({ name: "unsloth/Qwen3-30B-A3B-GGUF", gguf: { total: 30.5e9 }, tags: ["gguf"] })?.totalParams, 30.5e9);+ assert.equal(map({ name: "unsloth/flint-GGUF", gguf: { total: 39785287456 }, tags: ["gguf"] })?.totalParams, 39785287456);+ // Safetensors totals already count every weight and keep precedence.+ assert.equal(map({ name: "unsloth/MiniMax-M3.1-Flash", safetensors: { total: 220490854016 }, tags: [] })?.totalParams, 220490854016);+});diff --git a/studio/frontend/tests/hub-search-mixed-formats.test.ts b/studio/frontend/tests/hub-search-mixed-formats.test.tsindex c3ce545c8b9..fe978359c61 100644--- a/studio/frontend/tests/hub-search-mixed-formats.test.ts+++ b/studio/frontend/tests/hub-search-mixed-formats.test.ts@@ -5,6 +5,7 @@ import { readFileSync } from "node:fs";import test from "node:test";import ts from "@typescript/typescript6";import { classifyUnslothSupport } from "../src/features/hub/lib/unsloth-support.ts";+import { ggufRepoParams } from "../src/lib/model-size.ts";// Execute the production mapper without loading React, the Hub client or the network hooks.const source = readFileSync(@@ -15,7 +16,7 @@ const start = source.indexOf("function makeMapModel(");assert.notEqual(start, -1);const end = source.indexOf("\n}\n", start) + 2;const makeMapModel = new Function(- "classifyUnslothSupport", "EMBEDDING_TAGS", "isGgufLike", "estimateSizeFromDtypes", "detectBaseModel",+ "classifyUnslothSupport", "EMBEDDING_TAGS", "isGgufLike", "estimateSizeFromDtypes", "detectBaseModel", "ggufRepoParams",ts.transpileModule(source.slice(start, end), { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText +"; return makeMapModel;",)(@@ -24,6 +25,7 @@ const makeMapModel = new Function((id: string) => id.endsWith("-GGUF"),() => undefined,() => null,+ ggufRepoParams,);const GPT2 = ["pytorch", "tf", "jax", "tflite", "onnx", "safetensors"];diff --git a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts b/studio/frontend/tests/on-device-dot-and-header-alignment.test.tsindex 2bed0dcac9b..c23d3085ef9 100644--- a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts+++ b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts@@ -167,7 +167,7 @@ test("an over budget row dims instead of putting a pill on every line", () => {);assert.ok(PICKERS.includes(- '"opacity-60 transition-opacity group-hover/row:opacity-100 group-focus-visible/row:opacity-100"',+ '"opacity-55 transition-opacity group-hover/row:opacity-100 group-focus-visible/row:opacity-100 dark:opacity-50"',),);assert.ok(PICKERS.includes('vram: "min-w-min min-[560px]:w-[18px]"'));@@ -191,7 +191,7 @@ test("one fit badge, so a colour or reveal change cannot miss a list", () => {2,"both model row slots reveal on hover",);- assert.match(PICKERS, /exceeds &&\n\s*!selected &&/);+ assert.match(PICKERS, /dimmed &&\n\s*!selected &&/);});test("chat and the Hub answer the fit question with one formula", () => {diff --git a/studio/frontend/tests/picker-cpu-fit.test.ts b/studio/frontend/tests/picker-cpu-fit.test.tsnew file mode 100644index 00000000000..e2a3aa08f32--- /dev/null+++ b/studio/frontend/tests/picker-cpu-fit.test.ts@@ -0,0 +1,48 @@+// 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 { readFileSync } from "node:fs";+import test from "node:test";+import ts from "@typescript/typescript6";+import { checkVramFit } from "../src/lib/vram.ts";++const PICKERS = readFileSync(+ new URL("../src/features/model-picker/components/model-selector/pickers.tsx", import.meta.url),+ "utf8",+);+const start = PICKERS.indexOf("function checkpointFit(");+assert.notEqual(start, -1);+const end = PICKERS.indexOf("\n}\n", start) + 2;+const checkpointFit = new Function(+ "checkVramFit",+ ts.transpileModule(PICKERS.slice(start, end), { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText ++ "; return checkpointFit;",+)(checkVramFit);++// What /api/system reports on a GGUF-only Mac (no torch, so no MLX device).+const CPU = { available: false, backend: "cpu", budgetKnown: true, memoryTotalGb: 0 };++test("a checkpoint cannot run on a CPU backend, so its row dims", () => {+ assert.equal(checkpointFit(130, CPU, true), "exceeds");+ assert.equal(checkpointFit(0, CPU, true), "exceeds");+});++test("a checkpoint keeps its old verdicts everywhere else", () => {+ // Still loading the inventory: no verdict yet.+ assert.equal(checkpointFit(130, { ...CPU, budgetKnown: false }, true), null);+ // Task pickers keep their own rules.+ assert.equal(checkpointFit(130, CPU, false), null);+ const cuda = { available: true, backend: "cuda", budgetKnown: true, memoryTotalGb: 80 };+ assert.equal(checkpointFit(130, cuda, true), "exceeds");+ assert.equal(checkpointFit(20, cuda, true), "fits");+ assert.equal(checkpointFit(130, { ...cuda, available: false, backend: "mlx" }, true), null);+});++test("with no GPU a GGUF that fits in RAM keeps its warning but is not dimmed", () => {+ // The verdict still reaches the row, so the RAM fallback mark shows.+ assert.doesNotMatch(PICKERS, /fit === "ram" && budget\.memoryTotalGb <= 0/);+ assert.match(+ PICKERS,+ /const dimmed = exceeds && !\(vramStatus === "ram" && !\(gpuGb && gpuGb > 0\)\);/,+ );+});