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

+9
View File
@@ -70,6 +70,13 @@ More guides are in the [wiki](https://git.linxweiler.xyz/pascallinxweiler/Kaname
- **Filter:** combine Author, Family, Quant, Tag and Status filters. The URL keeps the filters, so
you can bookmark a view.
- **Tags:** add or remove your own tags on a model's page; click a tag in the list to filter by it.
Create, rename and color them in Settings.
- **Import:** models you already have in the models folder (as `<org>/<name>`) show up under
"Found in the models folder"; **Import** matches them with the Hub repo and verifies the files
instead of downloading them again. See the
[wiki](https://git.linxweiler.xyz/pascallinxweiler/Kaname/wiki/Importing-existing-models).
- **Deleted on the Hub:** if a repo (or its pinned commit) disappears from Hugging Face, the model
is flagged and your local copy is kept.
- **Jobs:** each download has a page with per-file progress and the full `hf` log.
## How it works
@@ -88,6 +95,8 @@ Notes on the `hf` CLI (huggingface_hub 2.1.1, pinned in the image):
to show accurate progress.
- `hf` exits successfully even if nothing matched, so Kaname checks every file's size and hash
metadata after each download.
- Files that already exist in the target folder without hf's metadata (copied in by hand) are
hashed and kept if they match, and downloaded again if not. Imports rely on this.
## Development