Skip to content

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.

Studio: list the unsloth mirrors for curated BF16 image pipelines (#11657)

Michael Han54964b164b88
diff --git a/studio/backend/core/inference/diffusion_families.py b/studio/backend/core/inference/diffusion_families.py
index fb7b815bc65..bd3ff98f0ad 100644
--- a/studio/backend/core/inference/diffusion_families.py
+++ b/studio/backend/core/inference/diffusion_families.py
@@ -1088,6 +1088,8 @@ def prefer_ungated_mirror(
Declines to today's behaviour under ``UNSLOTH_DIFFUSION_NO_MIRROR``, for a local path, or when
the upstream already satisfies the load from cache and switching would re-pull tens of GiB.
+ Under that opt-out a mirror id picked directly maps back to its upstream, cached or not: even
+ a cached mirror is listed on the Hub before it loads.
``files`` sharpens that last test to the names about to be fetched; without it any weight
counts.
@@ -1097,8 +1099,10 @@ def prefer_ungated_mirror(
is unused, kept so callers need not care.
"""
del hf_token # noqa: F841 -- signature stability only
+ if os.environ.get("UNSLOTH_DIFFUSION_NO_MIRROR", "").strip():
+ return base if _is_local_path(base) else canonical_base(base)
mirror = mirror_repo(base)
- if not mirror or os.environ.get("UNSLOTH_DIFFUSION_NO_MIRROR", "").strip():
+ if not mirror:
return base
# a local path is never a Hub id: rewriting one sends loads the other sites resolve on disk to the Hub, skipping
# the copy already downloaded
diff --git a/studio/backend/tests/test_diffusion_backend.py b/studio/backend/tests/test_diffusion_backend.py
index 9f4c3c21f3e..81e1266c0a6 100644
--- a/studio/backend/tests/test_diffusion_backend.py
+++ b/studio/backend/tests/test_diffusion_backend.py
@@ -323,6 +323,22 @@ def test_prefer_ungated_mirror_declines(monkeypatch):
assert prefer_ungated_mirror(gated) == gated
+def test_the_opt_out_maps_a_direct_mirror_pick_back_to_its_upstream(monkeypatch):
+ """The picker lists mirror ids, so the opt-out must also undo a mirror picked directly."""
+ mirror, upstream = "unsloth/FLUX.1-dev", "black-forest-labs/FLUX.1-dev"
+ _no_cache(monkeypatch)
+ monkeypatch.setenv("UNSLOTH_DIFFUSION_NO_MIRROR", "1")
+ assert prefer_ungated_mirror(mirror) == upstream
+ # Even a cached mirror: the estimator lists it on the Hub before loading.
+ _all_cached(monkeypatch)
+ monkeypatch.setenv("UNSLOTH_DIFFUSION_NO_MIRROR", "1")
+ for files in (None, [], ["model_index.json"], ["vae/diffusion_pytorch_model.safetensors"]):
+ assert prefer_ungated_mirror(mirror, files = files) == upstream
+ # Without the opt-out a mirror pick is fetched as is.
+ _no_cache(monkeypatch)
+ assert prefer_ungated_mirror(mirror) == mirror
+
+
def test_a_local_base_directory_is_never_mirrored(monkeypatch, tmp_path):
"""A path that exists on disk is not a Hub id, so it must survive the swap untouched.
diff --git a/studio/frontend/src/features/model-picker/components/model-selector.tsx b/studio/frontend/src/features/model-picker/components/model-selector.tsx
index 4eb6575e8d0..561b169afc1 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector.tsx
@@ -55,7 +55,10 @@ import {
missingExternalModel,
} from "./model-selector/missing-external-model";
import type { CommunityModelPolicy } from "./model-selector/audio-picker-policy";
-import type { CatalogGroup } from "./model-selector/model-catalog";
+import {
+ artifactForRepoId,
+ type CatalogGroup,
+} from "./model-selector/model-catalog";
import { HubModelPicker, hasDownloadedModels } from "./model-selector/pickers";
import { PillTabs } from "./model-selector/pill-tabs";
import { loraOptionLabel } from "./model-selector/row-meta";
@@ -746,7 +749,12 @@ export function ModelSelector({
const currentModel = useMemo(() => {
if (!selected) return undefined;
- const found = optionById.get(selected);
+ // A cached vendor copy loads for its unsloth mirror; name it by the mirror's option.
+ const mirrorId =
+ catalog && artifactForRepoId(selected, catalog)?.artifact.repoId;
+ const found =
+ optionById.get(selected) ??
+ (mirrorId ? optionById.get(mirrorId) : undefined);
// A pick whose connection no longer offers it takes its option away and leaves the id in the
// checkpoint, and the generic fallback cannot shorten an `external::` id. Name the model the
// user picked and say why it is unusable, or a tidy name would hide the failure until the
@@ -783,6 +791,7 @@ export function ModelSelector({
}, [
selected,
optionById,
+ catalog,
activeGgufVariant,
externalModels,
externalConnections,
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts
index e0c581b97e1..24f991faba1 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts
+++ b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.check.ts
@@ -226,7 +226,9 @@ for (const id of [
"unsloth/FLUX.1-Kontext-dev-GGUF",
...Object.keys(OLD_SAFETENSORS_MODELS),
]) {
- assert.ok(imageOptionIds.has(id), `image option missing: ${id}`);
+ // A vendor id now resolves to the unsloth mirror that replaced its row.
+ const offered = artifactForRepoId(id, IMAGE_CATALOG)?.artifact.repoId ?? id;
+ assert.ok(imageOptionIds.has(offered), `image option missing: ${id}`);
}
const videoOptionIds = new Set(catalogToModelOptions(VIDEO_CATALOG).map((o) => o.id));
for (const id of [
@@ -408,7 +410,7 @@ for (const id of [
// per-card kernel probe; `resolved` reports that after the load. Predicting it here would mean
// mirroring the backend selector's inputs, which is unbounded.
{
- const id = "Tongyi-MAI/Z-Image-Turbo";
+ const id = "unsloth/Z-Image-Turbo";
// The chip is the STORED precision, exactly as on a host without the fast path.
assert.deepEqual(curatedRowLabelFor(id, IMAGE_CATALOG, "dense-quant"), {
name: "Z-Image-Turbo (Fast)",
@@ -818,32 +820,21 @@ assert.equal(
.repoId,
"ideogram-ai/ideogram-4-nf4-diffusers",
);
-// A gated BF16 artifact (FLUX.1-dev) is NOT auto-routed when undownloaded even on a big
-// GPU: the download would fail without license/token access.
+// FLUX.1-dev BF16 is the open unsloth mirror, so a big GPU auto-routes to it.
const fluxDevRoute = groupForRepoId("unsloth/FLUX.1-dev", IMAGE_CATALOG);
assert.ok(fluxDevRoute);
assert.equal(
pickDefaultArtifact(fluxDevRoute, { gpuGb: 80, systemRamGb: 128, isDownloaded: notDownloaded })
- .format,
- "gguf",
-);
-// But an already-downloaded gated BF16 (the user clearly has access) is still returned.
-assert.equal(
- pickDefaultArtifact(fluxDevRoute, {
- gpuGb: 80,
- systemRamGb: 128,
- isDownloaded: (id) => id === "black-forest-labs/FLUX.1-dev",
- }).repoId,
- "black-forest-labs/FLUX.1-dev",
+ .repoId,
+ "unsloth/FLUX.1-dev",
);
-// FLUX.1 Krea dev: gated BF16 skipped when undownloaded, so the open QuantStack GGUF wins;
-// its repo id also resolves to the group.
+// FLUX.1 Krea dev: the open mirror wins on a big GPU; the vendor id still resolves to the group.
const kreaDevRoute = groupForRepoId("black-forest-labs/FLUX.1-Krea-dev", IMAGE_CATALOG);
assert.ok(kreaDevRoute);
assert.equal(
pickDefaultArtifact(kreaDevRoute, { gpuGb: 80, systemRamGb: 128, isDownloaded: notDownloaded })
.repoId,
- "QuantStack/FLUX.1-Krea-dev-GGUF",
+ "unsloth/FLUX.1-Krea-dev",
);
assert.equal(
groupForRepoId("QuantStack/FLUX.1-Krea-dev-GGUF", IMAGE_CATALOG),
@@ -855,7 +846,7 @@ assert.ok(lumina);
assert.equal(
pickDefaultArtifact(lumina, { gpuGb: 24, systemRamGb: 64, isDownloaded: notDownloaded })
.repoId,
- "Alpha-VLLM/Lumina-Image-2.0",
+ "unsloth/Lumina-Image-2.0",
);
assert.equal(loadSpecFor("Alpha-VLLM/Lumina-Image-2.0", IMAGE_CATALOG)?.kind, "pipeline");
// HunyuanImage 2.1: the 50 GB bf16 pipeline misses a 24 GB card so a bare click routes to
@@ -886,20 +877,19 @@ assert.equal(groupForRepoId("HiDream-ai/HiDream-I1-Fast", IMAGE_CATALOG), hidrea
assert.equal(
pickDefaultArtifact(hidream, { gpuGb: 141, systemRamGb: 128, isDownloaded: notDownloaded })
.repoId,
- "HiDream-ai/HiDream-I1-Full",
+ "unsloth/HiDream-I1-Full",
);
assert.equal(
catalogGroupFitsDevice(hidream, { gpuGb: 24, systemRamGb: 32 }, notDownloaded),
false,
);
-// FLUX.1-schnell is Apache-2.0 but gated on the Hub, so an undownloaded BF16 is skipped and
-// the open GGUF wins even on a GPU that fits the pipeline.
+// FLUX.1-schnell BF16 is the open unsloth mirror, so a GPU that fits the pipeline takes it.
const fluxSchnellRoute = groupForRepoId("unsloth/FLUX.1-schnell", IMAGE_CATALOG);
assert.ok(fluxSchnellRoute);
assert.equal(
pickDefaultArtifact(fluxSchnellRoute, { gpuGb: 80, systemRamGb: 128, isDownloaded: notDownloaded })
.format,
- "gguf",
+ "bf16",
);
// HunyuanVideo on 80 GB: the highest-quality artifact that FITS (720p, 52 GB <= budget 56) wins.
const hunyuan = groupForRepoId(
@@ -967,7 +957,7 @@ assert.equal(
assert.equal(
pickDefaultArtifact(qwenGroup, { gpuGb: 80, systemRamGb: 128, isDownloaded: notDownloaded })
.repoId,
- "Qwen/Qwen-Image-2512",
+ "unsloth/Qwen-Image-2512",
);
// Z-Image-Turbo BF16 (30 GB) misses 24 GB (bnb-4bit wins) but fits a 48 GB GPU (budget 33.6) and wins.
const zturbo = groupForRepoId("unsloth/Z-Image-Turbo", IMAGE_CATALOG);
@@ -982,22 +972,14 @@ assert.equal(
.format,
"bf16",
);
-// FLUX.1-dev BF16 (32 GB) fits a 48 GB GPU but is GATED, so a bare click routes to the open
-// GGUF unless already downloaded. Small GPU also goes to GGUF.
+// FLUX.1-dev BF16 (32 GB) fits a 48 GB GPU and its mirror is open, so a bare click takes it.
+// Small GPU goes to GGUF.
const fluxDev = groupForRepoId("black-forest-labs/FLUX.1-dev", IMAGE_CATALOG);
assert.ok(fluxDev);
assert.equal(fluxDev.canonicalId, "unsloth/FLUX.1-dev");
assert.equal(
pickDefaultArtifact(fluxDev, { gpuGb: 48, systemRamGb: 64, isDownloaded: notDownloaded })
.format,
- "gguf",
-);
-assert.equal(
- pickDefaultArtifact(fluxDev, {
- gpuGb: 48,
- systemRamGb: 64,
- isDownloaded: (id) => id === "black-forest-labs/FLUX.1-dev",
- }).format,
"bf16",
);
assert.equal(
@@ -1177,7 +1159,7 @@ for (const catalog of [IMAGE_CATALOG, VIDEO_CATALOG, AUDIO_CATALOG]) {
}
// Z-Image-Turbo needs 42.9 GB of card dense and 34.9 GB pre-quantised under the 70% rule.
-const zTurboId = "Tongyi-MAI/Z-Image-Turbo";
+const zTurboId = "unsloth/Z-Image-Turbo";
assert.equal(
curatedArtifactFitsDevice(zTurboId, IMAGE_CATALOG, { gpuGb: 40, systemRamGb: 128 }),
false,
@@ -1237,7 +1219,7 @@ assert.equal(
denseQuantSchemes: ["int8", "fp8"],
isDownloaded: notDownloaded,
}).repoId,
- "Qwen/Qwen-Image",
+ "unsloth/Qwen-Image",
);
// A ladder no rung of which fits is still refused, and still routes to the bnb row.
assert.equal(
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts
index 16eff92454b..4f725af49a6 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts
+++ b/studio/frontend/src/features/model-picker/components/model-selector/model-catalog.ts
@@ -31,6 +31,8 @@ export type LoadKind = "gguf" | "single_file" | "pipeline";
export interface ModelArtifact {
/** Exact artifact repo id (the pre-grouping id, stays loadable/searchable). */
repoId: string;
+ /** Vendor repo this unsloth mirror copies byte for byte; its id (a cached copy) resolves here too. */
+ upstreamRepoId?: string;
format: ArtifactFormat;
loadKind: LoadKind;
/** single_file loads name their exact checkpoint inside the repo. */
@@ -134,6 +136,17 @@ const bf16Pipeline = (
...extra,
});
+// The unsloth mirror of a vendor bf16 pipeline, identical files, so it replaces the vendor row.
+const bf16Mirror = (
+ upstreamRepoId: string,
+ approxSizeGb?: number,
+ extra?: Partial<ModelArtifact>,
+): ModelArtifact =>
+ bf16Pipeline(`unsloth/${upstreamRepoId.split("/")[1]}`, approxSizeGb, {
+ upstreamRepoId,
+ ...extra,
+ });
+
// A bf16 single-file DiT checkpoint: from_single_file against the family base repo for the VAE /
// text encoder, like the fp8 single-file checkpoints.
const bf16Single = (
@@ -163,7 +176,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
description: "Text-to-image",
scope: "image",
artifacts: [
- bf16Pipeline("Tongyi-MAI/Z-Image-Turbo", 30, {
+ bf16Mirror("Tongyi-MAI/Z-Image-Turbo", 30, {
totalParams: 6154908736,
prequantRepo: "unsloth/Z-Image-Turbo-FP8",
prequantSizeGb: { fp8: 5.86, int8: 5.86 },
@@ -206,7 +219,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
// artifact row here, so alias it to keep a pasted id finding it.
aliases: ["unsloth/Qwen-Image-2512-FP8"],
artifacts: [
- bf16Pipeline("Qwen/Qwen-Image-2512", 54, {
+ bf16Mirror("Qwen/Qwen-Image-2512", 54, {
totalParams: 20430401088,
prequantRepo: "unsloth/Qwen-Image-2512-FP8",
prequantSizeGb: { fp8: 19.06, int8: 25.4 },
@@ -223,7 +236,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
description: "Text-to-image",
scope: "image",
artifacts: [
- bf16Pipeline("Qwen/Qwen-Image", 54, {
+ bf16Mirror("Qwen/Qwen-Image", 54, {
totalParams: 20430401088,
prequantRepo: "unsloth/Qwen-Image-FP8",
prequantSizeGb: { fp8: 19.06, int8: 31.73 },
@@ -237,10 +250,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
description: "Text-to-image",
scope: "image",
artifacts: [
- // Apache-2.0 but still gated on the Hub (gated: "auto", a contact-info form), so an anonymous
- // download 401s exactly like dev. The licence and the gate are independent.
- bf16Pipeline("black-forest-labs/FLUX.1-schnell", 32, {
- gated: true,
+ bf16Mirror("black-forest-labs/FLUX.1-schnell", 32, {
totalParams: 11891178560,
prequantRepo: "unsloth/FLUX.1-schnell-FP8",
prequantSizeGb: { fp8: 11.09, int8: 14.13 },
@@ -254,20 +264,19 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
description: "Text-to-image",
scope: "image",
artifacts: [
- // FLUX.1-dev is gated (license acceptance + token), like FLUX.1-schnell above.
- bf16Pipeline("black-forest-labs/FLUX.1-dev", 32, { gated: true, totalParams: 11901408320 }),
+ bf16Mirror("black-forest-labs/FLUX.1-dev", 32, { totalParams: 11901408320 }),
gguf("unsloth/FLUX.1-dev-GGUF"),
],
},
{
// Krea guidance-distilled FLUX.1-dev finetune: same arch/layout as dev, so it runs under the
- // flux.1 family. The base repo is gated like dev; QuantStack publishes the open GGUF quants.
+ // flux.1 family. QuantStack publishes the open GGUF quants.
canonicalId: "black-forest-labs/FLUX.1-Krea-dev",
displayName: "FLUX.1 Krea dev",
description: "Text-to-image",
scope: "image",
artifacts: [
- bf16Pipeline("black-forest-labs/FLUX.1-Krea-dev", 32, { gated: true, totalParams: 11901408320 }),
+ bf16Mirror("black-forest-labs/FLUX.1-Krea-dev", 32, { totalParams: 11901408320 }),
gguf("QuantStack/FLUX.1-Krea-dev-GGUF"),
],
},
@@ -291,7 +300,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
description: "Image editing",
scope: "image",
artifacts: [
- bf16Pipeline("Qwen/Qwen-Image-Edit-2511", 54, { totalParams: 20430401088 }),
+ bf16Mirror("Qwen/Qwen-Image-Edit-2511", 54, { totalParams: 20430401088 }),
gguf("unsloth/Qwen-Image-Edit-2511-GGUF"),
],
},
@@ -301,8 +310,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
description: "Image editing",
scope: "image",
artifacts: [
- // FLUX.1-Kontext-dev is gated on the Hub (license acceptance + token).
- bf16Pipeline("black-forest-labs/FLUX.1-Kontext-dev", 32, { gated: true, totalParams: 11901408320 }),
+ bf16Mirror("black-forest-labs/FLUX.1-Kontext-dev", 32, { totalParams: 11901408320 }),
gguf("unsloth/FLUX.1-Kontext-dev-GGUF"),
],
},
@@ -311,11 +319,8 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
displayName: "Krea 2 Turbo",
description: "Text-to-image",
scope: "image",
- // Gated on the Hub, and the group's only artifact, so a bare click has nothing open to fall
- // through to: the picker must show the gate rather than start a download that 401s.
artifacts: [
- bf16Pipeline("krea/Krea-2-Turbo", 18, {
- gated: true,
+ bf16Mirror("krea/Krea-2-Turbo", 18, {
totalParams: 12820073036,
prequantRepo: "unsloth/Krea-2-Turbo-FP8",
prequantSizeGb: { fp8: 11.95, int8: 12.19 },
@@ -329,7 +334,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
displayName: "Lumina Image 2.0",
description: "Text-to-image",
scope: "image",
- artifacts: [bf16Pipeline("Alpha-VLLM/Lumina-Image-2.0", 11, { totalParams: 2609769152 })],
+ artifacts: [bf16Mirror("Alpha-VLLM/Lumina-Image-2.0", 11, { totalParams: 2609769152 })],
},
{
// 17B dual-stream 2K-native DiT with a Qwen2.5-VL encoder; the mirror's guider components load
@@ -355,13 +360,13 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
description: "Text-to-image",
scope: "image",
artifacts: [
- bf16Pipeline("HiDream-ai/HiDream-I1-Full", 63, { totalParams: 17105733184 }),
- bf16Pipeline("HiDream-ai/HiDream-I1-Dev", 63, {
+ bf16Mirror("HiDream-ai/HiDream-I1-Full", 63, { totalParams: 17105733184 }),
+ bf16Mirror("HiDream-ai/HiDream-I1-Dev", 63, {
label: "BF16 - Dev (distilled)",
keywords: ["bf16", "dev", "distilled"],
totalParams: 17105733184,
}),
- bf16Pipeline("HiDream-ai/HiDream-I1-Fast", 63, {
+ bf16Mirror("HiDream-ai/HiDream-I1-Fast", 63, {
label: "BF16 - Fast (distilled)",
keywords: ["bf16", "fast", "distilled"],
totalParams: 17105733184,
@@ -389,7 +394,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
scope: "image",
artifacts: [
// SDXL uses a UNet rather than a transformer.
- bf16Pipeline("stabilityai/sdxl-turbo", 8, {
+ bf16Mirror("stabilityai/sdxl-turbo", 8, {
label: "Safetensors",
totalParams: 2567463684,
denseQuantable: false,
@@ -403,7 +408,7 @@ export const IMAGE_CATALOG: CatalogGroup[] = [
scope: "image",
artifacts: [
// SDXL uses a UNet rather than a transformer.
- bf16Pipeline("stabilityai/stable-diffusion-xl-base-1.0", 8, {
+ bf16Mirror("stabilityai/stable-diffusion-xl-base-1.0", 8, {
label: "Safetensors",
totalParams: 2567463684,
denseQuantable: false,
@@ -784,9 +789,12 @@ function indexFor(catalog: CatalogGroup[]): CatalogIndex {
byKey.set(canonicalKeyFor(alias), group);
}
for (const artifact of group.artifacts) {
- byId.set(artifact.repoId.toLowerCase(), group);
- byKey.set(canonicalKeyFor(artifact.repoId), group);
- artifactById.set(artifact.repoId.toLowerCase(), artifact);
+ for (const id of [artifact.repoId, artifact.upstreamRepoId]) {
+ if (!id) continue;
+ byId.set(id.toLowerCase(), group);
+ byKey.set(canonicalKeyFor(id), group);
+ artifactById.set(id.toLowerCase(), artifact);
+ }
}
}
const built = { byId, byKey, artifactById };
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.tsx
index e5e1c051a9b..b5167669a7f 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
@@ -895,8 +895,13 @@ function isRuntimeLoadedModel(
activeGgufVariant: string | null | undefined,
modelId: string,
variantPolicy: "none" | "required" | "ignore",
+ aliasIds: readonly string[] = [],
): boolean {
- if (!modelIdsMatchForPicker(loadedModelId, modelId)) return false;
+ if (
+ !modelIdsMatchForPicker(loadedModelId, modelId) &&
+ !aliasIds.some((id) => modelIdsMatchForPicker(loadedModelId, id))
+ )
+ return false;
if (variantPolicy === "ignore") return true;
const hasActiveGgufVariant = !ggufVariantsMatchForPicker(
activeGgufVariant,
@@ -3243,6 +3248,30 @@ export function HubModelPicker({
),
[cachedGguf, cachedModels],
);
+ // Ids for the same files: the row, its unsloth mirror and the vendor repo the mirror copies.
+ // A copy cached under one loads for the others, so rows match all of them.
+ const aliasesOf = useCallback(
+ (id: string): string[] => {
+ const artifact = catalog && artifactForRepoId(id, catalog)?.artifact;
+ return artifact?.upstreamRepoId
+ ? [id, artifact.repoId, artifact.upstreamRepoId]
+ : [id];
+ },
+ [catalog],
+ );
+ const isValueRow = useCallback(
+ (id: string) =>
+ value === id ||
+ aliasesOf(id).some((alias) => modelIdsMatchForPicker(value, alias)),
+ [value, aliasesOf],
+ );
+ // The id on disk for a row: itself, else a cached alias.
+ const cachedIdFor = useCallback(
+ (id: string): string | null =>
+ aliasesOf(id).find((alias) => downloadedSet.has(alias.toLowerCase())) ??
+ null,
+ [aliasesOf, downloadedSet],
+ );
// The torn ones, kept apart so a Hub row can mark a partial rather than show it as complete
// or as absent. Same split, and the same helper, the Hub page uses. One repo id can hold both a
@@ -3253,6 +3282,12 @@ export function HubModelPicker({
partialSetFromRows([...cachedGguf, ...cachedModels], (c) => c.repo_id),
[cachedGguf, cachedModels],
);
+ // A complete alias loads instead, so the row is downloaded, not partial.
+ const isPartialRow = useCallback(
+ (id: string) =>
+ cachedIdFor(id) === null && partialSet.has(id.toLowerCase()),
+ [cachedIdFor, partialSet],
+ );
// Which of those continue byte for byte, so a Hub row's mark promises what the On Device row's
// does. An id partialSet dropped never draws the mark, so a spare entry here costs nothing.
@@ -3516,7 +3551,7 @@ export function HubModelPicker({
const pipelineBudget = artifactBudget(rowGpu);
const fits = (r: HfModelResult) =>
// Downloaded models show regardless of fit.
- downloadedSet.has(r.id.toLowerCase()) ||
+ cachedIdFor(r.id) !== null ||
// The catalog's own verdict where it has one, so this list and the OOM badge cannot disagree:
// hfModelFitsDevice counts RAM toward a load that never leaves the card.
(catalogFit(r.id, pipelineBudget)?.fits ??
@@ -3544,6 +3579,12 @@ export function HubModelPicker({
// Appended below everything unsloth publishes, so scrolling past the unsloth uploads continues
// into the wider Hub. Same keep/fits gates.
const above = new Set(unslothRows.map((r) => r.id.toLowerCase()));
+ // A vendor repo whose unsloth mirror is listed above is the same files.
+ for (const r of unslothRows) {
+ const upstream =
+ catalog && artifactForRepoId(r.id, catalog)?.artifact.upstreamRepoId;
+ if (upstream) above.add(upstream.toLowerCase());
+ }
const communityRows = communityBrowse.results
.filter((r) => !r.id.toLowerCase().startsWith("unsloth/"))
.filter((r) => isLoadableCommunityRepo(r.id))
@@ -3556,7 +3597,7 @@ export function HubModelPicker({
diffusionLoad,
recommendedSearch.results,
catalogSeedRows,
- downloadedSet,
+ cachedIdFor,
fitOnDeviceOnly,
formatFilter,
isMac,
@@ -4661,7 +4702,10 @@ export function HubModelPicker({
// Seeds included: recommendedIds hides downloaded models, which the unfiltered Recommended
// list still paints, so without them a curated pick vanishes from search once on disk.
searchableRecommendedIds(catalogSeedIds, recommendedIds)
- .filter((id) => normalizeForSearch(id).includes(q))
+ // A mirror row also answers to its vendor id.
+ .filter((id) =>
+ aliasesOf(id).some((alias) => normalizeForSearch(alias).includes(q)),
+ )
.filter((id) =>
matchesFormatFilter(id, isKnownGgufRepo(id), formatFilter),
)
@@ -4670,7 +4714,7 @@ export function HubModelPicker({
.filter(
(id) =>
!fitOnDeviceOnly ||
- downloadedSet.has(id.toLowerCase()) ||
+ cachedIdFor(id) !== null ||
searchRowFits({ id }),
)
);
@@ -4679,16 +4723,21 @@ export function HubModelPicker({
debouncedQuery,
catalogSeedIds,
recommendedIds,
+ aliasesOf,
formatFilter,
isKnownGgufRepo,
fitOnDeviceOnly,
- downloadedSet,
+ cachedIdFor,
searchRowFits,
]);
+ // Aliases included, so a vendor hit whose mirror row is listed is not shown twice.
const recommendedSet = useMemo(
- () => new Set(filteredRecommendedIds),
- [filteredRecommendedIds],
+ () =>
+ new Set(
+ filteredRecommendedIds.flatMap(aliasesOf).map((id) => id.toLowerCase()),
+ ),
+ [filteredRecommendedIds, aliasesOf],
);
// One pipeline for both listings, so community rows clear the same gates; `owned` is the only difference.
@@ -4700,7 +4749,7 @@ export function HubModelPicker({
.filter(
(r) =>
!fitOnDeviceOnly ||
- downloadedSet.has(r.id.toLowerCase()) ||
+ cachedIdFor(r.id) !== null ||
searchRowFits(r),
)
.map((result) => result.id)
@@ -4709,7 +4758,7 @@ export function HubModelPicker({
// Search reaches the live Hub, so without this a query re-lands the exact curated row the seed
// and Recommended filters just dropped, clickable and still refused at load.
.filter(curatedOfferable)
- .filter((id) => !recommendedSet.has(id))
+ .filter((id) => !recommendedSet.has(id.toLowerCase()))
// Chat-only keeps runnable formats: GGUF anywhere, plus MLX/safetensors on Mac, matching the
// empty Recommended view.
.filter(
@@ -4728,7 +4777,7 @@ export function HubModelPicker({
isTaskRuntimeSupported,
formatFilter,
fitOnDeviceOnly,
- downloadedSet,
+ cachedIdFor,
searchRowFits,
isMac,
curatedOfferable,
@@ -5235,16 +5284,17 @@ export function HubModelPicker({
if (isKnownGgufRepo(id)) {
setExpandedGguf((prev) => (prev === id ? null : id));
} else {
- // Cached repos load now; uncached ones download via the Hub manager.
- onSelect(id, {
+ // Cached repos load now (a cached vendor copy stands in for its mirror); others download.
+ const cached = cachedIdFor(id);
+ onSelect(cached ?? id, {
source: "hub",
isLora: false,
- isDownloaded: downloadedSet.has(id.toLowerCase()),
+ isDownloaded: cached !== null,
pipelineTag: pipelineTagById.get(id) ?? null,
});
}
},
- [onSelect, isKnownGgufRepo, downloadedSet, pipelineTagById],
+ [onSelect, isKnownGgufRepo, cachedIdFor, pipelineTagById],
);
// On Device owns the downloaded and custom-folder models; the Unsloth tab searches the HF
@@ -7169,8 +7219,8 @@ export function HubModelPicker({
// A community row without its owner reads as an unsloth upload, and two
// publishers would collide.
hideOwner={isUnslothOwned(id)}
- downloaded={downloadedSet.has(id.toLowerCase())}
- partial={partialSet.has(id.toLowerCase())}
+ downloaded={cachedIdFor(id) !== null}
+ partial={isPartialRow(id)}
partialResumable={partialResumableSet.has(
id.toLowerCase(),
)}
@@ -7179,16 +7229,17 @@ export function HubModelPicker({
info?.meta ??
(isG ? "GGUF" : extractParamLabel(id))
}
- selected={value === id}
+ selected={isValueRow(id)}
loaded={isRuntimeLoadedModel(
loadedModelId,
activeGgufVariant,
id,
isG ? "required" : "none",
+ aliasesOf(id),
)}
optionProps={hubModelList.getOptionProps(
optionKey,
- value === id,
+ isValueRow(id),
)}
onClick={() => {
if (isG) {
@@ -7279,8 +7330,8 @@ export function HubModelPicker({
hubUrl={hubRepoUrl(id)}
alignMeta="hub"
showSize={hubRowsShowSize}
- downloaded={downloadedSet.has(id.toLowerCase())}
- partial={partialSet.has(id.toLowerCase())}
+ downloaded={cachedIdFor(id) !== null}
+ partial={isPartialRow(id)}
partialResumable={partialResumableSet.has(
id.toLowerCase(),
)}
@@ -7292,16 +7343,17 @@ export function HubModelPicker({
? (recommendedMeta.get(id)?.meta ?? "GGUF")
: (vram?.detail ?? extractParamLabel(id))
}
- selected={value === id}
+ selected={isValueRow(id)}
loaded={isRuntimeLoadedModel(
loadedModelId,
activeGgufVariant,
id,
isKnownGgufRepo(id) ? "required" : "none",
+ aliasesOf(id),
)}
optionProps={hubModelList.getOptionProps(
optionKey,
- value === id,
+ isValueRow(id),
)}
onClick={() => {
if (isKnownGgufRepo(id)) {
@@ -7404,7 +7456,7 @@ export function HubModelPicker({
// Typed results are Hub rows like any other, so a repo left
// half-downloaded is marked here too. Without it the row reads
// as never fetched while the click resumes a download.
- partial={partialSet.has(id.toLowerCase())}
+ partial={isPartialRow(id)}
partialResumable={partialResumableSet.has(
id.toLowerCase(),
)}
@@ -7420,16 +7472,17 @@ export function HubModelPicker({
.filter(Boolean)
.join(" · ")
}
- selected={value === id}
+ selected={isValueRow(id)}
loaded={isRuntimeLoadedModel(
loadedModelId,
activeGgufVariant,
id,
isSearchGguf ? "required" : "none",
+ aliasesOf(id),
)}
optionProps={hubModelList.getOptionProps(
optionKey,
- value === id,
+ isValueRow(id),
)}
onClick={() => {
if (isSearchGguf) {
diff --git a/studio/frontend/tests/dense-quant-prequant-routing.test.ts b/studio/frontend/tests/dense-quant-prequant-routing.test.ts
index ad0f5139d0d..20a3a416825 100644
--- a/studio/frontend/tests/dense-quant-prequant-routing.test.ts
+++ b/studio/frontend/tests/dense-quant-prequant-routing.test.ts
@@ -26,9 +26,10 @@ import {
curatedBudgetText,
} from "../src/features/model-picker/components/model-selector/recommended-fit.ts";
-const Z_TURBO = "Tongyi-MAI/Z-Image-Turbo";
-const QWEN_IMAGE = "Qwen/Qwen-Image";
-const QWEN_2512 = "Qwen/Qwen-Image-2512";
+// The bf16 rows are the unsloth mirrors of the vendor repos.
+const Z_TURBO = "unsloth/Z-Image-Turbo";
+const QWEN_IMAGE = "unsloth/Qwen-Image";
+const QWEN_2512 = "unsloth/Qwen-Image-2512";
const QWEN_21 = "Qwen/Qwen-Image-2.1";
const H3 = "MiniMaxAI/MiniMax-H3";
const notDownloaded = () => false;
diff --git a/studio/frontend/tests/model-picker-partial-downloads.test.ts b/studio/frontend/tests/model-picker-partial-downloads.test.ts
index f8e2ed952dc..33d033ce0f0 100644
--- a/studio/frontend/tests/model-picker-partial-downloads.test.ts
+++ b/studio/frontend/tests/model-picker-partial-downloads.test.ts
@@ -517,9 +517,20 @@ test("a partial never reaches the complete-download lookup", () => {
/\[\.\.\.cachedGguf, \.\.\.cachedModels\]\n\s*\.filter\(\(c\) => !c\.partial\)/,
"both cached lists are filtered before the ids land in the set",
);
- // The search pick still reads that set, which is what makes the guard above load bearing.
- assert.ok(
- PICKERS.includes("isDownloaded: downloadedSet.has(id.toLowerCase()),"),
+ // The search pick still reads that set (through cachedIdFor), which is what makes the guard
+ // above load bearing.
+ assert.ok(PICKERS.includes("isDownloaded: cached !== null,"));
+ const lookup = PICKERS.slice(PICKERS.indexOf("const cachedIdFor = useCallback("));
+ assert.match(
+ lookup.slice(0, lookup.indexOf("[aliasesOf, downloadedSet]")),
+ /aliasesOf\(id\)\.find\(\(alias\) => downloadedSet\.has\(alias\.toLowerCase\(\)\)\)/,
+ "every alias is checked against the complete-download set",
+ );
+ const aliases = PICKERS.slice(PICKERS.indexOf("const aliasesOf = useCallback("));
+ assert.match(
+ aliases.slice(0, aliases.indexOf("[catalog]")),
+ /\[id, artifact\.repoId, artifact\.upstreamRepoId\]/,
+ "a row, its mirror and the vendor repo are all aliases",
);
});
@@ -528,17 +539,23 @@ test("Hub rows can still tell a partial apart from an absent model", () => {
// never fetched, so the mark comes from its own set rather than from the on-disk one.
assert.ok(PICKERS.includes("const partialSet = useMemo("));
assert.equal(
- PICKERS.split("partial={partialSet.has(id.toLowerCase())}").length - 1,
+ PICKERS.split("partial={isPartialRow(id)}").length - 1,
3,
"Recommended, its filtered twin, and the typed search list alike",
);
+ // The mark yields to a complete alias, which is what the click then loads.
+ const partialRow = PICKERS.slice(PICKERS.indexOf("const isPartialRow = useCallback("));
+ assert.match(
+ partialRow.slice(0, partialRow.indexOf("[cachedIdFor, partialSet]")),
+ /cachedIdFor\(id\) === null && partialSet\.has\(id\.toLowerCase\(\)\)/,
+ );
// The typed list is the one that was missed: it renders from searchRowIds, not from the
// curated ids, so a partial reached by typing its name showed nothing at all.
const search = PICKERS.slice(PICKERS.indexOf("searchRowIds.map((id) => {"));
assert.ok(
search
.slice(0, search.indexOf("</ModelRow>") + 1 || 4000)
- .includes("partial={partialSet.has(id.toLowerCase())}"),
+ .includes("partial={isPartialRow(id)}"),
"the live search row marks one too",
);
// A partial must never take the green on-disk dot; ModelRow already yields one to the other.
diff --git a/studio/frontend/tests/recommended-catalog-seeds.test.ts b/studio/frontend/tests/recommended-catalog-seeds.test.ts
index 7766c41fe7a..ccd1f85c2ff 100644
--- a/studio/frontend/tests/recommended-catalog-seeds.test.ts
+++ b/studio/frontend/tests/recommended-catalog-seeds.test.ts
@@ -7,7 +7,10 @@ import test from "node:test";
import {
IMAGE_CATALOG,
VIDEO_CATALOG,
+ artifactForRepoId,
curatedSizeBytesFor,
+ groupForRepoId,
+ loadSpecFor,
} from "../src/features/model-picker/components/model-selector/model-catalog.ts";
import { classifyGgufFit } from "../src/lib/gguf-fit.ts";
import {
@@ -574,6 +577,21 @@ test("with familyOf, unsloth rows lead even when a vendor family trends higher",
);
});
+test("a vendor id resolves to the unsloth mirror that replaced it", () => {
+ for (const [vendor, mirror] of [
+ ["Qwen/Qwen-Image-2512", "unsloth/Qwen-Image-2512"],
+ ["black-forest-labs/FLUX.1-dev", "unsloth/FLUX.1-dev"],
+ ["Tongyi-MAI/Z-Image-Turbo", "unsloth/Z-Image-Turbo"],
+ ]) {
+ const hit = artifactForRepoId(vendor, IMAGE_CATALOG);
+ assert.equal(hit?.artifact.repoId, mirror, vendor);
+ assert.equal(hit?.artifact.gated, undefined, vendor);
+ // A cached vendor copy still loads as a pipeline.
+ assert.equal(loadSpecFor(vendor, IMAGE_CATALOG)?.kind, "pipeline", vendor);
+ assert.equal(groupForRepoId(vendor, IMAGE_CATALOG), groupForRepoId(mirror, IMAGE_CATALOG));
+ }
+});
+
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";