mirror of
https://github.com/invoke-ai/InvokeAI
synced 2026-03-02 04:59:06 +01:00
Fix: Replace deprecated huggingface_hub.get_token_permission() with whoami() (#8913)
`get_token_permission` is deprecated and will be removed in huggingface_hub 1.0. Use `whoami()` to validate the token instead, as recommended by the deprecation warning.
This commit is contained in:
parent
4fd5cd26a0
commit
ec46b5cb9e
@ -1141,11 +1141,11 @@ class HFTokenHelper:
|
||||
@classmethod
|
||||
def get_status(cls) -> HFTokenStatus:
|
||||
try:
|
||||
if huggingface_hub.get_token_permission(huggingface_hub.get_token()):
|
||||
# Valid token!
|
||||
return HFTokenStatus.VALID
|
||||
# No token set
|
||||
return HFTokenStatus.INVALID
|
||||
token = huggingface_hub.get_token()
|
||||
if not token:
|
||||
return HFTokenStatus.INVALID
|
||||
huggingface_hub.whoami(token=token)
|
||||
return HFTokenStatus.VALID
|
||||
except Exception:
|
||||
return HFTokenStatus.UNKNOWN
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user