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: sort the image picker by the chosen Hub sort, keep unsloth rows on top, and drop the Recommended sort (#11642)
Michael Hanfd1adc875d6f
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 5925a441978..e5e1c051a9b 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@@ -52,7 +52,6 @@ import {} from "@/features/hub";import {type HfModelResult,- type HfSortKey,useHubModelSearch,} from "@/features/hub";import {@@ -2514,12 +2513,10 @@ function canDeleteLoraModel(model: LoraModelOption): boolean {}-// Recommended section sort: "recommended" = newly created unsloth GGUF/MLX that fit the-// device; the rest are plain HF sort keys.-type RecommendedSortKey = "recommended" | "trendingScore" | "lastModified";+// Recommended section sort: plain HF sort keys.+type RecommendedSortKey = "trendingScore" | "lastModified";const RECOMMENDED_SORT_OPTIONS: HubOption<RecommendedSortKey>[] = [- { value: "recommended", label: "Recommended" },{ value: "trendingScore", label: "Trending" },{ value: "lastModified", label: "Recent" },];@@ -2803,9 +2800,6 @@ export function HubModelPicker({// Recommended section: a live unsloth listing sorted by the dropdown, the same sort that drives search results.const [recommendedSort, setRecommendedSort] =useState<RecommendedSortKey>("trendingScore");- // "recommended" surfaces the most recently created Unsloth repos.- const recommendedSortBy: HfSortKey =- recommendedSort === "recommended" ? "createdAt" : recommendedSort;const {results,isLoading,@@ -2815,7 +2809,7 @@ export function HubModelPicker({hasMore,} = useHubModelSearch(debouncedQuery, {ownerScope: "unsloth",- sortBy: recommendedSortBy,+ sortBy: recommendedSort,sortDirection: "desc",pinUnslothFirst: true,keepUnsupportedTags: true,@@ -2826,7 +2820,7 @@ export function HubModelPicker({});const recommendedSearch = useHubModelSearch("", {ownerScope: "unsloth",- sortBy: recommendedSortBy,+ sortBy: recommendedSort,sortDirection: "desc",pinUnslothFirst: true,keepUnsupportedTags: true,@@ -2848,7 +2842,7 @@ export function HubModelPicker({const communityQuerySearch = useHubModelSearch(debouncedQuery, {task,ownerScope: "all",- sortBy: recommendedSortBy,+ sortBy: recommendedSort,sortDirection: "desc",pinUnslothFirst: false,accessToken,@@ -2857,7 +2851,7 @@ export function HubModelPicker({const communityBrowse = useHubModelSearch("", {task,ownerScope: "all",- sortBy: recommendedSortBy,+ sortBy: recommendedSort,sortDirection: "desc",pinUnslothFirst: false,accessToken,@@ -3483,8 +3477,8 @@ export function HubModelPicker({[catalogSeedRows],);- // Recommended suggests GGUF anywhere, plus MLX and safetensors on Mac; the "recommended" sort- // also drops models too big for the device. Downloaded models stay visible.+ // Recommended suggests GGUF anywhere, plus MLX and safetensors on Mac; the "Fits on device"+ // tick also drops models too big for the device. Downloaded models stay visible.const recommendedRows = useMemo(() => {const catalogSeedIds = new Set(catalogSeedRows.map((row) => row.id.toLowerCase()),@@ -3515,8 +3509,7 @@ export function HubModelPicker({const keepCommunity = (r: HfModelResult) =>keepCommon(r) && isTaskRuntimeSupported(r);// Members are not filtered here (see recommendedIds): that dropped them from Hub search too.- // "recommended" always device-filters; the "Fits on device" tick extends it to other sorts.- const deviceFiltered = recommendedSort === "recommended" || fitOnDeviceOnly;+ const deviceFiltered = fitOnDeviceOnly;const taskScoped = Boolean(task);const rowGpu = loadScopedGpu(gpu, taskScoped);const rowInferenceGpu = loadScopedGpu(inferenceGpu, taskScoped);@@ -3542,6 +3535,10 @@ export function HubModelPicker({keep,deviceFiltered,fits,+ // Curated families follow the dropdown's sort, not catalog order.+ familyOf: catalog+ ? (id) => groupForRepoId(id, catalog)?.canonicalId.toLowerCase()+ : undefined,});if (!communityRecommendedEnabled) return unslothRows;// Appended below everything unsloth publishes, so scrolling past the unsloth uploads continues@@ -3560,7 +3557,6 @@ export function HubModelPicker({recommendedSearch.results,catalogSeedRows,downloadedSet,- recommendedSort,fitOnDeviceOnly,formatFilter,isMac,diff --git a/studio/frontend/src/features/model-picker/components/model-selector/recommended-fit.ts b/studio/frontend/src/features/model-picker/components/model-selector/recommended-fit.tsindex e7440175419..4dfc965ad8e 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/recommended-fit.ts+++ b/studio/frontend/src/features/model-picker/components/model-selector/recommended-fit.ts@@ -327,8 +327,8 @@ export function searchableRecommendedIds(}/** Order Recommended: curated seeds first in catalog order, then the rest of the listing, each- * id once. A seed hands off only to a row that survived `keep`, so a painted curated row- * does not vanish when the listing reports it with rejected metadata. The taking-over row+ * id once. With `familyOf`, families follow the listing's sort instead. A seed hands off only+ * to a row that survived `keep`, so a painted curated row does not vanish when the listing reports it with rejected metadata. The taking-over row* inherits the seed's curated size, or a prequantized artifact would flip to the params* guess, which assumes a quant still to come. */export function orderRecommendedRows<@@ -339,8 +339,12 @@ export function orderRecommendedRows<keep: (row: T) => boolean;deviceFiltered: boolean;fits: (row: T) => boolean;+ /** Catalog family of a repo id; when set, first-party rows lead and families follow the+ * listing's sort. `results` must be one sorted listing of unsloth/* repos, since a family ranks+ * by its index there. */+ familyOf?: (id: string) => string | undefined;}): T[] {- const { seeds, results, keep, deviceFiltered, fits } = opts;+ const { seeds, results, keep, deviceFiltered, fits, familyOf } = opts;const seedById = new Map(seeds.map((s) => [s.id, s]));const rows = results.filter(keep).map((row) => {const curatedSizeBytes = seedById.get(row.id)?.curatedSizeBytes;@@ -358,7 +362,41 @@ export function orderRecommendedRows<const rest = (deviceFiltered ? rows.filter(fits) : rows).filter((r) => !curatedIds.has(r.id),);- return [...curated, ...rest];+ const ordered = [...curated, ...rest];+ if (!familyOf) return ordered;+ // First-party rows lead. A family ranks at its best listed artifact and keeps its rows together;+ // unlisted families go last, except first-party ones the unsloth listing can never return+ // (unslothai/*), which keep their curated place on top.+ const keyOf = (r: T) => familyOf(r.id) ?? r.id.toLowerCase();+ const firstParty = (id: string) => /^unsloth(ai)?\//i.test(id);+ const listable = new Set(+ ordered.filter((r) => /^unsloth\//i.test(r.id)).map(keyOf),+ );+ const rank = new Map<string, number>();+ results.forEach((r, i) => {+ const key = keyOf(r);+ if (!rank.has(key)) rank.set(key, i);+ });+ const firstSeen = new Map<string, number>();+ ordered.forEach((r, i) => {+ const key = keyOf(r);+ if (!firstSeen.has(key)) firstSeen.set(key, i);+ });+ const sortKey = (r: T, i: number) => {+ const key = keyOf(r);+ const ours = firstParty(r.id);+ const unranked = ours && !listable.has(key) ? -1 : Infinity;+ return [ours ? 0 : 1, rank.get(key) ?? unranked, firstSeen.get(key) ?? i, i];+ };+ return ordered+ .map((row, i) => ({ row, key: sortKey(row, i) }))+ .sort((a, b) => {+ for (let k = 0; k < a.key.length; k++) {+ if (a.key[k] !== b.key[k]) return a.key[k] < b.key[k] ? -1 : 1;+ }+ return 0;+ })+ .map(({ row }) => row);}/** The allowance a curated row was judged against, the memory it is 70% of, and the unrounded size. */diff --git a/studio/frontend/tests/recommended-catalog-seeds.test.ts b/studio/frontend/tests/recommended-catalog-seeds.test.tsindex 5c6c01af40b..7766c41fe7a 100644--- a/studio/frontend/tests/recommended-catalog-seeds.test.ts+++ b/studio/frontend/tests/recommended-catalog-seeds.test.ts@@ -512,3 +512,87 @@ test("a media row is judged by the rule its quant rows use", () => {const safetensors = { ...row, id: "unsloth/Some-Image-Model", isGguf: false };assert.equal(hfModelFitsDevice(safetensors, mac, { mediaLoad: true }), false);});++test("with familyOf, curated families follow the listing's sort, artifacts kept together", () => {+ const family = (id: string) =>+ id.toLowerCase().includes("klein") ? "klein" : id.toLowerCase().includes("ltx") ? "ltx" : undefined;+ const kleinBf16: Row = { id: "unsloth/FLUX.2-klein-9B", pipelineTag: "text-to-video" };+ const seeds: Row[] = [...SEEDS, kleinBf16];+ // Trending listing: KLEIN hottest, then an uncurated repo, then LTX; KLEIN's bf16 is not listed.+ const results: Row[] = [+ { id: KLEIN, isGguf: true, pipelineTag: "text-to-video" },+ { id: OTHER, isGguf: true, pipelineTag: "text-to-video" },+ { id: LTX, isGguf: true, pipelineTag: "image-to-video" },+ ];+ const order = (familyOf?: (id: string) => string | undefined) =>+ ids(+ orderRecommendedRows({+ seeds,+ results,+ keep: keepVideo,+ deviceFiltered: false,+ fits: () => true,+ familyOf,+ }),+ );+ assert.deepEqual(order(), [LTX, KLEIN, kleinBf16.id, OTHER]);+ assert.deepEqual(order(family), [KLEIN, kleinBf16.id, OTHER, LTX]);+ // A family the listing has not reached yet stays after every listed row.+ const unlisted = ids(+ orderRecommendedRows({+ seeds,+ results: results.slice(0, 2),+ keep: keepVideo,+ deviceFiltered: false,+ fits: () => true,+ familyOf: family,+ }),+ );+ assert.deepEqual(unlisted, [KLEIN, kleinBf16.id, OTHER, LTX]);+});++test("with familyOf, unsloth rows lead even when a vendor family trends higher", () => {+ const family = (id: string) => (id.toLowerCase().includes("hot") ? "hot" : "cold");+ const vendorHot: Row = { id: "Vendor/Hot-Model", pipelineTag: "text-to-video" };+ const seeds: Row[] = [vendorHot, { id: "unsloth/Hot-Model-GGUF", isGguf: true }];+ const results: Row[] = [+ { id: "unsloth/Hot-Model-GGUF", isGguf: true, pipelineTag: "text-to-video" },+ { id: "unsloth/Cold-Model-GGUF", isGguf: true, pipelineTag: "text-to-video" },+ ];+ assert.deepEqual(+ ids(+ orderRecommendedRows({+ seeds,+ results,+ keep: keepVideo,+ deviceFiltered: false,+ fits: () => true,+ familyOf: family,+ }),+ ),+ ["unsloth/Hot-Model-GGUF", "unsloth/Cold-Model-GGUF", "Vendor/Hot-Model"],+ );+});++test("with familyOf, an unslothai family the unsloth listing cannot rank keeps its curated slot", () => {+ const family = (id: string) => id.toLowerCase().replace(/-gguf$/, "");+ const ASR = "unslothai/Qwen3-ASR-0.6B-GGUF";+ const TURBO = "unsloth/whisper-large-v3-turbo";+ const TINY = "unsloth/whisper-tiny";+ const seeds: Row[] = [{ id: ASR, isGguf: true }, { id: TURBO }, { id: TINY }];+ const order = (results: Row[]) =>+ ids(+ orderRecommendedRows({+ seeds,+ results,+ keep: () => true,+ deviceFiltered: false,+ fits: () => true,+ familyOf: family,+ }),+ );+ // Offline or still loading: catalog order.+ assert.deepEqual(order([]), [ASR, TURBO, TINY]);+ // The listing ranks the unsloth rows, and the unslothai row stays above them.+ assert.deepEqual(order([{ id: TINY }, { id: TURBO }]), [ASR, TINY, TURBO]);+});