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: show downloaded status in GGUF variant list, sort downloaded first

Daniel Han4d35699c658e
diff --git a/studio/backend/models/models.py b/studio/backend/models/models.py
index 6634f693851..3f1ba70e3ed 100644
--- a/studio/backend/models/models.py
+++ b/studio/backend/models/models.py
@@ -129,6 +129,7 @@ class GgufVariantDetail(BaseModel):
)
quant: str = Field(..., description = "Quantization label (e.g., 'Q4_K_M')")
size_bytes: int = Field(0, description = "File size in bytes")
+ downloaded: bool = Field(False, description = "Whether this variant is already in the local HF cache")
class GgufVariantsResponse(BaseModel):
diff --git a/studio/backend/routes/models.py b/studio/backend/routes/models.py
index 14cff0d2d23..8be847976f4 100644
--- a/studio/backend/routes/models.py
+++ b/studio/backend/routes/models.py
@@ -555,6 +555,21 @@ async def get_gguf_variants(
best = _pick_best_gguf(filenames)
default_variant = _extract_quant_label(best) if best else None
+ # Check which variants are already downloaded in the HF cache
+ cached_files: set = set()
+ try:
+ from huggingface_hub import constants as hf_constants
+
+ cache_dir = Path(hf_constants.HF_HUB_CACHE)
+ repo_dir = cache_dir / f"models--{repo_id.replace('/', '--')}"
+ snapshots = repo_dir / "snapshots"
+ if snapshots.is_dir():
+ for snap in snapshots.iterdir():
+ for f in snap.rglob("*.gguf"):
+ cached_files.add(f.name)
+ except Exception:
+ pass
+
return GgufVariantsResponse(
repo_id = repo_id,
variants = [
@@ -562,6 +577,7 @@ async def get_gguf_variants(
filename = v.filename,
quant = v.quant,
size_bytes = v.size_bytes,
+ downloaded = v.filename in cached_files,
)
for v in variants
],
diff --git a/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsx b/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsx
index 54ccd18d3b2..1df2c898088 100644
--- a/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsx
+++ b/studio/frontend/src/components/assistant-ui/model-selector/pickers.tsx
@@ -231,10 +231,12 @@ function GgufVariantExpander({
const sortedVariants = useMemo(() => {
if (!variants) return variants;
- // Tier: 0 = fits (GPU only), 1 = tight (needs CPU offload), 2 = OOM
+ // Tier: 0 = downloaded+fits, 1 = downloaded+tight, 2 = fits, 3 = tight, 4 = OOM
const tierOf = (v: GgufVariantDetail) => {
const f = getGgufFit(v.size_bytes);
- return f === "fits" ? 0 : f === "tight" ? 1 : 2;
+ if (f === "oom") return 4;
+ const base = f === "fits" ? 0 : 1;
+ return v.downloaded ? base : base + 2;
};
return [...variants].sort((a, b) => {
const aIsRec = a.quant === effectiveRecommended;
@@ -246,7 +248,7 @@ function GgufVariantExpander({
if (aTier !== bTier) return aTier - bTier;
// fits/tight: largest first (best quality); OOM: smallest first
- return aTier === 2 ? a.size_bytes - b.size_bytes : b.size_bytes - a.size_bytes;
+ return aTier === 4 ? a.size_bytes - b.size_bytes : b.size_bytes - a.size_bytes;
});
}, [variants, effectiveRecommended, getGgufFit]);
@@ -303,6 +305,11 @@ function GgufVariantExpander({
recommended
</span>
)}
+ {v.downloaded && (
+ <span className="ml-1.5 text-[9px] font-sans font-medium text-green-400">
+ downloaded
+ </span>
+ )}
</span>
<span className="flex items-center gap-1.5 shrink-0">
{oom && (
diff --git a/studio/frontend/src/features/chat/types/api.ts b/studio/frontend/src/features/chat/types/api.ts
index 33ea9984ede..4046deb4c20 100644
--- a/studio/frontend/src/features/chat/types/api.ts
+++ b/studio/frontend/src/features/chat/types/api.ts
@@ -55,6 +55,7 @@ export interface GgufVariantDetail {
filename: string;
quant: string;
size_bytes: number;
+ downloaded?: boolean;
}
export interface GgufVariantsResponse {