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 Hub: show a running download as Downloading, not as a paused partial (#11797)
Daniel Hanc71427cebb84
diff --git a/studio/frontend/src/features/hub/catalog/dot-tag.tsx b/studio/frontend/src/features/hub/catalog/dot-tag.tsxindex 00341b8674c..2184415ce4c 100644--- a/studio/frontend/src/features/hub/catalog/dot-tag.tsx+++ b/studio/frontend/src/features/hub/catalog/dot-tag.tsx@@ -3,8 +3,12 @@import { cn } from "@/lib/utils";+export const DOWNLOADING_DOT_CLASS =+ "bg-sky-500 dark:bg-sky-400 motion-safe:animate-pulse";+type DotTagTone =| "success"+ | "downloading"| "warning"| "danger"| "gguf"@@ -14,6 +18,7 @@ type DotTagTone =const TONE_CLASS: Record<DotTagTone, string> = {success: "bg-status-success",+ downloading: DOWNLOADING_DOT_CLASS,warning: "bg-status-warning",danger: "bg-status-danger",gguf: "bg-format-gguf",diff --git a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsxindex 5a93a5a210a..b05e35fc923 100644--- a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx@@ -87,6 +87,8 @@ import {activeDownloadState,applyLiveGgufVariantStates,createLiveGgufVariantStatesSelector,+ createScopedLiveGgufFilesSelector,+ isScopedLiveVariant,} from "./gguf-live-variant-states";import {GgufDownloadStatusCard,@@ -510,7 +512,7 @@ const GgufVariantMenuRow = memo(function GgufVariantMenuRow({<TooltipTrigger asChild={true}><span className="inline-flex"><DotTag- tone="warning"+ tone={liveActive ? "downloading" : "warning"}label={liveActive ? "Downloading" : "Partial"}/></span>@@ -660,6 +662,11 @@ export function GgufDownloadCard({const liveVariantStates = useDownloadManagerStore(selectLiveGgufVariantStates,);+ const selectScopedLiveFiles = useMemo(+ () => createScopedLiveGgufFilesSelector(repoId),+ [repoId],+ );+ const scopedLiveFiles = useDownloadManagerStore(selectScopedLiveFiles);const sortedVariants = useMemo(() => {if (!rawSortedVariants) return null;const withLive = applyLiveGgufVariantStates(@@ -762,9 +769,13 @@ export function GgufDownloadCard({? liveVariantStates.get(normalizeGgufVariantIdentity(selectedQuant)): undefined;const selectedPresentation = pendingDrafterPresentation(selected);- const selectedLiveActive = activeDownloadState(selectedLiveState?.state);const downloadingThisVariant =progress !== null && ggufVariantsMatch(progress.variant, selectedQuant);+ // Images/Video stage quants as scoped jobs with no quant-keyed job.+ const selectedScopedLive =+ !downloadingThisVariant && isScopedLiveVariant(selected, scopedLiveFiles);+ const selectedLiveActive =+ activeDownloadState(selectedLiveState?.state) || selectedScopedLive;const ctaDisabled = isLoadingThisModel || !selected;const selectedIsActive =isActive && activeQuant && ggufVariantsMatch(selected?.quant, activeQuant);@@ -818,7 +829,7 @@ export function GgufDownloadCard({? true: downloadingThisVariant? false- : ctaDisabled,+ : ctaDisabled || selectedScopedLive,isPartial: Boolean(selected?.partial),partialTransport: selected?.partial_transport ?? null,partialResumable: selected?.partial_resumable === true,@@ -1050,7 +1061,7 @@ export function GgufDownloadCard({<TooltipTrigger asChild={true}><span className="inline-flex"><DotTag- tone="warning"+ tone={selectedLiveActive ? "downloading" : "warning"}label={selectedLiveActive ? "Downloading" : "Partial"}/></span>@@ -1058,9 +1069,11 @@ export function GgufDownloadCard({<TooltipContent side="top" sideOffset={4}>{/* The badge rides inside the quant trigger, so clickingit opens the menu. Name the button that acts. */}- {selectedLiveActive- ? "Download is running. Use the button on the right to stop it."- : downloadAction.partialHint}+ {selectedScopedLive+ ? "Download is running. Progress is in the downloads panel."+ : selectedLiveActive+ ? "Download is running. Use the button on the right to stop it."+ : downloadAction.partialHint}</TooltipContent></Tooltip>)}@@ -1090,7 +1103,9 @@ export function GgufDownloadCard({<div className="max-h-[calc(344px*var(--ui-space-scale,1))] overflow-y-auto [scrollbar-width:thin]">{variantMenuItems.map((item) => {const liveState = liveVariantStates.get(item.key);- const liveActive = activeDownloadState(liveState?.state);+ const liveActive =+ activeDownloadState(liveState?.state) ||+ isScopedLiveVariant(item, scopedLiveFiles);return (<GgufVariantMenuRowkey={item.filename}@@ -1161,7 +1176,9 @@ export function GgufDownloadCard({type="button"disabled={downloadAction.disabled}onClick={downloadAction.onClick}- aria-label={downloadAction.ariaLabel}+ aria-label={+ selectedScopedLive ? "Downloading" : downloadAction.ariaLabel+ }className={cn("hub-action-btn w-24",ctaDisabled &&@@ -1191,6 +1208,10 @@ export function GgufDownloadCard({<Spinner />Starting…</span>+ ) : selectedScopedLive ? (+ <span className="inline-flex items-center gap-2 text-muted-foreground">+ <Spinner />+ </span>) : (<><HugeiconsIcon icon={Download01Icon} strokeWidth={1.75} />diff --git a/studio/frontend/src/features/hub/catalog/gguf-live-variant-states.ts b/studio/frontend/src/features/hub/catalog/gguf-live-variant-states.tsindex 13a88a97ad5..f0d28dac672 100644--- a/studio/frontend/src/features/hub/catalog/gguf-live-variant-states.ts+++ b/studio/frontend/src/features/hub/catalog/gguf-live-variant-states.ts@@ -72,6 +72,42 @@ export function createLiveGgufVariantStatesSelector(repoId: string): (state: {};}+function scopedFileKey(path: string): string {+ return path.trim().replaceAll("\\", "/").replace(/^\.\//, "").toLowerCase();+}++export function createScopedLiveGgufFilesSelector(repoId: string): (state: {+ jobs: Record<string, ManagedDownload>;+}) => ReadonlySet<string> {+ const repoKey = repoId.trim().toLowerCase();+ let cache: { signature: string; files: ReadonlySet<string> } = {+ signature: "",+ files: new Set(),+ };+ return (state) => {+ const files: string[] = [];+ for (const job of Object.values(state.jobs)) {+ if (job.kind !== "model" || !job.variant?.startsWith("@")) continue;+ if (job.repoId.trim().toLowerCase() !== repoKey) continue;+ if (!activeDownloadState(job.state)) continue;+ for (const file of job.scopedFiles ?? []) files.push(scopedFileKey(file));+ }+ files.sort();+ const signature = files.join("\u0000");+ if (signature === cache.signature) return cache.files;+ cache = { signature, files: new Set(files) };+ return cache.files;+ };+}++export function isScopedLiveVariant(+ variant: Pick<GgufVariantDetail, "filename"> | null | undefined,+ scopedLiveFiles: ReadonlySet<string>,+): boolean {+ if (!variant?.filename || scopedLiveFiles.size === 0) return false;+ return scopedLiveFiles.has(scopedFileKey(variant.filename));+}+export function applyLiveGgufVariantStates(variants: readonly GgufVariantDetail[],liveStates: ReadonlyMap<string, LiveGgufVariantState>,diff --git a/studio/frontend/src/features/hub/catalog/model-card.tsx b/studio/frontend/src/features/hub/catalog/model-card.tsxindex d862a4b2e85..c10754a1e56 100644--- a/studio/frontend/src/features/hub/catalog/model-card.tsx+++ b/studio/frontend/src/features/hub/catalog/model-card.tsx@@ -11,11 +11,15 @@ 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 { formatCompact } from "@/lib/utils";+import { cn, formatCompact } from "@/lib/utils";import { Download01Icon, FavouriteIcon } from "@hugeicons/core-free-icons";import { type CSSProperties, memo, useMemo } from "react";import type { DiscoverRow } from "../types";-import { StatChip, buildRowStatusTooltip } from "./models-catalog-rows";+import {+ DOWNLOADING_DOT_CLASS,+ StatChip,+ buildRowStatusTooltip,+} from "./models-catalog-rows";import { OwnerAvatar, useAvatarImageUrl } from "./owner-avatar";import { AccessGlyphs, CapabilityPill } from "./shared";@@ -251,12 +255,14 @@ export const ModelCard = memo(function ModelCard({);const unsupported = support?.status === "unsupported" && !support?.supportedIn;const partial = row.isAvailableOnDevice && row.isPartialOnDevice;+ const downloading = partial && row.isDownloadingOnDevice === true;const onDevice = row.isAvailableOnDevice && !row.isPartialOnDevice;const topCapability = row.capabilities[0] ?? null;const sizeLabel = formatModelParamLabel(row.repo, row.result.totalParams);const hasSize = sizeLabel !== "N/A";const tip = buildRowStatusTooltip({partialRepoId: partial ? row.result.id : undefined,+ downloading,unsupported,unsupportedReason: support?.reason ?? null,resourceLabel: isDataset ? "dataset" : "model",@@ -305,13 +311,23 @@ export const ModelCard = memo(function ModelCard({gated={row.result.gated}isPrivate={row.result.private}/>- {partial && (+ {partial && !downloading && (<spanrole="img"aria-label="Partial download"className="inline-block size-[calc(5px*var(--ui-space-scale,1))] rounded-full bg-status-warning"/>)}+ {partial && downloading && (+ <span+ role="img"+ aria-label="Downloading"+ className={cn(+ "inline-block size-[calc(5px*var(--ui-space-scale,1))] rounded-full",+ DOWNLOADING_DOT_CLASS,+ )}+ />+ )}{unsupported && (<spanrole="img"diff --git a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsxindex 928b6034851..8905692e7f8 100644--- a/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx+++ b/studio/frontend/src/features/hub/catalog/models-catalog-rows.tsx@@ -53,6 +53,7 @@ import type {DiscoverRow,LocalInventoryRow,} from "../types";+import { DOWNLOADING_DOT_CLASS } from "./dot-tag";import { OwnerAvatar } from "./owner-avatar";import { AccessGlyphs } from "./shared";@@ -303,11 +304,13 @@ function CatalogRow({);}+export { DOWNLOADING_DOT_CLASS };+function StatusDot({tone,label,}: {- tone: "warning" | "danger" | "success";+ tone: "warning" | "danger" | "success" | "downloading";label: string;}) {const toneClass =@@ -315,7 +318,9 @@ function StatusDot({? "bg-status-warning": tone === "danger"? "bg-status-danger"- : "bg-status-success";+ : tone === "downloading"+ ? DOWNLOADING_DOT_CLASS+ : "bg-status-success";return (<spanrole="img"@@ -325,6 +330,14 @@ function StatusDot({);}+function PartialStatusDot({ downloading }: { downloading: boolean }) {+ return downloading ? (+ <StatusDot tone="downloading" label="Downloading" />+ ) : (+ <StatusDot tone="warning" label="Partial download" />+ );+}+function TooltipLegendRow({toneClass,children,@@ -351,6 +364,7 @@ export function buildRowStatusTooltip({isAdapter,isAvailableOnDevice,partialRepoId,+ downloading = false,unsupported,unsupportedReason,resourceLabel = "model",@@ -359,6 +373,7 @@ export function buildRowStatusTooltip({isAdapter?: boolean;isAvailableOnDevice?: boolean;partialRepoId?: string;+ downloading?: boolean;unsupported?: boolean;unsupportedReason?: string | null;resourceLabel?: "model" | "dataset";@@ -380,7 +395,14 @@ export function buildRowStatusTooltip({);}- if (partialRepoId) {+ if (partialRepoId && downloading) {+ lines.push(+ <TooltipLegendRow key="downloading" toneClass={DOWNLOADING_DOT_CLASS}>+ Downloading <span className="font-medium">{partialRepoId}</span>.+ Progress is in the downloads panel.+ </TooltipLegendRow>,+ );+ } else if (partialRepoId) {lines.push(<TooltipLegendRow key="partial" toneClass="bg-status-warning">Partial download of <span className="font-medium">{partialRepoId}</span>@@ -450,11 +472,13 @@ export const DiscoverModelRow = memo(function DiscoverModelRow({row.isAvailableOnDevice && row.isPartialOnDevice? row.result.id: undefined;+ const downloading = Boolean(partialRepoId && row.isDownloadingOnDevice);const tooltip = buildRowStatusTooltip({isGguf: row.result.isGguf,isAdapter: false,isAvailableOnDevice: row.isAvailableOnDevice,partialRepoId,+ downloading,unsupported,unsupportedReason: support?.reason ?? null,resourceLabel: isDataset ? "dataset" : "model",@@ -495,7 +519,7 @@ export const DiscoverModelRow = memo(function DiscoverModelRow({<StatusDot tone="danger" label="May not be supported yet" />)}{row.isAvailableOnDevice && row.isPartialOnDevice && (- <StatusDot tone="warning" label="Partial download" />+ <PartialStatusDot downloading={downloading} />)}{row.isAvailableOnDevice && !row.isPartialOnDevice && (<StatusDot tone="success" label="On device" />@@ -600,11 +624,13 @@ export const InventoryRow = memo(function InventoryRow({? row.repoId: (row.repoId ?? row.loadId): undefined;+ const downloading = Boolean(partialRepoId && row.downloading);const tooltip = buildRowStatusTooltip({isGguf: showFormatDot && row.isGguf,isAdapter: showFormatDot && row.modelFormat === "adapter",isAvailableOnDevice: !partialRepoId,partialRepoId,+ downloading,unsupported,resourceLabel: isDataset ? "dataset" : "model",});@@ -657,7 +683,7 @@ export const InventoryRow = memo(function InventoryRow({/>)}{partialRepoId ? (- <StatusDot tone="warning" label="Partial download" />+ <PartialStatusDot downloading={downloading} />) : (<StatusDot tone="success" label="On device" />)}@@ -672,7 +698,7 @@ export const InventoryRow = memo(function InventoryRow({const compactMarkers =partialRepoId || unsupported ? (<span className="flex shrink-0 items-center gap-1">- {partialRepoId && <StatusDot tone="warning" label="Partial download" />}+ {partialRepoId && <PartialStatusDot downloading={downloading} />}{unsupported && (<StatusDot tone="danger" label="May not be supported yet" />)}diff --git a/studio/frontend/src/features/hub/catalog/models-table.tsx b/studio/frontend/src/features/hub/catalog/models-table.tsxindex ec2dc243723..25989f69545 100644--- a/studio/frontend/src/features/hub/catalog/models-table.tsx+++ b/studio/frontend/src/features/hub/catalog/models-table.tsx@@ -49,7 +49,10 @@ import { Fragment, type ReactNode, memo, useMemo } from "react";import { confirmExternalLink } from "../stores/external-link-confirm";import type { DiscoverRow } from "../types";import { HubOptionMenu } from "./hub-option-menu";-import { buildRowStatusTooltip } from "./models-catalog-rows";+import {+ DOWNLOADING_DOT_CLASS,+ buildRowStatusTooltip,+} from "./models-catalog-rows";import { OwnerAvatar } from "./owner-avatar";import { AccessGlyphs, CapabilityPill } from "./shared";@@ -332,6 +335,7 @@ function TitleMarkers({gated,isPrivate,partial,+ downloading = false,unsupported,onDevice,}: {@@ -339,6 +343,7 @@ function TitleMarkers({gated?: false | "auto" | "manual";isPrivate?: boolean;partial: boolean;+ downloading?: boolean;unsupported: boolean;onDevice: boolean;}) {@@ -359,13 +364,20 @@ function TitleMarkers({/>)}<AccessGlyphs gated={gated} isPrivate={isPrivate} tooltip={false} />- {partial && (+ {partial && !downloading && (<spanrole="img"aria-label="Partial download"className={cn(STATUS_DOT_CLASS, "bg-status-warning")}/>)}+ {partial && downloading && (+ <span+ role="img"+ aria-label="Downloading"+ className={cn(STATUS_DOT_CLASS, DOWNLOADING_DOT_CLASS)}+ />+ )}{unsupported && (<spanrole="img"@@ -584,6 +596,10 @@ function useResultRowModel(support,unsupported,partial: row.isAvailableOnDevice && row.isPartialOnDevice,+ downloading:+ row.isAvailableOnDevice &&+ row.isPartialOnDevice &&+ row.isDownloadingOnDevice === true,onDevice: row.isAvailableOnDevice && !row.isPartialOnDevice,sizeLabel: sizeLabel !== "N/A" ? sizeLabel : null,taskLabel,@@ -603,7 +619,15 @@ export const ResultCard = memo(function ResultCard({showFormatDot?: boolean;onSelect: (id: string) => void;}) {- const { support, unsupported, partial, onDevice, sizeLabel, taskLabel } =+ const {+ support,+ unsupported,+ partial,+ downloading,+ onDevice,+ sizeLabel,+ taskLabel,+ } =useResultRowModel(row, deviceType, isDataset);const format =isDataset || !showFormatDot@@ -613,6 +637,7 @@ export const ResultCard = memo(function ResultCard({: "checkpoint";const tip = buildRowStatusTooltip({partialRepoId: partial ? row.result.id : undefined,+ downloading,unsupported,unsupportedReason: support?.reason ?? null,resourceLabel: isDataset ? "dataset" : "model",@@ -665,6 +690,7 @@ export const ResultCard = memo(function ResultCard({gated={row.result.gated}isPrivate={row.result.private}partial={partial}+ downloading={downloading}unsupported={unsupported}onDevice={onDevice}/>@@ -733,7 +759,15 @@ export const ResultGridRow = memo(function ResultGridRow({showFormatDot?: boolean;onSelect: (id: string) => void;}) {- const { support, unsupported, partial, onDevice, sizeLabel, taskLabel } =+ const {+ support,+ unsupported,+ partial,+ downloading,+ onDevice,+ sizeLabel,+ taskLabel,+ } =useResultRowModel(row, deviceType, isDataset);const sizeDisplay = isDataset ? null : sizeLabel;const format =@@ -744,6 +778,7 @@ export const ResultGridRow = memo(function ResultGridRow({: "checkpoint";const tip = buildRowStatusTooltip({partialRepoId: partial ? row.result.id : undefined,+ downloading,unsupported,unsupportedReason: support?.reason ?? null,resourceLabel: isDataset ? "dataset" : "model",@@ -791,6 +826,7 @@ export const ResultGridRow = memo(function ResultGridRow({gated={row.result.gated}isPrivate={row.result.private}partial={partial}+ downloading={downloading}unsupported={unsupported}onDevice={onDevice}/>@@ -878,7 +914,8 @@ export const ResultSplitRow = memo(function ResultSplitRow({showFormatDot?: boolean;onSelect: (id: string) => void;}) {- const { support, unsupported, partial, onDevice } = useResultRowModel(+ const { support, unsupported, partial, downloading, onDevice } =+ useResultRowModel(row,deviceType,isDataset,@@ -891,6 +928,7 @@ export const ResultSplitRow = memo(function ResultSplitRow({: "checkpoint";const tip = buildRowStatusTooltip({partialRepoId: partial ? row.result.id : undefined,+ downloading,unsupported,unsupportedReason: support?.reason ?? null,resourceLabel: isDataset ? "dataset" : "model",@@ -920,6 +958,7 @@ export const ResultSplitRow = memo(function ResultSplitRow({gated={row.result.gated}isPrivate={row.result.private}partial={partial}+ downloading={downloading}unsupported={unsupported}onDevice={onDevice}/>diff --git a/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx b/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsxindex 46fa9ba9c50..6cb0ca2a629 100644--- a/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/safetensors-download-card.tsx@@ -27,7 +27,10 @@ import {import { QuantOptionsMenu } from "./gguf-download-card";import { useCardDelete } from "./use-card-delete";import { DeleteImpactSummary, useDeleteImpact } from "./delete-impact";-import { useDownloadCardState } from "./use-download-card-state";+import {+ isRepoDownloadProgress,+ useDownloadCardState,+} from "./use-download-card-state";function formatModelLabel(modelFormat?: ModelInventoryFormat | null): string {if (modelFormat === "adapter") return "Adapter";@@ -103,6 +106,7 @@ export function SafetensorsDownloadCard({repoId,activeVariant: null,autoAdopt: true,+ includeScopedJobs: true,});const progress = job.progress;@@ -138,11 +142,11 @@ export function SafetensorsDownloadCard({};}, [repoId, hfToken, sizeKey, setJobExpectedBytes, knownBytes, online]);- const downloading = progress !== null && progress.variant === null;+ const downloading = isRepoDownloadProgress(progress);const partialsResumable = useHttpPartialsResumable();const downloadAction = useDownloadCardState({job,- variant: null,+ variant: downloading ? (progress?.variant ?? null) : null,expectedBytes: modelTotalBytes ?? 0,downloading,disabled: isLoadingThisModel || cancelling || repoPeerActive,@@ -210,6 +214,9 @@ export function SafetensorsDownloadCard({<div className="relative flex h-9 min-w-0 flex-1 items-center pl-3 pr-2"><span className="flex items-center gap-1.5 text-ui-12 text-muted-foreground">{isDownloaded && <DotTag tone="success" label="On device" />}+ {!isDownloaded && downloading && (+ <DotTag tone="downloading" label="Downloading" />+ )}{!isDownloaded && isPartial && !downloading && (<Tooltip><TooltipTrigger asChild={true}>diff --git a/studio/frontend/src/features/hub/catalog/use-download-card-state.ts b/studio/frontend/src/features/hub/catalog/use-download-card-state.tsindex 65baf782861..cde4f7a197e 100644--- a/studio/frontend/src/features/hub/catalog/use-download-card-state.ts+++ b/studio/frontend/src/features/hub/catalog/use-download-card-state.ts@@ -50,6 +50,14 @@ export function downloadStopMode(return transport === "http" && partialsResumable ? "pause" : "cancel";}+// Snapshot job alone misses scoped ("@scope") jobs writing into the repo, showing "Resume" mid-download.+export function isRepoDownloadProgress(+ progress: { variant: string | null } | null | undefined,+): boolean {+ if (!progress) return false;+ return progress.variant === null || progress.variant.startsWith("@");+}+export function downloadActionAriaLabel(downloading: boolean,cancelling: boolean,diff --git a/studio/frontend/src/features/hub/download-manager/download-manager-controller.ts b/studio/frontend/src/features/hub/download-manager/download-manager-controller.tsindex b0ce05aae6d..02eba31a389 100644--- a/studio/frontend/src/features/hub/download-manager/download-manager-controller.ts+++ b/studio/frontend/src/features/hub/download-manager/download-manager-controller.ts@@ -28,6 +28,7 @@ import {export type { DownloadKind } from "./constants";export {clearCompletedInventoryHint,+ findActiveScopedJobForRepo,jobKeyOf,repoKeyOf,selectActiveJob,diff --git a/studio/frontend/src/features/hub/download-manager/download-manager-state.ts b/studio/frontend/src/features/hub/download-manager/download-manager-state.tsindex 5f03885643a..5692fb2fbfe 100644--- a/studio/frontend/src/features/hub/download-manager/download-manager-state.ts+++ b/studio/frontend/src/features/hub/download-manager/download-manager-state.ts@@ -414,6 +414,32 @@ export function findActiveJobForRepo(return selected;}+export function findActiveScopedJobForRepo(+ jobs: Record<string, ManagedDownload>,+ kind: DownloadKind,+ repoId: string,+ inventoryKind?: "model" | "gguf",+): ManagedDownload | null {+ let selected: ManagedDownload | null = null;+ const repoIdentity = normalizeRepoIdentity(repoId);+ for (const job of Object.values(jobs)) {+ if (job.kind !== kind || normalizeRepoIdentity(job.repoId) !== repoIdentity)+ continue;+ if (!job.variant?.startsWith("@")) continue;+ if (+ inventoryKind &&+ downloadInventoryHintKind(job.kind, job.variant, job.inventoryKind) !==+ inventoryKind+ )+ continue;+ if (!ACTIVE_STATES.has(job.state)) continue;+ if (isPreferredRepoActiveJob(job, selected)) {+ selected = job;+ }+ }+ return selected;+}+function hasRuntimePeerForRepo(kind: DownloadKind,repoId: string,diff --git a/studio/frontend/src/features/hub/download-manager/use-repo-download.ts b/studio/frontend/src/features/hub/download-manager/use-repo-download.tsindex 22b8ff83501..a8d73b1278e 100644--- a/studio/frontend/src/features/hub/download-manager/use-repo-download.ts+++ b/studio/frontend/src/features/hub/download-manager/use-repo-download.ts@@ -11,6 +11,7 @@ import {type DownloadRequest,type JobListeners,downloadManager,+ findActiveScopedJobForRepo,jobKeyOf,repoKeyOf,selectActiveJob,@@ -58,6 +59,8 @@ export interface RepoDownloadConfig {onError?: JobListeners["onError"];// Attach to a no-variant backend download already running (GGUF surfaces adopt their own variant).autoAdopt?: boolean;+ /** Non-GGUF scoped jobs only: a GGUF file job's progress and stop control belong to the GGUF card. */+ includeScopedJobs?: boolean;}/**@@ -74,6 +77,7 @@ export function useRepoDownload(config: RepoDownloadConfig): DownloadJob {onCancelled,onError,autoAdopt,+ includeScopedJobs = false,} = config;const handlersRef = useLatestRef<JobListeners>({@@ -105,7 +109,11 @@ export function useRepoDownload(config: RepoDownloadConfig): DownloadJob {repoPeerActive: false,};}- const active = selectActiveJob(state, kind, repoId, activeVariant);+ const active =+ selectActiveJob(state, kind, repoId, activeVariant) ??+ (includeScopedJobs && activeVariant === null+ ? findActiveScopedJobForRepo(state.jobs, kind, repoId, "model")+ : null);const repoActive = selectActiveJob(state, kind, repoId);return {active,diff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsxindex c0cebbac3c8..4ef39449f59 100644--- a/studio/frontend/src/features/hub/hub-page.tsx+++ b/studio/frontend/src/features/hub/hub-page.tsx@@ -243,12 +243,12 @@ function discoveryInventorySignature(const parts: string[] = [];for (const row of cachedRows) {parts.push(- `c:${row.repoId.toLowerCase()}:${row.modelFormat}:${row.partial ? "p" : "c"}`,+ `c:${row.repoId.toLowerCase()}:${row.modelFormat}:${row.partial ? (row.downloading ? "d" : "p") : "c"}`,);}for (const row of localRows) {parts.push(- `l:${(row.repoId ?? row.id).toLowerCase()}:${row.modelFormat}:${row.partial ? "p" : "c"}`,+ `l:${(row.repoId ?? row.id).toLowerCase()}:${row.modelFormat}:${row.partial ? (row.downloading ? "d" : "p") : "c"}`,);}return parts.sort().join("|");@@ -883,6 +883,7 @@ export function ModelsPage() {localRows: effectiveLocalRows,availableSet,partialSet,+ downloadingSet,downloadedReady,inventorySettled,inventoryError,@@ -955,11 +956,12 @@ export function ModelsPage() {},isAvailableOnDevice: availableSet.has(lower),isPartialOnDevice: partialSet.has(lower),+ isDownloadingOnDevice: partialSet.has(lower) && downloadingSet.has(lower),summary: summaryParts.join(" · ") || ds.prettyName || "Dataset",capabilities: [],};});- }, [isDatasetMode, datasetResults, availableSet, partialSet]);+ }, [isDatasetMode, datasetResults, availableSet, partialSet, downloadingSet]);const discoverRows = isDatasetMode ? datasetDiscoverRows : modelDiscoverRows;diff --git a/studio/frontend/src/features/hub/inventory/inventory-dedupe.ts b/studio/frontend/src/features/hub/inventory/inventory-dedupe.tsindex c110f2d4ca8..ad224c9c47a 100644--- a/studio/frontend/src/features/hub/inventory/inventory-dedupe.ts+++ b/studio/frontend/src/features/hub/inventory/inventory-dedupe.ts@@ -1,6 +1,8 @@// 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 { DownloadKind } from "../download-manager/constants";+import { downloadInventoryHintKind } from "../download-manager/download-manager-types";import type { CachedInventoryRow, LocalInventoryRow } from "./types";function repoFormatKey(@@ -81,6 +83,63 @@ export function findCompleteHfCacheLocalRow();}+// Keyed by repo (scoped jobs never share the row key) and family; unknown family marks every family.+export function activeDownloadRepoKeys(+ jobs: readonly {+ kind?: DownloadKind;+ repoId: string;+ variant?: string | null;+ inventoryKind?: "model" | "gguf";+ state: string;+ }[],+): Set<string> {+ const keys = new Set<string>();+ for (const job of jobs) {+ if (job.state !== "running" && job.state !== "cancelling") continue;+ const key = repoKey(job.repoId);+ if (!key) continue;+ keys.add(key);+ const hint = job.kind+ ? downloadInventoryHintKind(job.kind, job.variant ?? null, job.inventoryKind)+ : null;+ if (hint === "gguf" || hint === "model") {+ keys.add(`${key}\0${hint}`);+ } else {+ keys.add(`${key}\0gguf`);+ keys.add(`${key}\0model`);+ }+ }+ return keys;+}++// Returns `rows` itself when nothing changes, so memoized consumers keep their identity.+export function markDownloadingRows<+ T extends {+ partial?: boolean;+ downloading?: boolean;+ modelFormat?: CachedInventoryRow["modelFormat"];+ },+>(+ rows: T[],+ getRepoId: (row: T) => string | null | undefined,+ downloadingRepoKeys: ReadonlySet<string>,+): T[] {+ let changed = false;+ const next = rows.map((row) => {+ const key = repoKey(getRepoId(row));+ const family = row.modelFormat ? partialFormatFamily(row.modelFormat) : null;+ const downloading = Boolean(+ row.partial &&+ key &&+ downloadingRepoKeys.has(family ? `${key}\0${family}` : key),+ );+ if (Boolean(row.downloading) === downloading) return row;+ changed = true;+ return { ...row, downloading };+ });+ return changed ? next : rows;+}+export function partialSetFromRows<T extends { partial?: boolean }>(rows: readonly T[],getRepoId: (row: T) => string | null | undefined,diff --git a/studio/frontend/src/features/hub/inventory/types.ts b/studio/frontend/src/features/hub/inventory/types.tsindex a694cac7ac5..904682bb20f 100644--- a/studio/frontend/src/features/hub/inventory/types.ts+++ b/studio/frontend/src/features/hub/inventory/types.ts@@ -48,6 +48,7 @@ export interface CachedInventoryRow {partialTransport?: string | null;/** This partial can be continued byte for byte. */partialResumable?: boolean;+ downloading?: boolean;/** A download manifest or cancel marker exists for some quant; moves on a sibling cancel, which changes neither bytes nor mtime. */hasVariantState?: boolean;pipelineTag?: string | null;@@ -96,6 +97,7 @@ export interface LocalInventoryRow {partialTransport?: string | null;/** This partial can be continued byte for byte. */partialResumable?: boolean;+ downloading?: boolean;activeCache?: boolean | null;pipelineTag?: string | null;tags?: string[];diff --git a/studio/frontend/src/features/hub/inventory/use-hub-inventory.ts b/studio/frontend/src/features/hub/inventory/use-hub-inventory.tsindex 54fc61f1c32..c8095221378 100644--- a/studio/frontend/src/features/hub/inventory/use-hub-inventory.ts+++ b/studio/frontend/src/features/hub/inventory/use-hub-inventory.ts@@ -11,7 +11,9 @@ import { useHfTokenStore } from "@/features/hub/stores/hf-token-store";import { useCallback, useEffect, useMemo, useRef } from "react";import type { LocalDatasetInfo } from "./api";import {+ activeDownloadRepoKeys,dedupeSameSourceHubCacheRows,+ markDownloadingRows,partialSetFromRows,} from "./inventory-dedupe";import {@@ -55,6 +57,7 @@ export interface HubInventory {localRows: LocalInventoryRow[];availableSet: Set<string>;partialSet: Set<string>;+ downloadingSet: Set<string>;downloadedReady: boolean;inventorySettled: boolean;inventoryError: boolean;@@ -567,12 +570,42 @@ export function useHubInventory([cachedDatasetRows, localDatasetRows],);- const cachedRows = isDatasetMode- ? dedupedDatasetInventory.cachedRows- : dedupedModelInventory.cachedRows;- const effectiveLocalRows = isDatasetMode- ? dedupedDatasetInventory.localRows- : dedupedModelInventory.localRows;+ const downloadingSet = useMemo(+ () => activeDownloadRepoKeys(liveInventoryJobs),+ [liveInventoryJobs],+ );+ const cachedRows = useMemo(+ () =>+ markDownloadingRows(+ isDatasetMode+ ? dedupedDatasetInventory.cachedRows+ : dedupedModelInventory.cachedRows,+ (row) => row.repoId,+ downloadingSet,+ ),+ [+ dedupedDatasetInventory.cachedRows,+ dedupedModelInventory.cachedRows,+ downloadingSet,+ isDatasetMode,+ ],+ );+ const effectiveLocalRows = useMemo(+ () =>+ markDownloadingRows(+ isDatasetMode+ ? dedupedDatasetInventory.localRows+ : dedupedModelInventory.localRows,+ (row) => row.repoId,+ downloadingSet,+ ),+ [+ dedupedDatasetInventory.localRows,+ dedupedModelInventory.localRows,+ downloadingSet,+ isDatasetMode,+ ],+ );const availableSet = useMemo(() => {const set = new Set<string>();@@ -717,6 +750,7 @@ export function useHubInventory(localRows: effectiveLocalRows,availableSet,partialSet,+ downloadingSet,downloadedReady,inventorySettled,inventoryError: inventoryFailed,diff --git a/studio/frontend/src/features/hub/lib/view-models.ts b/studio/frontend/src/features/hub/lib/view-models.tsindex 4182538991c..cdd815af0c2 100644--- a/studio/frontend/src/features/hub/lib/view-models.ts+++ b/studio/frontend/src/features/hub/lib/view-models.ts@@ -205,6 +205,11 @@ export function buildDiscoverRows(const partial = Boolean(resource.cachedRow?.partial ?? resource.localRow?.partial ?? false,);+ const downloading =+ partial &&+ Boolean(+ resource.cachedRow?.downloading ?? resource.localRow?.downloading,+ );return {id: result.id,owner: ownerOf(result.id),@@ -212,6 +217,7 @@ export function buildDiscoverRows(result,isAvailableOnDevice: Boolean(resource.cachedRow || resource.localRow),isPartialOnDevice: partial,+ isDownloadingOnDevice: downloading,summary: buildSummary(result),capabilities: detectCapabilities(result.tags,diff --git a/studio/frontend/src/features/hub/types.ts b/studio/frontend/src/features/hub/types.tsindex 046f726276a..24bfec51959 100644--- a/studio/frontend/src/features/hub/types.ts+++ b/studio/frontend/src/features/hub/types.ts@@ -34,6 +34,7 @@ export interface DiscoverRow {result: HfModelResult;isAvailableOnDevice: boolean;isPartialOnDevice: boolean;+ isDownloadingOnDevice?: boolean;summary: string;capabilities: Capability[];}diff --git a/studio/frontend/tests/download-live-partial-not-paused.test.ts b/studio/frontend/tests/download-live-partial-not-paused.test.tsnew file mode 100644index 00000000000..57598958b0b--- /dev/null+++ b/studio/frontend/tests/download-live-partial-not-paused.test.ts@@ -0,0 +1,259 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// A live download's `.incomplete` blob must not render as a paused partial (incl. scoped jobs).++import assert from "node:assert/strict";+import test from "node:test";++import { readSrc, registerStoreStubResolver } from "./helpers/kit.ts";++registerStoreStubResolver();++const { activeDownloadRepoKeys, markDownloadingRows } = await import(+ "../src/features/hub/inventory/inventory-dedupe.ts"+);+const { createLiveInventoryJobsSelector } = await import(+ "../src/features/hub/inventory/use-hub-inventory.ts"+);+const { buildDiscoverRows } = await import(+ "../src/features/hub/lib/view-models.ts"+);+const { findActiveScopedJobForRepo, selectActiveJob } = await import(+ "../src/features/hub/download-manager/download-manager-state.ts"+);+const { isRepoDownloadProgress } = await import(+ "../src/features/hub/catalog/use-download-card-state.ts"+);+const { createScopedLiveGgufFilesSelector, isScopedLiveVariant } =+ await import("../src/features/hub/catalog/gguf-live-variant-states.ts");++const REPO = "unsloth/Qwen-Image-2.1-FP8";++function job(over: Record<string, unknown> = {}) {+ const variant = (over.variant as string | null | undefined) ?? null;+ return {+ key: `model:${REPO.toLowerCase()}${variant ? `#${variant.toLowerCase()}` : ""}`,+ kind: "model",+ repoId: REPO,+ variant,+ state: "running",+ startedAt: 1,+ downloadedBytes: 1_200_000_000,+ completedBytes: 0,+ completeOnDisk: false,+ expectedBytes: 9_400_000_000,+ fraction: 0.13,+ bytesPerSec: 0,+ etaSeconds: 0,+ error: null,+ ...over,+ } as never;+}++function scannedRow(over: Record<string, unknown> = {}) {+ return {+ kind: "cache" as const,+ id: `safetensors:${REPO}`,+ loadId: REPO,+ repoId: REPO,+ owner: "unsloth",+ repo: "Qwen-Image-2.1-FP8",+ isGguf: false,+ modelFormat: "safetensors" as const,+ capabilities: {} as never,+ bytes: 9_400_000_000,+ partial: true,+ downloading: undefined as boolean | undefined,+ ...over,+ };+}++function jobsRecord(...list: ReturnType<typeof job>[]) {+ return Object.fromEntries(+ list.map((entry) => [(entry as { key: string }).key, entry]),+ );+}++test("a partial row with a running scoped job reads as downloading, not paused", () => {+ const scoped = job({ variant: "@hub-required-assets", scopedFiles: ["vae/a.safetensors"] });+ const live = createLiveInventoryJobsSelector(false)({ jobs: jsonJobs(scoped) });+ const keys = activeDownloadRepoKeys(live);+ assert.equal(keys.has(REPO.toLowerCase()), true);++ const [row] = markDownloadingRows([scannedRow()], (r) => r.repoId, keys);+ assert.equal(row.partial, true);+ assert.equal(row.downloading, true);+});++test("a stopped partial stays a partial", () => {+ for (const state of ["cancelled", "error"]) {+ const stopped = job({ state });+ const live = createLiveInventoryJobsSelector(false)({ jobs: jsonJobs(stopped) });+ const keys = activeDownloadRepoKeys(live);+ assert.equal(keys.size, 0, state);+ const rows = [scannedRow()];+ const marked = markDownloadingRows(rows, (r) => r.repoId, keys);+ assert.equal(marked, rows, "unchanged rows keep their identity");+ assert.equal(marked[0].downloading, undefined, state);+ }+});++test("a complete row is never marked downloading", () => {+ const keys = activeDownloadRepoKeys([{ repoId: REPO, state: "running" }]);+ const rows = [scannedRow({ partial: false })];+ assert.equal(markDownloadingRows(rows, (r) => r.repoId, keys), rows);+});++test("the flag clears once the job leaves the running states", () => {+ const rows = [scannedRow({ downloading: true })];+ const [row] = markDownloadingRows(rows, (r) => r.repoId, new Set());+ assert.equal(row.downloading, false);+});++test("repo matching ignores case, as the cache dir does", () => {+ const keys = activeDownloadRepoKeys([+ { repoId: "UNSLOTH/qwen-image-2.1-fp8", state: "cancelling" },+ ]);+ const [row] = markDownloadingRows([scannedRow()], (r) => r.repoId, keys);+ assert.equal(row.downloading, true);+});++test("discover rows carry the downloading state of their inventory row", () => {+ const result = { id: REPO, isGguf: false, tags: [] } as never;+ const [downloading] = buildDiscoverRows(+ [result],+ [scannedRow({ downloading: true })] as never,+ [],+ );+ assert.equal(downloading.isPartialOnDevice, true);+ assert.equal(downloading.isDownloadingOnDevice, true);++ const [stopped] = buildDiscoverRows([result], [scannedRow()] as never, []);+ assert.equal(stopped.isPartialOnDevice, true);+ assert.equal(stopped.isDownloadingOnDevice, false);+});++test("the repo card finds a running scoped job the snapshot key does not", () => {+ const scoped = job({ variant: "@hub-required-assets" });+ const state = {+ jobs: jsonJobs(scoped),+ conflicts: {},+ completedHintSignature: "",+ completedInventoryHints: [],+ } as never;+ assert.equal(selectActiveJob(state, "model", REPO, null), null);+ const found = findActiveScopedJobForRepo(jsonJobs(scoped), "model", REPO);+ assert.equal(found?.variant, "@hub-required-assets");+ assert.equal(isRepoDownloadProgress({ variant: found?.variant ?? null }), true);+});++test("a GGUF quant job is not a repo-level download, and stopped scoped jobs are ignored", () => {+ const quant = job({ variant: "Q8_0" });+ const cancelled = job({ variant: "@other", state: "cancelled" });+ assert.equal(+ findActiveScopedJobForRepo(jsonJobs(quant, cancelled), "model", REPO),+ null,+ );+ assert.equal(isRepoDownloadProgress({ variant: "Q8_0" }), false);+ assert.equal(isRepoDownloadProgress({ variant: null }), true);+ assert.equal(isRepoDownloadProgress(null), false);+});++test("a GGUF quant written by a scoped Model file job reads as downloading", () => {+ const gguf = "unsloth/Qwen-Image-2.1-GGUF";+ const scoped = job({+ repoId: gguf,+ key: "model:unsloth/qwen-image-2.1-gguf#@images",+ variant: "@images",+ scopedFiles: ["qwen-image-2.1-Q8_0.gguf"],+ });+ const select = createScopedLiveGgufFilesSelector(gguf);+ const files = select({ jobs: jsonJobs(scoped) });+ assert.equal(isScopedLiveVariant({ filename: "qwen-image-2.1-Q8_0.gguf" }, files), true);+ assert.equal(isScopedLiveVariant({ filename: "qwen-image-2.1-Q4_K_M.gguf" }, files), false);+ assert.equal(select({ jobs: jsonJobs(scoped) }), files, "stable identity while unchanged");++ const done = select({ jobs: jsonJobs(job({ ...(scoped as object), state: "complete" })) });+ assert.equal(isScopedLiveVariant({ filename: "qwen-image-2.1-Q8_0.gguf" }, done), false);+});++test("a job of one artifact family does not mark the other family's partial row", () => {+ const ggufRow = scannedRow({ id: `gguf:${REPO}`, modelFormat: "gguf", isGguf: true });+ const modelRow = scannedRow();+ const unknownRow = scannedRow({ id: `unknown:${REPO}`, modelFormat: "unknown" });+ const rows = [ggufRow, modelRow, unknownRow];++ const ggufScoped = job({+ variant: "@model-file",+ scopedFiles: ["qwen-image-2.1-Q8_0.gguf"],+ inventoryKind: "gguf",+ });+ const ggufKeys = activeDownloadRepoKeys(+ createLiveInventoryJobsSelector(false)({ jobs: jsonJobs(ggufScoped) }),+ );+ assert.deepEqual(+ markDownloadingRows(rows, (r) => r.repoId, ggufKeys).map((r) => Boolean(r.downloading)),+ [true, false, true],+ );++ const assets = job({ variant: "@hub-required-assets", scopedFiles: ["vae/a.safetensors"] });+ const modelKeys = activeDownloadRepoKeys(+ createLiveInventoryJobsSelector(false)({ jobs: jsonJobs(assets) }),+ );+ assert.deepEqual(+ markDownloadingRows(rows, (r) => r.repoId, modelKeys).map((r) => Boolean(r.downloading)),+ [false, true, true],+ );++ const quant = job({ variant: "Q8_0" });+ const quantKeys = activeDownloadRepoKeys(+ createLiveInventoryJobsSelector(false)({ jobs: jsonJobs(quant) }),+ );+ assert.deepEqual(+ markDownloadingRows(rows, (r) => r.repoId, quantKeys).map((r) => Boolean(r.downloading)),+ [true, false, true],+ );+});++test("the Safetensors card's scoped fallback skips a GGUF-scoped job in the same repo", () => {+ const ggufScoped = job({+ variant: "@model-file",+ scopedFiles: ["qwen-image-2.1-Q8_0.gguf"],+ inventoryKind: "gguf",+ });+ assert.equal(+ findActiveScopedJobForRepo(jsonJobs(ggufScoped), "model", REPO, "model"),+ null,+ );+ const assets = job({ variant: "@hub-required-assets" });+ assert.equal(+ findActiveScopedJobForRepo(jsonJobs(ggufScoped, assets), "model", REPO, "model")+ ?.variant,+ "@hub-required-assets",+ );+ const hook = readSrc("features/hub/download-manager/use-repo-download.ts");+ assert.match(hook, /findActiveScopedJobForRepo\(state\.jobs, kind, repoId, "model"\)/);+});++function jsonJobs(...list: ReturnType<typeof job>[]) {+ return jobsRecord(...list) as never;+}++test("every partial marker on the hub has a downloading branch", () => {+ const card = readSrc("features/hub/catalog/safetensors-download-card.tsx");+ assert.match(card, /includeScopedJobs: true/);+ assert.match(card, /isRepoDownloadProgress\(progress\)/);+ assert.match(card, /tone="downloading" label="Downloading"/);++ const rows = readSrc("features/hub/catalog/models-catalog-rows.tsx");+ // The amber dot is only drawn through PartialStatusDot, which picks Downloading when live.+ assert.equal(rows.match(/<StatusDot tone="warning" label="Partial download" \/>/g)?.length, 1);+ assert.match(rows, /<PartialStatusDot downloading=\{downloading\} \/>/);++ for (const file of ["models-table.tsx", "model-card.tsx"]) {+ const source = readSrc(`features/hub/catalog/${file}`);+ assert.match(source, /partial && !downloading && \(/, file);+ assert.match(source, /aria-label="Downloading"/, file);+ }+});