Add Hugging Face support and enhance model resolution logic
- Introduced support for Hugging Face API integration, allowing fallback model resolution when Civitai fails. - Updated configuration to include `HF_TOKEN` and `HF_TOKEN_PATH` for authentication. - Enhanced model capture logic to differentiate between Civitai and Hugging Face sources. - Improved error handling for model downloads, providing clearer messages for authentication issues. - Updated documentation to reflect new environment variables and usage instructions for Hugging Face integration. - Added tests to validate the new fallback mechanism and ensure robust model resolution.
This commit is contained in:
+1
-1
@@ -129,7 +129,7 @@ Unit `gpu-rent-ollama` читает `/mnt/swarm_data/.gpu-rent-gpu.json`:
|
||||
| 4 | empty | только runtime |
|
||||
| — | keep | не трогать yaml |
|
||||
|
||||
`-ngl` / `-c` — по GPU probe. Опционально `HF_TOKEN` для gated HF. Вручную: положи GGUF в models и `systemctl restart gpu-rent-llamacpp`.
|
||||
`-ngl` / `-c` — по GPU probe. Для recommended abliterate GGUF нужен **`HF_TOKEN`** в `.env` (иначе 401). Вручную: положи GGUF в models и `systemctl restart gpu-rent-llamacpp`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -189,6 +189,14 @@ REST не раздвоился: те же `/api/v1/...` на обоих хост
|
||||
```env
|
||||
CIVITAI_API_TOKEN=
|
||||
CIVITAI_API_HOST=civitai.red # полный каталог; civitai.com = только SFW
|
||||
HF_TOKEN= # или HUGGING_FACE_HUB_TOKEN — HF GGUF / gated / capture fallback
|
||||
MODELS_MANIFEST= # пусто = <repo>/models.yaml
|
||||
LOCAL_MODELS_DIR= # пусто = <корень приложения>/Models
|
||||
```
|
||||
|
||||
## Hugging Face (резерв)
|
||||
|
||||
- **Скачивание:** `HF_TOKEN` в `.env` → GGUF (llama.cpp) и строки `models.yaml` с `huggingface.co/…/resolve/…`.
|
||||
- **Capture:** если Civitai by-hash не нашёл файл → поиск на Hub по имени + LFS sha256 → URL в манифест.
|
||||
- **SwarmUI:** тот же токен прокидывается как `huggingface_api` (Model Downloader).
|
||||
- Abliterated / gated репозитории без токена почти всегда дают **401**.
|
||||
|
||||
Reference in New Issue
Block a user