Import folders without a Hub repo as local models

The Import form gets "Add as local model": every file in the folder,
kept as it is, named after the folder. A new models.source column
(hub | local) marks them; local models skip Hub checks, metadata,
downloads, updates and deep verify, and Verify checks existence and
size only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-11-08 00:14:56 +01:00
1 parent 90d6007b55
commit 80ccf800df
21 files changed
+1747 -39

No files matched your search

+20 -14
View File
@@ -22,11 +22,14 @@ export function DownloadCard({
modelId,
status,
hubMissing,
local = false,
}: {
modelId: string;
status: ModelStatus;
/** The repo or pinned commit is gone from the Hub; no new downloads. */
hubMissing: boolean;
/** A local model (no Hub repo): nothing to download or repair, no hashes to deep-verify against. */
local?: boolean;
}) {
const { snapshot } = useLive({ model: modelId });
const [busy, setBusy] = useState(false);
@@ -58,15 +61,16 @@ export function DownloadCard({
: latest?.state === "failed" && latest.kind === "download"
? "Retry"
: "Download missing";
const canDownload = !open && !hubMissing && status !== "ready" && status !== "deleting" && !!snapshot;
const canVerify = !open && !neverRan && status !== "deleting" && !!snapshot;
const needsRepair = !open && !hubMissing && status !== "deleting" && (verifyProblems > 0 || status === "incomplete");
const canDownload = !open && !local && !hubMissing && status !== "ready" && status !== "deleting" && !!snapshot;
const canVerify = !open && (!neverRan || local) && status !== "deleting" && !!snapshot;
const needsRepair = !open && !local && !hubMissing && status !== "deleting" && (verifyProblems > 0 || status === "incomplete");
let hint = "Downloads the selected files at the pinned commit.";
let hint = local ? "A local folder: Kaname keeps its files as they are." : "Downloads the selected files at the pinned commit.";
if (open?.state === "queued") hint = snapshot?.worker.online ? "Waiting for a free slot." : "Queued, but the worker is offline.";
else if (open) hint = "Runs in the background; you can close this page.";
else if (status === "deleting") hint = "Deleting…";
else if (hubMissing && status !== "ready") hint = "Can't download: no longer available on Hugging Face. Local files are kept.";
else if (local && (verifyProblems > 0 || status === "incomplete")) hint = "Some files are missing or changed. A local model can't be repaired from the Hub.";
else if (status === "ready") hint = "All selected files are present.";
const showProgress =
@@ -77,7 +81,7 @@ export function DownloadCard({
<div className="flex items-center justify-between gap-2">
<h3 className="flex items-center gap-1.5 text-sm font-semibold">
<DownloadIcon className="size-4 text-muted-foreground" />
{open ? jobLabel(open) : "Download"}
{open ? jobLabel(open) : local ? "Files" : "Download"}
</h3>
{latest && <JobStateBadge job={latest} />}
</div>
@@ -145,15 +149,17 @@ export function DownloadCard({
<ShieldCheckIcon />
Verify
</Button>
<Button
size="sm"
variant="ghost"
disabled={busy}
onClick={() => run(() => startVerify(modelId, true))}
title="Hash every file and compare with the Hub (slow: reads every byte)"
>
Deep verify
</Button>
{!local && (
<Button
size="sm"
variant="ghost"
disabled={busy}
onClick={() => run(() => startVerify(modelId, true))}
title="Hash every file and compare with the Hub (slow: reads every byte)"
>
Deep verify
</Button>
)}
</>
)}
</>