Import models that are already in the models folder

The worker scans MODELS_DIR (startup, every 2 min, on "Rescan") for
<org>/<name> folders that no model uses and stores them in local_folders.
The library lists them; Import opens Add model prefilled with the folder,
the commit hf recorded and the files on disk preselected. The import job
runs hf download into the existing folder: hf 2.1.1 hashes files it didn't
download itself, keeps matching ones and re-downloads the rest (verified
in Docker, including a corrupted file being replaced).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-05 23:01:58 +02:00
1 parent 3603742637
commit 145818f149
16 files changed
+1418 -25

No files matched your search

+5 -1
View File
@@ -147,7 +147,11 @@ export class DownloadRunner {
const initial = await this.sample(dir, expected);
const remaining = expected.reduce((s, f, i) => s + (initial[i].complete ? 0 : f.size), 0);
const doneCount = initial.filter((p) => p.complete).length;
if (doneCount > 0) this.jobLog.system(`${doneCount} file(s) already complete, hf will skip them.`);
if (doneCount > 0) {
this.jobLog.system(
`${doneCount} file(s) already on disk with the right size. hf skips the ones it downloaded itself and checks the others by hash (slow for large files), downloading them again if they differ.`,
);
}
const free = await freeBytes(dir);
if (free != null && remaining > free) {