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:
@@ -83,6 +83,7 @@ class Config:
|
||||
|
||||
civitai_api_token: str
|
||||
civitai_api_host: str
|
||||
hf_token: str
|
||||
models_manifest: Path
|
||||
extensions_manifest: Path
|
||||
git_token: str
|
||||
@@ -215,6 +216,9 @@ def load_config(*, require_auth: bool = True) -> Config:
|
||||
boot_snapshot_name=(os.environ.get("BOOT_SNAPSHOT_NAME") or "gpu-rent-boot-ok").strip(),
|
||||
civitai_api_token=(os.environ.get("CIVITAI_API_TOKEN") or "").strip(),
|
||||
civitai_api_host=(os.environ.get("CIVITAI_API_HOST") or "civitai.red").strip().lower(),
|
||||
hf_token=(
|
||||
os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN") or ""
|
||||
).strip(),
|
||||
models_manifest=models_manifest,
|
||||
extensions_manifest=extensions_manifest,
|
||||
git_token=(os.environ.get("GIT_TOKEN") or "").strip(),
|
||||
|
||||
Reference in New Issue
Block a user