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
Revert "feat: add GPU-aware model filtering and For You section- Add fit filt…" (#6722)
Daniel Han0ad814a45228
diff --git a/studio/frontend/src/components/assistant-ui/model-selector/recommended-fit.ts b/studio/frontend/src/components/assistant-ui/model-selector/recommended-fit.tsindex cc96665df4e..24f0edc7848 100644--- a/studio/frontend/src/components/assistant-ui/model-selector/recommended-fit.ts+++ b/studio/frontend/src/components/assistant-ui/model-selector/recommended-fit.ts@@ -64,38 +64,19 @@ export function matchesFormatFilter(}}-// Model-size extraction from repo id, matching the backend's 3-regex priority:-// active params (MoE "A3B") > effective params (Gemma "E4B") > total ("8B").-// Bounded by separators so we never read "16" from "bf16" or "2" from "Kimi-K2".-// Examples: "Qwen3.5-35B-A3B" -> 3, "gemma-4-E4B" -> 4, "Llama-3-8B" -> 8.-const ACTIVE_PARAM_RE = /(?:^|[-_/. ])a(\d+(?:\.\d+)?)\s*[bB](?=$|[-_/. ])/i;-const EFFECTIVE_PARAM_RE = /(?:^|[-_/. ])e(\d+(?:\.\d+)?)\s*[bB](?=$|[-_/. ])/i;-const TOTAL_PARAM_RE = /(?:^|[-_/. ])(\d+(?:\.\d+)?)\s*[bB](?=$|[-_/. ])/;--function paramsFromMatch(match: RegExpExecArray | null): number | undefined {- if (!match) return undefined;- const billions = parseFloat(match[1]);- return Number.isFinite(billions) && billions > 0- ? billions * 1e9- : undefined;-}--/** Active/effective parameter count parsed from a repo id, if it uses explicit- * MoE/Gemma-style notation such as A3B or E4B. */-export function activeOrEffectiveParamsFromId(id: string): number | undefined {- return (- paramsFromMatch(ACTIVE_PARAM_RE.exec(id)) ??- paramsFromMatch(EFFECTIVE_PARAM_RE.exec(id))- );-}+// First "<n>B" token in a repo id, e.g. "Qwen3-4B-GGUF" -> 4, "gpt-oss-20b" ->+// 20, "Qwen3-30B-A3B" -> 30 (MoE total), "gemma-4-E4B" -> 4 (effective-param+// "E" series). The digits must be bounded by a separator so we never read "16"+// from "bf16" or the "2" in "Kimi-K2".+const PARAM_RE = /(?:^|[-_/. ])[eE]?(\d+(?:\.\d+)?)\s*[bB](?=$|[-_./ ])/;/** Parameter count (absolute, e.g. 4e9) parsed from a repo id, or undefined- * when the id has no size token (so callers can treat the size as unknown).- * Prefers MoE active-param notation (A3B) over effective (E4B) over total. */+ * when the id has no size token (so callers can treat the size as unknown). */export function paramsFromId(id: string): number | undefined {- return (- activeOrEffectiveParamsFromId(id) ?? paramsFromMatch(TOTAL_PARAM_RE.exec(id))- );+ const match = PARAM_RE.exec(id);+ if (!match) return undefined;+ const billions = parseFloat(match[1]);+ return Number.isFinite(billions) && billions > 0 ? billions * 1e9 : undefined;}// Smallest practical GGUF/MLX quant (~Q2_K, low-bit). The fit check asks whetherdiff --git a/studio/frontend/src/features/hub/catalog/model-card.tsx b/studio/frontend/src/features/hub/catalog/model-card.tsxindex c3c526cac33..358a3409b56 100644--- a/studio/frontend/src/features/hub/catalog/model-card.tsx+++ b/studio/frontend/src/features/hub/catalog/model-card.tsx@@ -11,7 +11,7 @@ import { ownerPaletteColor } from "@/features/hub/lib/avatar-theme";import { buildAdaptiveCardAccentStyle } from "@/features/hub/lib/card-accent";import { useDominantColor } from "@/features/hub/lib/use-dominant-color";import { formatModelParamLabel } from "@/features/hub/lib/view-models";-import { cn, formatCompact } from "@/lib/utils";+import { formatCompact } from "@/lib/utils";import { Download01Icon, FavouriteIcon } from "@hugeicons/core-free-icons";import { type CSSProperties, memo, useMemo } from "react";import type { DiscoverRow } from "../types";@@ -339,25 +339,11 @@ export const ModelCard = memo(function ModelCard({value={formatCompact(row.result.likes)}/></div>- <div className="flex shrink-0 items-center gap-1.5">- {row.fitLevel && (- <span- className={cn(- "text-[9px] font-medium px-1.5 py-0.5 rounded leading-none uppercase shrink-0",- row.fitLevel === "comfortable" && "text-emerald-700 bg-emerald-50 dark:text-emerald-300 dark:bg-emerald-500/15",- row.fitLevel === "fits" && "text-amber-700 bg-amber-50 dark:text-amber-300 dark:bg-amber-500/15",- row.fitLevel === "oom" && "text-red-700 bg-red-50 dark:text-red-300 dark:bg-red-500/15"- )}- >- {row.fitLevel === "comfortable" ? "Comfortable" : row.fitLevel === "fits" ? "Fits GPU" : "OOM"}- </span>- )}- {hasSize ? (- <span className="hub-chip shrink-0">{sizeLabel}</span>- ) : topCapability ? (- <CapabilityPill capability={topCapability} iconOnly={true} />- ) : null}- </div>+ {hasSize ? (+ <span className="hub-chip shrink-0">{sizeLabel}</span>+ ) : topCapability ? (+ <CapabilityPill capability={topCapability} iconOnly={true} />+ ) : null}</div></button>);diff --git a/studio/frontend/src/features/hub/catalog/models-table.tsx b/studio/frontend/src/features/hub/catalog/models-table.tsxindex 35f2f966e55..a62806dcb62 100644--- a/studio/frontend/src/features/hub/catalog/models-table.tsx+++ b/studio/frontend/src/features/hub/catalog/models-table.tsx@@ -570,22 +570,6 @@ export const ResultCard = memo(function ResultCard({node: <span className="shrink-0">{sizeLabel}</span>,});}- if (row.fitLevel) {- const label = row.fitLevel === "comfortable" ? "Comfortable" : row.fitLevel === "fits" ? "Fits GPU" : "OOM";- const toneClass = row.fitLevel === "comfortable"- ? "text-emerald-700 bg-emerald-50 dark:text-emerald-300 dark:bg-emerald-500/15"- : row.fitLevel === "fits"- ? "text-amber-700 bg-amber-50 dark:text-amber-300 dark:bg-amber-500/15"- : "text-red-700 bg-red-50 dark:text-red-300 dark:bg-red-500/15";- textParts.push({- key: "gpuFit",- node: (- <span className={cn("shrink-0 uppercase text-[9px] font-medium px-1.5 py-0.5 rounded leading-none", toneClass)}>- {label}- </span>- ),- });- }if (row.result.updatedAt) {textParts.push({key: "updated",@@ -745,21 +729,6 @@ export const ResultGridRow = memo(function ResultGridRow({</div><span className="mt-0.5 flex min-w-0 items-center gap-1 text-[11.5px] leading-[15px] text-muted-foreground/80"><VerifiedOwner owner={row.owner} />- {row.fitLevel && (- <>- <span aria-hidden="true" className="text-muted-foreground/35">•</span>- <span- className={cn(- "text-[9px] font-semibold uppercase shrink-0",- row.fitLevel === "comfortable" && "text-emerald-600 dark:text-emerald-400",- row.fitLevel === "fits" && "text-amber-600 dark:text-amber-400",- row.fitLevel === "oom" && "text-red-500"- )}- >- {row.fitLevel === "comfortable" ? "Comfortable" : row.fitLevel === "fits" ? "Fits GPU" : "OOM"}- </span>- </>- )}</span></div></div>@@ -882,21 +851,6 @@ export const ResultSplitRow = memo(function ResultSplitRow({</div><span className="mt-0.5 flex min-w-0 items-center gap-1 text-[10.5px] leading-[14px] text-muted-foreground/80"><VerifiedOwner owner={row.owner} />- {row.fitLevel && (- <>- <span aria-hidden="true" className="text-muted-foreground/35">•</span>- <span- className={cn(- "text-[9px] font-semibold uppercase shrink-0",- row.fitLevel === "comfortable" && "text-emerald-600 dark:text-emerald-400",- row.fitLevel === "fits" && "text-amber-600 dark:text-amber-400",- row.fitLevel === "oom" && "text-red-500"- )}- >- {row.fitLevel === "comfortable" ? "Comfortable" : row.fitLevel === "fits" ? "Fits GPU" : "OOM"}- </span>- </>- )}</span></div><div className="flex shrink-0 flex-col items-end gap-0.5 text-[10.5px] tabular-nums text-muted-foreground/70">diff --git a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx b/studio/frontend/src/features/hub/catalog/models-toolbar.tsxindex 9cb17736afc..48f7fcffaa7 100644--- a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx+++ b/studio/frontend/src/features/hub/catalog/models-toolbar.tsx@@ -21,7 +21,6 @@ import { HugeiconsIcon } from "@hugeicons/react";import type { HfSortKey } from "@/features/hub/hooks/use-hub-model-search";import type {CapabilityFilter,- GpuFitFilter,ModelFormatFilter,ModelsTab,ResourceTypeFilter,@@ -29,7 +28,6 @@ import type {import {CAPABILITY_FILTER_OPTIONS,FORMAT_FILTER_OPTIONS,- GPU_FIT_FILTER_OPTIONS,} from "../lib/view-models";import { HubOptionMenu, type HubOption } from "./hub-option-menu";import {@@ -70,8 +68,6 @@ export const ModelsToolbar = memo(function ModelsToolbar({onFormatFilterChange,capabilityFilter,onCapabilityFilterChange,- gpuFitFilter,- onGpuFitFilterChange,onManageLocalFolders,onOpenFineTune,}: {@@ -88,8 +84,6 @@ export const ModelsToolbar = memo(function ModelsToolbar({onFormatFilterChange: (value: ModelFormatFilter) => void;capabilityFilter: CapabilityFilter;onCapabilityFilterChange: (value: CapabilityFilter) => void;- gpuFitFilter: GpuFitFilter;- onGpuFitFilterChange: (value: GpuFitFilter) => void;onManageLocalFolders: () => void;/** Opens the curated "Fine-tune ready" channel (discover only). Exposed as a* format-dropdown option rather than a standalone feed section. */@@ -159,14 +153,6 @@ export const ModelsToolbar = memo(function ModelsToolbar({})),[],);- const gpuFitOptions = useMemo<HubOption<GpuFitFilter>[]>(- () =>- GPU_FIT_FILTER_OPTIONS.map((option) => ({- value: option.value,- label: option.label,- })),- [],- );const sortOptions = useMemo<HubOption<HfSortKey>[]>(() =>SORT_OPTIONS.map((option) => ({@@ -357,16 +343,6 @@ export const ModelsToolbar = memo(function ModelsToolbar({/>)}- {tab === "discover" && !isDataset && (- <HubOptionMenu- value={gpuFitFilter}- options={gpuFitOptions}- onValueChange={onGpuFitFilterChange}- ariaLabel="GPU fit filter"- className={cn(triggerBase, "w-[128px]")}- />- )}-{tab === "discover" && (<HubOptionMenuvalue={sortBy}diff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsxindex 4c79b607d95..c6968622831 100644--- a/studio/frontend/src/features/hub/hub-page.tsx+++ b/studio/frontend/src/features/hub/hub-page.tsx@@ -85,17 +85,12 @@ import type {CachedInventoryRow,CapabilityFilter,DiscoverRow,- GpuFitFilter,LocalInventoryRow,ModelFormatFilter,ModelsTab,ResourceTypeFilter,SelectedModelView,} from "./types";-import {- classifyGpuFit,- matchesGpuFitFilter,-} from "./lib/gpu-fit-filter";const MODELS_TAB_STORAGE_KEY = "unsloth.hub.modelsTab";const ALL_MODELS_VIEW_STORAGE_KEY = "unsloth.hub.allModelsView";@@ -418,7 +413,6 @@ export function ModelsPage() {);const [capabilityFilter, setCapabilityFilter] =useState<CapabilityFilter>("all");- const [gpuFitFilter, setGpuFitFilter] = useState<GpuFitFilter>("all");const [allModelsView, setAllModelsViewState] = useState<AllModelsView>(readAllModelsViewPreference,);@@ -567,7 +561,6 @@ export function ModelsPage() {const apiHfToken = hfApiToken(debouncedHfToken);const deferredFormatFilter = useDeferredValue(formatFilter);const deferredCapabilityFilter = useDeferredValue(capabilityFilter);- const deferredGpuFitFilter = useDeferredValue(gpuFitFilter);const hasQuery = deferredDebouncedQuery.trim() !== "";const mode: DiscoverMode = !isModelDiscover@@ -697,59 +690,20 @@ export function ModelsPage() {const discoverRows = isDatasetMode ? datasetDiscoverRows : modelDiscoverRows;- // Pre-compute GPU fit level for every discover row so filteredDiscoverRows- // and model cards can both consume the same classification.- const gpuFitLevelById = useMemo(() => {- const map = new Map<string, ReturnType<typeof classifyGpuFit>>();- for (const row of discoverRows) {- map.set(- row.id,- classifyGpuFit({- totalParams: row.result.totalParams,- estimatedSizeBytes: row.result.estimatedSizeBytes,- repoId: row.id,- gpu,- }),- );- }- return map;- }, [discoverRows, gpu]);-- const addGpuFitLevel = useCallback(- (row: DiscoverRow): DiscoverRow => ({- ...row,- fitLevel: classifyGpuFit({- totalParams: row.result.totalParams,- estimatedSizeBytes: row.result.estimatedSizeBytes,- repoId: row.id,- gpu,- }),- }),- [gpu],- );-const filteredDiscoverRows = useMemo(() => {if (isDatasetMode) return discoverRows;- return discoverRows- .filter(- (row) =>- !isHiddenModelId(row.id) &&- matchesFormat(detectResultFormat(row.result), effectiveDiscoverFormat) &&- matchesCapability(row.capabilities, deferredCapabilityFilter) &&- matchesGpuFitFilter(gpuFitLevelById.get(row.id) ?? null, deferredGpuFitFilter) &&- (!activeChannel?.finetunableOnly || isUnslothFinetunable(row.result)),- )- .map((row) => ({- ...row,- fitLevel: gpuFitLevelById.get(row.id) ?? null,- }));+ return discoverRows.filter(+ (row) =>+ !isHiddenModelId(row.id) &&+ matchesFormat(detectResultFormat(row.result), effectiveDiscoverFormat) &&+ matchesCapability(row.capabilities, deferredCapabilityFilter) &&+ (!activeChannel?.finetunableOnly || isUnslothFinetunable(row.result)),+ );}, [discoverRows,isDatasetMode,effectiveDiscoverFormat,deferredCapabilityFilter,- deferredGpuFitFilter,- gpuFitLevelById,activeChannel,]);@@ -770,17 +724,8 @@ export function ModelsPage() {effectiveLocalRows,).filter((row) => !isHiddenModelId(row.id))- .filter((row) => matchesFormat(row.result.isGguf, "gguf"))- .map(addGpuFitLevel)- .filter((row) =>- matchesGpuFitFilter(row.fitLevel ?? null, deferredGpuFitFilter),- ),- [- hubFeed.trending.results,- modelDiscoveryInventorySignature,- addGpuFitLevel,- deferredGpuFitFilter,- ],+ .filter((row) => matchesFormat(row.result.isGguf, "gguf")),+ [hubFeed.trending.results, modelDiscoveryInventorySignature],);const feedRows = useMemo(() => {if (!isFeedMode) return [];@@ -897,7 +842,6 @@ export function ModelsPage() {resourceType,deferredFormatFilter,deferredCapabilityFilter,- deferredGpuFitFilter,effectiveSort,effectiveDirection,activeChannelId,@@ -908,7 +852,6 @@ export function ModelsPage() {resourceType,deferredFormatFilter,deferredCapabilityFilter,- deferredGpuFitFilter,effectiveSort,effectiveDirection,activeChannelId,@@ -929,7 +872,6 @@ export function ModelsPage() {setDownloadedFormat("all");}setCapabilityFilter("all");- setGpuFitFilter("all");}, [isDiscoverTab, urlSection, navigate]);const handleDiscoverFetchIntent = useCallback(() => {setDiscoverFetchIntent((value) => value + 1);@@ -1295,10 +1237,8 @@ export function ModelsPage() {hasMore,manualFetchAvailable: discoverManualFetchAvailable,hasActiveFilters:- deferredGpuFitFilter !== "all" ||- (!isFeedMode &&- (deferredFormatFilter !== "all" ||- deferredCapabilityFilter !== "all")),+ !isFeedMode &&+ (deferredFormatFilter !== "all" || deferredCapabilityFilter !== "all"),}),[tab,@@ -1324,7 +1264,6 @@ export function ModelsPage() {discoverManualFetchAvailable,deferredFormatFilter,deferredCapabilityFilter,- deferredGpuFitFilter,],);@@ -1509,8 +1448,6 @@ export function ModelsPage() {onFormatFilterChange={setFormatFilter}capabilityFilter={capabilityFilter}onCapabilityFilterChange={setCapabilityFilter}- gpuFitFilter={gpuFitFilter}- onGpuFitFilterChange={setGpuFitFilter}onManageLocalFolders={handleManageLocalFolders}onOpenFineTune={() => handleOpenList("finetune")}/>diff --git a/studio/frontend/src/features/hub/lib/gpu-fit-filter.ts b/studio/frontend/src/features/hub/lib/gpu-fit-filter.tsdeleted file mode 100644index 7eca4c315a1..00000000000--- a/studio/frontend/src/features/hub/lib/gpu-fit-filter.ts+++ /dev/null@@ -1,80 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0--// GPU-aware model-fit filtering: classifies whether a model fits the device-// and provides a filter predicate for the Hub page and model selector.--import type { GpuInfo } from "@/hooks/use-gpu-info";-import {- activeOrEffectiveParamsFromId,- estimateQuantBytes,- paramsFromId,-} from "@/components/assistant-ui/model-selector/recommended-fit";--/** The three filter states exposed in the toolbar dropdown. */-export type GpuFitFilter = "all" | "fits" | "comfortable";--/** Per-model fit classification. */-export type GpuFitLevel = "comfortable" | "fits" | "oom";--/**- * Classify whether a model fits the device.- *- * - "comfortable": estimated size ≤ 70% of GPU VRAM (runs fully in VRAM)- * - "fits": estimated size ≤ 70% GPU + 70% system RAM (runs with CPU offload)- * - "oom": exceeds both budgets- *- * Returns null when we can't determine the size (unknown → no badge).- */-export function classifyGpuFit(opts: {- totalParams?: number;- estimatedSizeBytes?: number;- repoId: string;- gpu: GpuInfo;-}): GpuFitLevel | null {- const { totalParams, estimatedSizeBytes, repoId, gpu } = opts;- const gpuGb = gpu.memoryTotalGb;- const ramGb = gpu.systemRamAvailableGb;- if (gpuGb <= 0 && ramGb <= 0) return null; // no budget info-- // Active/effective model tokens (for example MoE A3B) describe runnable size- // better than HF total-parameter metadata; otherwise prefer exact metadata.- const activeOrEffectiveParams = activeOrEffectiveParamsFromId(repoId);- const params = activeOrEffectiveParams ?? totalParams ?? paramsFromId(repoId);- const sizeBytes =- activeOrEffectiveParams- ? estimateQuantBytes(activeOrEffectiveParams)- : estimatedSizeBytes ?? (params ? estimateQuantBytes(params) : undefined);-- if (!sizeBytes || sizeBytes <= 0) return null; // can't determine-- const sizeGb = sizeBytes / 1024 ** 3;- let comfortBudget: number;- let fitBudget: number;-- if (!gpu.available || gpuGb <= 0) {- // Unified memory system (no discrete GPU)- comfortBudget = ramGb * 0.7;- fitBudget = ramGb * 0.7;- } else {- // Discrete GPU- comfortBudget = gpuGb * 0.7;- fitBudget = gpuGb * 0.7 + ramGb * 0.7;- }-- if (sizeGb <= comfortBudget) return "comfortable";- if (sizeGb <= fitBudget) return "fits";- return "oom";-}--/** Whether a row passes the given GPU fit filter. */-export function matchesGpuFitFilter(- level: GpuFitLevel | null,- filter: GpuFitFilter,-): boolean {- if (filter === "all") return true;- if (level === null) return false;- if (filter === "comfortable") return level === "comfortable";- // "fits" shows both comfortable and fits- return level === "comfortable" || level === "fits";-}diff --git a/studio/frontend/src/features/hub/lib/view-models.ts b/studio/frontend/src/features/hub/lib/view-models.tsindex cdd17855dbb..9ee6c5de5d7 100644--- a/studio/frontend/src/features/hub/lib/view-models.ts+++ b/studio/frontend/src/features/hub/lib/view-models.ts@@ -10,7 +10,6 @@ import type {import type {CapabilityFilter,DiscoverRow,- GpuFitFilter,ModelFormatFilter,} from "../types";import {@@ -52,15 +51,6 @@ export const FORMAT_FILTER_OPTIONS: ReadonlyArray<{{ value: "mlx", label: "MLX" },];-export const GPU_FIT_FILTER_OPTIONS: ReadonlyArray<{- value: GpuFitFilter;- label: string;-}> = [- { value: "all", label: "All sizes" },- { value: "fits", label: "Fits GPU" },- { value: "comfortable", label: "Comfortable" },-];-const BILLION = 1_000_000_000;export function formatParamCount(totalParams: number | undefined): string {diff --git a/studio/frontend/src/features/hub/types.ts b/studio/frontend/src/features/hub/types.tsindex 9fabdb2a8b2..ae9ddf5d4bc 100644--- a/studio/frontend/src/features/hub/types.ts+++ b/studio/frontend/src/features/hub/types.ts@@ -28,9 +28,6 @@ export type ModelFormatFilter = "all" | "gguf" | "checkpoint" | "mlx";export type CapabilityFilter = "all" | CapabilityKey;-import type { GpuFitFilter, GpuFitLevel } from "./lib/gpu-fit-filter";-export type { GpuFitFilter, GpuFitLevel };-export interface DiscoverRow {id: string;owner: string;@@ -40,7 +37,6 @@ export interface DiscoverRow {isPartialOnDevice: boolean;summary: string;capabilities: Capability[];- fitLevel?: GpuFitLevel | null;}export type SelectedResourceSource = "huggingface" | "hub_cache" | LocalSource;