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: classify MLX repos by name or model-card tag everywhere (#16883)
Long Yixing1bf139b02b38
diff --git a/studio/backend/hub/services/models/gguf_variants.py b/studio/backend/hub/services/models/gguf_variants.pyindex efba9145ec3..107b3335095 100644--- a/studio/backend/hub/services/models/gguf_variants.py+++ b/studio/backend/hub/services/models/gguf_variants.py@@ -1153,7 +1153,7 @@ async def _mlx_precision_variants_answer(else None. Each folder is a whole checkpoint, so a pick downloads and loads that folder alone."""if is_local_path(repo_id) or not _is_valid_repo_id(repo_id):return None- from hub.utils.mlx_variants import cached_precision_folder+ from hub.utils.mlx_variants import cached_precision_folder, looks_like_mlx_repofrom hub.utils.snapshot_filters import (precision_variant_subfolders,repo_ships_root_safetensors,@@ -1177,7 +1177,11 @@ async def _mlx_precision_variants_answer(logger.debug("MLX precision folders for %s unavailable: %s", repo_id, exc)else:tags = {str(tag).lower() for tag in (info.tags or [])}- if "mlx" not in tags and str(info.library_name or "").lower() != "mlx":+ if (+ "mlx" not in tags+ and str(info.library_name or "").lower() != "mlx"+ and not looks_like_mlx_repo(repo_id)+ ):return Nonesizes = {s.rfilename: int(s.size or 0) for s in (info.siblings or [])}hashes = {s.rfilename: sibling_sha256(s) for s in (info.siblings or [])}diff --git a/studio/backend/hub/utils/mlx_variants.py b/studio/backend/hub/utils/mlx_variants.pyindex dd4fe6bdf10..3e4944040bc 100644--- a/studio/backend/hub/utils/mlx_variants.py+++ b/studio/backend/hub/utils/mlx_variants.py@@ -6,12 +6,21 @@from __future__ import annotationsimport os+import refrom pathlib import Pathfrom typing import Optionalfrom hub.utils.snapshot_filters import PRECISION_FOLDER_RE+def looks_like_mlx_repo(model_id: str) -> bool:+ """``mlx-community/`` or a whole ``MLX`` name segment; mirrored by the frontend's isMlxId."""+ if model_id.lower().startswith("mlx-community/"):+ return True+ tail = model_id.split("/")[-1]+ return "MLX" in re.split(r"[-_.]", tail.upper())++def is_precision_folder(variant: Optional[str]) -> bool:return bool(variant) and PRECISION_FOLDER_RE.fullmatch(str(variant).strip()) is not Nonediff --git a/studio/backend/routes/models.py b/studio/backend/routes/models.pyindex e75b03ee48e..e42a84ea168 100644--- a/studio/backend/routes/models.py+++ b/studio/backend/routes/models.py@@ -196,6 +196,7 @@ from hub.utils.host_paths import (resolve_host_path_reference,scrub_paths,)+from hub.utils.mlx_variants import looks_like_mlx_repofrom utils.utils import anonymous_and_offline@@ -2097,15 +2098,6 @@ def browse_folders()-def _looks_like_mlx_repo(model_id: str) -> bool:- """Name heuristic for unloaded models (mirrors the -GGUF suffix check);- tokenized so MLX only matches as a whole name segment."""- if model_id.lower().startswith("mlx-community/"):- return True- tail = model_id.split("/")[-1]- return "MLX" in _re.split(r"[-_.]", tail.upper())--@router.get("/list")async def list_models(current_subject: str = Depends(get_current_subject)):"""List available models: default plus currently loaded."""@@ -2192,7 +2184,7 @@ async def list_models(current_subject: str = Depends(get_current_subject)):id = model_id,name = display_model_name(model_id),is_gguf = model_id.upper().endswith("-GGUF"),- is_mlx = _looks_like_mlx_repo(model_id),+ is_mlx = looks_like_mlx_repo(model_id),)all_models.append(model_info)seen_ids.add(model_id)diff --git a/studio/backend/tests/test_mlx_precision_variants.py b/studio/backend/tests/test_mlx_precision_variants.pyindex 71764001205..d594bb14e95 100644--- a/studio/backend/tests/test_mlx_precision_variants.py+++ b/studio/backend/tests/test_mlx_precision_variants.py@@ -173,10 +173,27 @@ def test_mlx_repo_lists_its_precision_folders_as_variants(monkeypatch):assert answer.cache_authorized is False+ "repo, tags, library",+ [+ (_REPO, ("safetensors",), None),+ ("mlx-community/Qwen3.8-27B-4bit", ("safetensors",), None),+ ("org/Qwen3.8-27B-4bit", ("safetensors", "mlx"), "transformers"),+ ("org/Qwen3.8-27B-4bit", ("safetensors",), "mlx"),+ ],+)+def test_a_repo_named_or_tagged_mlx_lists_its_precision_folders(monkeypatch, repo, tags, library):+ _no_gguf_rows(monkeypatch)+ _fake_hub(monkeypatch, tags = tags, library = library)+ answer = asyncio.run(gguf_variants.get_gguf_variants_answer(repo))+ assert answer.response.variant_format == "mlx"++def test_non_mlx_repo_and_repo_without_folders_get_no_mlx_listing(monkeypatch):empty = _no_gguf_rows(monkeypatch)_fake_hub(monkeypatch, tags = ("safetensors",), library = "transformers")- assert asyncio.run(gguf_variants.get_gguf_variants_answer(_REPO)) is empty+ plain = "orcarouter/Qwen3.8-27B-Uncensored"+ assert asyncio.run(gguf_variants.get_gguf_variants_answer(plain)) is empty_fake_hub(monkeypatch, sizes = _folder("", [GB]))assert asyncio.run(gguf_variants.get_gguf_variants_answer(_REPO)) is emptydiff --git a/studio/frontend/src/features/hub/catalog/inventory-sort.ts b/studio/frontend/src/features/hub/catalog/inventory-sort.tsindex 85461feb9dd..74d3dad8ff4 100644--- a/studio/frontend/src/features/hub/catalog/inventory-sort.ts+++ b/studio/frontend/src/features/hub/catalog/inventory-sort.ts@@ -1,7 +1,11 @@// 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 type { FormatFilterModelFormat } from "../lib/format-filters";+import {+ type FormatFilterModelFormat,+ hasMlxCardTag,+ isMlxId,+} from "../lib/format-filters";import type { CachedInventoryRow, LocalInventoryRow } from "../types";export type InventoryItem =@@ -16,17 +20,20 @@ export function inventoryItemSize(item: InventoryItem): number {return item.variant === "cached" ? item.row.bytes : (item.row.bytes ?? 0);}-/** The scan never reports "mlx"; an MLX folder says so in its library, tags or oMLX source. */+/** The scan never reports "mlx"; an MLX folder says so in its name, library, tags or oMLX source. */export function inventoryRowFormat(row: CachedInventoryRow | LocalInventoryRow,): FormatFilterModelFormat {if (row.modelFormat === "gguf") {return "gguf";}- const mlx =- row.libraryName?.toLowerCase() === "mlx" ||- (row.tags ?? []).some((tag) => tag.toLowerCase() === "mlx") ||- (row.kind === "local" && row.source === "omlx");+ const tagged =+ hasMlxCardTag(row) || (row.kind === "local" && row.source === "omlx");+ const names =+ row.kind === "local"+ ? [row.path, row.title, row.modelId ?? ""]+ : [row.repoId];+ const mlx = tagged || names.some((name) => isMlxId(name));return mlx ? "mlx" : row.modelFormat;}diff --git a/studio/frontend/src/features/hub/catalog/model-inspector.tsx b/studio/frontend/src/features/hub/catalog/model-inspector.tsxindex 3e2218f2de2..659072accaa 100644--- a/studio/frontend/src/features/hub/catalog/model-inspector.tsx+++ b/studio/frontend/src/features/hub/catalog/model-inspector.tsx@@ -53,6 +53,7 @@ import {isEmbeddingOnly,isHubModelRunEligible,} from "../lib/model-run-selection";+import { hasMlxCardTag, isMlxId } from "../lib/format-filters";import { studioPageForTask } from "../lib/unsloth-support";import {formatLibrary,@@ -606,9 +607,7 @@ export const ModelInspector = memo(function ModelInspector({: undefined;// A precision folder downloads as it loads, so it need not be on device.const isMlx =- !model.isGguf &&- (model.libraryName?.toLowerCase() === "mlx" ||- Boolean(model.tags?.some((tag) => tag.toLowerCase() === "mlx")));+ !model.isGguf && isMlxId(model.hubRepoId ?? "", hasMlxCardTag(model));const precisionRunAction =isMlx &&onRun &&diff --git a/studio/frontend/src/features/hub/lib/format-filters.ts b/studio/frontend/src/features/hub/lib/format-filters.tsindex ae09fdc6029..2fe1767560b 100644--- a/studio/frontend/src/features/hub/lib/format-filters.ts+++ b/studio/frontend/src/features/hub/lib/format-filters.ts@@ -42,18 +42,40 @@ export function matchesFormat(return normalized === "safetensors" || normalized === "checkpoint";}+// Mirrors the backend's looks_like_mlx_repo.+const MLX_NAME_RE = /(?:^|[-_.])mlx(?:$|[-_.])/i;+const MLX_OWNER_PREFIX = "mlx-community/";+// Callers pass a filesystem path, which may be Windows.+const PATH_SEP_RE = /[\\/]/;++/** The model card's own marking. The Hub never inspects weights, so many MLX uploads lack it. */+export function hasMlxCardTag(model: {+ tags?: readonly string[] | null;+ libraryName?: string | null;+}): boolean {+ return (+ model.libraryName?.toLowerCase() === "mlx" ||+ Boolean(model.tags?.some((tag) => tag.toLowerCase() === "mlx"))+ );+}++/** MLX by name, or by `hintedIsMlx` (pass hasMlxCardTag); either alone misses real MLX repos. */+export function isMlxId(id: string, hintedIsMlx?: boolean): boolean {+ if (hintedIsMlx) return true;+ const trimmed = id.trim();+ if (trimmed.toLowerCase().startsWith(MLX_OWNER_PREFIX)) return true;+ const leaf = trimmed.split(PATH_SEP_RE).filter(Boolean).at(-1) ?? trimmed;+ return MLX_NAME_RE.test(leaf);+}+export function detectResultFormat(result: {+ id: string;isGguf: boolean;tags?: string[];libraryName?: string;}): FormatFilterModelFormat {if (result.isGguf) return "gguf";- if (- result.libraryName?.toLowerCase() === "mlx" ||- result.tags?.some((tag) => tag.toLowerCase() === "mlx")- ) {- return "mlx";- }+ if (isMlxId(result.id, hasMlxCardTag(result))) return "mlx";return "safetensors";}diff --git a/studio/frontend/src/features/hub/lib/unsloth-support.ts b/studio/frontend/src/features/hub/lib/unsloth-support.tsindex e41041f738a..03673358c7d 100644--- a/studio/frontend/src/features/hub/lib/unsloth-support.ts+++ b/studio/frontend/src/features/hub/lib/unsloth-support.ts@@ -210,7 +210,7 @@ function detectUnsupportedFormatKey(if (alias && excludedFormats.has(alias)) return alias;}if (modelId) {- // Mirrors the backend's _looks_like_mlx_repo heuristic.+ // Mirrors the backend's looks_like_mlx_repo heuristic.if (excludedFormats.has("mlx") && modelId.trim().toLowerCase().startsWith("mlx-community/")) return "mlx";const name = repoLeaf(modelId);for (const { key, pattern } of FORMAT_NAME_PATTERNS) {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 c013d573bf3..e6d0974d731 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@@ -253,6 +253,7 @@ import {curatedBudgetText,estimateQuantBytes,formatFilterValues,+ hasMlxCardTag,hfModelFitsDevice,isMlxId,isCapableCheckpointQuant,@@ -1844,7 +1845,7 @@ const DownloadedModelDeviceRow = memo(function DownloadedModelDeviceRow({<ModelRowlabel={c.repo_id}hubUrl={hubRepoUrl(c.repo_id)}- meta={`${isMlxId(c.repo_id) ? "MLX" : "Safetensors"} · ${formatBytes(+ meta={`${isMlxId(c.repo_id, cachedRepoHasMlxTag(c)) ? "MLX" : "Safetensors"} · ${formatBytes(c.size_bytes,)}`}selected={isSelected}@@ -3785,6 +3786,10 @@ function hubRepoUrl(id: string | null | undefined): string | undefined {: undefined;}+function cachedRepoHasMlxTag(c: CachedModelRepo): boolean {+ return hasMlxCardTag({ tags: c.tags, libraryName: c.library_name });+}+/** MLX runs on Mac only, so callers gate visibility on the host. */function localModelIsMlx(m: LocalModelInfo): boolean {return isMlxId(m.id) || isMlxId(m.display_name) || isMlxId(m.model_id ?? "");@@ -4088,7 +4093,7 @@ export function HubModelPicker({[modelGgufIds, resultGgufIds],);- const resultMlxIds = useMemo(() => {+ const taggedMlxIds = useMemo(() => {const ids = new Set<string>();for (const result of [...results,@@ -4096,12 +4101,7 @@ export function HubModelPicker({...communityQuerySearch.results,...communityBrowse.results,]) {- if (- result.libraryName?.toLowerCase() === "mlx" ||- result.tags?.some((tag) => tag.toLowerCase() === "mlx")- ) {- ids.add(result.id.toLowerCase());- }+ if (hasMlxCardTag(result)) ids.add(result.id.toLowerCase());}return ids;}, [@@ -4757,7 +4757,12 @@ export function HubModelPicker({isCatalogSeed,isHidden: isHiddenModelId(r.id),format: formatFilter,- matchesFormat: matchesFormatFilter(r.id, r.isGguf, formatFilter),+ matchesFormat: matchesFormatFilter(+ r.id,+ r.isGguf,+ formatFilter,+ hasMlxCardTag(r),+ ),matchesTask: chatSupportedCheckpointQuant(r),isRecommendable:isRecommendableFormat(r.id, r.isGguf, isMac) ||@@ -4994,7 +4999,7 @@ export function HubModelPicker({r.totalParams? formatCompact(r.totalParams): extractParamLabel(r.id),- isMlxId(r.id) ? "MLX" : "Safetensors",+ isMlxId(r.id, hasMlxCardTag(r)) ? "MLX" : "Safetensors",r.estimatedSizeBytes ? formatBytes(r.estimatedSizeBytes) : null,].filter(Boolean)@@ -5633,14 +5638,18 @@ export function HubModelPicker({);}, [sortedCachedGguf, showHfSection, debouncedQuery, formatFilter]);const visibleCachedModels = useMemo(() => {- if (!showHfSection)- return sortedCachedModels.filter((c) =>- matchesFormatFilter(c.repo_id, false, formatFilter),+ const matches = (c: CachedModelRepo) =>+ matchesFormatFilter(+ c.repo_id,+ false,+ formatFilter,+ cachedRepoHasMlxTag(c),);+ if (!showHfSection) return sortedCachedModels.filter(matches);const q = normalizeForSearch(debouncedQuery.trim());return sortedCachedModels.filter((c) =>- matchesFormatFilter(c.repo_id, false, formatFilter) &&+ matches(c) &&normalizeForSearch(c.repo_id).includes(q),);}, [sortedCachedModels, showHfSection, debouncedQuery, formatFilter]);@@ -6158,7 +6167,12 @@ export function HubModelPicker({),).filter((id) =>- matchesFormatFilter(id, isKnownGgufRepo(id), formatFilter),+ matchesFormatFilter(+ id,+ isKnownGgufRepo(id),+ formatFilter,+ taggedMlxIds.has(id.toLowerCase()),+ ),)// Curated defaults obey the fit toggle too..filter(@@ -6186,6 +6200,7 @@ export function HubModelPicker({curatedRow,formatFilter,isKnownGgufRepo,+ taggedMlxIds,fitOnDeviceOnly,cachedIdFor,searchRowFits,@@ -6231,7 +6246,12 @@ export function HubModelPicker({runsCheckpointQuant({ id }) || !/-FP8[-.]|FP8-Dynamic/i.test(id),).filter((id) =>- matchesFormatFilter(id, isKnownGgufRepo(id), formatFilter),+ matchesFormatFilter(+ id,+ isKnownGgufRepo(id),+ formatFilter,+ taggedMlxIds.has(id.toLowerCase()),+ ),),[recommendedSet,@@ -6240,6 +6260,7 @@ export function HubModelPicker({chatSupportedCheckpointQuant,isTaskRuntimeSupported,formatFilter,+ taggedMlxIds,fitOnDeviceOnly,cachedIdFor,searchRowFits,@@ -6777,7 +6798,7 @@ export function HubModelPicker({pipelineTag: pipelineTagById.get(id) ?? null,});};- if (!resultMlxIds.has(key) || isHuggingFaceOffline()) {+ if (!isMlxId(id, taggedMlxIds.has(key)) || isHuggingFaceOffline()) {select();return;}@@ -6796,7 +6817,7 @@ export function HubModelPicker({onSelect,isKnownGgufRepo,mlxVariantRepoIds,- resultMlxIds,+ taggedMlxIds,hfToken,cachedIdFor,pipelineTagById,@@ -8903,7 +8924,12 @@ export function HubModelPicker({: [metricsById.get(id) ??extractParamLabel(id),- isMlxId(id) ? "MLX" : "Safetensors",+ isMlxId(+ id,+ taggedMlxIds.has(id.toLowerCase()),+ )+ ? "MLX"+ : "Safetensors",].filter(Boolean).join(" · ")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 91277af3fa9..340f17322f0 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@@ -14,30 +14,23 @@ import {audioCppDisplayName,isAudioCppFolderId,} from "../../../audio/audio-cpp-catalog.ts";-import { matchesRecommended } from "../../../hub/lib/format-filters.ts";+import {+ isMlxId,+ matchesRecommended,+} from "../../../hub/lib/format-filters.ts";import {classifyMediaGgufFit,type curatedArtifactFit,} from "./model-catalog.ts";+export { hasMlxCardTag, isMlxId } from "../../../hub/lib/format-filters.ts";+const GGUF_SUFFIX_RE = /-GGUF(?:$|-)/i;-// Mirrors the backend's _looks_like_mlx_repo.-const MLX_RE = /(?:^|[-_.])mlx(?:$|[-_.])/i;-const MLX_OWNER_PREFIX = "mlx-community/";-// Callers pass a filesystem path, which may be Windows.-const PATH_SEP_RE = /[\\/]/;export function isGgufId(id: string, hintedIsGguf?: boolean): boolean {return Boolean(hintedIsGguf) || GGUF_SUFFIX_RE.test(id);}-export function isMlxId(id: string): boolean {- const trimmed = id.trim();- if (trimmed.toLowerCase().startsWith(MLX_OWNER_PREFIX)) return true;- const leaf = trimmed.split(PATH_SEP_RE).filter(Boolean).at(-1) ?? trimmed;- return MLX_RE.test(leaf);-}-const MOBILE_RE = /(?:^|[-_/. ])mobile(?:$|[-_/. ])/i;export function isMobileVariant(id: string): boolean {@@ -77,14 +70,18 @@ export function matchesFormatFilter(id: string,hintedIsGguf: boolean | undefined,filter: FormatFilter,+ hintedIsMlx?: boolean,): boolean {+ const gguf = isGgufId(id, hintedIsGguf);+ // GGUF repos often carry an mlx tag too; the tag never outranks GGUF.+ const mlx = isMlxId(id, hintedIsMlx && !gguf);switch (filter) {case "gguf":- return isGgufId(id, hintedIsGguf);+ return gguf;case "mlx":- return isMlxId(id);+ return mlx;case "safetensors":- return !isGgufId(id, hintedIsGguf) && !isMlxId(id);+ return !gguf && !mlx;case "npu":return false;default:diff --git a/studio/frontend/tests/hub-on-device-filters.test.ts b/studio/frontend/tests/hub-on-device-filters.test.tsindex 88b0dec21a6..e2961195e8f 100644--- a/studio/frontend/tests/hub-on-device-filters.test.ts+++ b/studio/frontend/tests/hub-on-device-filters.test.ts@@ -110,7 +110,17 @@ test("Size sorts local folders by their scanned size, and Format follows the for"../src/features/hub/catalog/inventory-sort.ts");const local = (modelFormat: string, extra: object = {}) =>- ({ variant: "local", row: { modelFormat, source: "custom", ...extra } }) as never;+ ({+ variant: "local",+ row: {+ kind: "local",+ modelFormat,+ source: "custom",+ path: "/m/model",+ title: "model",+ ...extra,+ },+ }) as never;assert.equal(inventoryItemSize(local("gguf", { bytes: 5_000 })), 5_000);assert.equal(inventoryItemSize(local("gguf")), 0);const ranks = [@@ -131,12 +141,26 @@ test("the MLX format finds MLX folders, which the scan reports as safetensors","../src/features/hub/catalog/inventory-sort.ts");const row = (extra: object) =>- ({ kind: "local", modelFormat: "safetensors", source: "custom", ...extra }) as never;+ ({+ kind: "local",+ modelFormat: "safetensors",+ source: "custom",+ path: "/models/Qwen3-8B",+ title: "Qwen3-8B",+ ...extra,+ }) as never;const mlxByLibrary = row({ libraryName: "MLX" });const mlxByTag = row({ tags: ["mlx"] });const omlx = row({ source: "omlx" });+ const mlxByPath = row({ path: "/models/Qwen3-8B-MLX" });+ const mlxByRepo = {+ kind: "cache",+ modelFormat: "safetensors",+ repoId: "mlx-community/Qwen3-8B-4bit",+ repo: "Qwen3-8B-4bit",+ } as never;const plain = row({});- for (const mlx of [mlxByLibrary, mlxByTag, omlx]) {+ for (const mlx of [mlxByLibrary, mlxByTag, omlx, mlxByPath, mlxByRepo]) {assert.equal(matchesFormat(inventoryRowFormat(mlx), "mlx"), true);assert.equal(matchesFormat(inventoryRowFormat(mlx), "checkpoint"), false);}diff --git a/studio/frontend/tests/mlx-community-repo-detection.test.ts b/studio/frontend/tests/mlx-community-repo-detection.test.tsindex c959b878fe1..3a3b665f4c3 100644--- a/studio/frontend/tests/mlx-community-repo-detection.test.ts+++ b/studio/frontend/tests/mlx-community-repo-detection.test.ts@@ -4,10 +4,13 @@import assert from "node:assert/strict";import test from "node:test";+import { detectResultFormat } from "../src/features/hub/lib/format-filters.ts";import {+ hasMlxCardTag,isMlxId,matchesFormatFilter,} from "../src/features/model-picker/components/model-selector/recommended-fit.ts";+import { readSrc } from "./helpers/kit.ts";const COMMUNITY = "mlx-community/Qwen3-8B-4bit";@@ -58,3 +61,65 @@ test("a plain safetensors repo still answers the safetensors filter", () => {true,);});++test("a model-card mlx tag or library marks a repo whose name does not", () => {+ const unnamed = "FluidVoice-Labs/Qwen3.5-9B-4bit";+ assert.equal(hasMlxCardTag({ tags: ["safetensors", "MLX"] }), true);+ assert.equal(hasMlxCardTag({ libraryName: "MLX" }), true);+ assert.equal(+ hasMlxCardTag({ tags: ["safetensors"], libraryName: "transformers" }),+ false,+ );+ assert.equal(matchesFormatFilter(unnamed, false, "mlx", true), true);+ assert.equal(matchesFormatFilter(unnamed, false, "safetensors", true), false);+ assert.equal(matchesFormatFilter(unnamed, false, "mlx", false), false);+ const taggedGguf = "org/Model-GGUF";+ assert.equal(matchesFormatFilter(taggedGguf, true, "mlx", true), false);+ assert.equal(matchesFormatFilter(taggedGguf, true, "gguf", true), true);+});++test("Hub search rows are MLX by name or by model-card tag", () => {+ const row = (id: string, tags: string[], libraryName?: string) =>+ detectResultFormat({ id, isGguf: false, tags, libraryName });+ assert.equal(+ row("unsloth/gemma-4-E2B-it-UD-MLX-4bit", ["safetensors"]),+ "mlx",+ );+ assert.equal(row("FluidVoice-Labs/Qwen3.5-9B-4bit", ["mlx"]), "mlx");+ assert.equal(row("org/Qwen3-8B", [], "mlx"), "mlx");+ assert.equal(+ row("Qwen/Qwen3-8B", ["safetensors"], "transformers"),+ "safetensors",+ );+ assert.equal(+ detectResultFormat({+ id: "org/Model-MLX-GGUF",+ isGguf: true,+ tags: ["mlx"],+ }),+ "gguf",+ );+});++test("the picker and Hub inspector pass model-card tags to the shared rule", () => {+ const picker = readSrc(+ "features/model-picker/components/model-selector/pickers.tsx",+ );+ assert.match(+ picker,+ /r\.isGguf,\s*formatFilter,\s*hasMlxCardTag\(r\),?\s*\)/,+ );+ assert.match(picker, /isMlxId\(r\.id, hasMlxCardTag\(r\)\)/);+ assert.match(picker, /isMlxId\(c\.repo_id, cachedRepoHasMlxTag\(c\)\)/);+ assert.match(picker, /formatFilter,\s*cachedRepoHasMlxTag\(c\),?\s*\)/);+ assert.match(picker, /isMlxId\(id, taggedMlxIds\.has\(key\)\)/);+ const idOnlyFilters = picker.match(+ /isKnownGgufRepo\(id\),\s*formatFilter,\s*taggedMlxIds\.has\(id\.toLowerCase\(\)\),/g,+ );+ assert.equal(idOnlyFilters?.length, 2);+ const inspector = readSrc("features/hub/catalog/model-inspector.tsx");+ assert.match(+ inspector,+ /isMlxId\(model\.hubRepoId \?\? "", hasMlxCardTag\(model\)\)/,+ );+});