|
AQIT 0.1.0
|
Functions | |
| dict[str, str] | _read_json (Path path) |
| str | _local_hf_token () |
| str | _cached_hf_token () |
| str | _aquin_api_key () |
| str | _aquin_base_url () |
| bool | _aquin_logged_in () |
| None | _apply_hf_token (str token) |
| str | _fetch_proxy_token () |
| str | resolve_hf_token () |
| dict[str, Any] | hf_hub_kwargs () |
| bool | ensure_hf_login (*, bool quiet=False) |
| str | _proxy_unavailable_hint () |
| None | require_hf_hub_auth (*, str hf_repo) |
| str | gated_repo_hint (str hf_repo) |
Variables | |
| str | _CONFIG_PATH = Path.home() / ".aquin" / "config.json" |
| str | _ENGINE_STATE = Path.home() / ".aquin" / "engine.json" |
| str | _HF_CACHE_TOKEN = Path.home() / ".cache" / "huggingface" / "token" |
| str | _proxy_token = None |
| str | _last_proxy_error = None |
|
protected |
Expose token to huggingface_hub / transformers via env only (no interactive login).
Definition at line 64 of file hf_auth.py.
References _local_hf_token().
Referenced by ensure_hf_login(), hf_hub_kwargs(), and require_hf_hub_auth().
|
protected |
Definition at line 47 of file hf_auth.py.
Referenced by _aquin_logged_in(), and _fetch_proxy_token().
|
protected |
Definition at line 52 of file hf_auth.py.
References _read_json().
|
protected |
Definition at line 60 of file hf_auth.py.
References _aquin_api_key().
Referenced by gated_repo_hint(), require_hf_hub_auth(), and resolve_hf_token().
|
protected |
Definition at line 41 of file hf_auth.py.
Referenced by ensure_hf_login(), and resolve_hf_token().
|
protected |
Fetch HF hub token from Aquin API (Bearer aquin API key).
Definition at line 74 of file hf_auth.py.
References _aquin_api_key().
Referenced by resolve_hf_token().
|
protected |
Definition at line 34 of file hf_auth.py.
Referenced by _apply_hf_token(), ensure_hf_login(), and resolve_hf_token().
|
protected |
Definition at line 160 of file hf_auth.py.
Referenced by gated_repo_hint(), and require_hf_hub_auth().
|
protected |
Definition at line 24 of file hf_auth.py.
Referenced by _aquin_base_url().
| bool ensure_hf_login | ( | * | , |
| bool | quiet = False ) |
Authenticate huggingface_hub for gated downloads. Prefers HF_TOKEN locally; otherwise optional AQUIN_API_KEY proxy if configured.
Definition at line 145 of file hf_auth.py.
References _apply_hf_token(), _cached_hf_token(), _local_hf_token(), and resolve_hf_token().
| str gated_repo_hint | ( | str | hf_repo | ) |
Definition at line 184 of file hf_auth.py.
References _aquin_logged_in(), _proxy_unavailable_hint(), and resolve_hf_token().
| dict[str, Any] hf_hub_kwargs | ( | ) |
Ensure HF auth is configured. Returns {} : env-based auth avoids duplicate token= in TL.
Definition at line 137 of file hf_auth.py.
References _apply_hf_token(), and resolve_hf_token().
| None require_hf_hub_auth | ( | * | , |
| str | hf_repo ) |
Resolve HF auth before model download. Raises if Aquin login is set but the server proxy cannot supply a token.
Definition at line 170 of file hf_auth.py.
References _apply_hf_token(), _aquin_logged_in(), _proxy_unavailable_hint(), and resolve_hf_token().
| str resolve_hf_token | ( | ) |
Return an HF hub token from env, local cache, or Aquin web proxy.
Definition at line 127 of file hf_auth.py.
References _aquin_logged_in(), _cached_hf_token(), _fetch_proxy_token(), and _local_hf_token().
Referenced by ensure_hf_login(), gated_repo_hint(), hf_hub_kwargs(), and require_hf_hub_auth().
|
protected |
Definition at line 16 of file hf_auth.py.
|
protected |
Definition at line 17 of file hf_auth.py.
|
protected |
Definition at line 18 of file hf_auth.py.
|
protected |
Definition at line 21 of file hf_auth.py.
|
protected |
Definition at line 20 of file hf_auth.py.