You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In HfApi.whoami, we raise a custom error if token is invalid:
"Invalid user token. If you didn't pass a user token, make sure you ""are properly logged in by executing `huggingface-cli login`, and ""if you did pass a user token, double-check it's correct."
It would be great to customize the error message depending on the user case. Especially depending on if:
token comes from input parameter
token comes from HF_TOKEN env variable
token comes from ~/.cache/huggingface/token local file
token comes from Google Colab vault
Current error hides this to the user which can be frustrating. Typically if an outdated HF_TOKEN env variable is set and user has logged in using huggingface-cli login (i.e. saving token to a file), the env variable will still take precedence. A better error message would be less confusing in that case.
In
HfApi.whoami
, we raise a custom error if token is invalid:It would be great to customize the error message depending on the user case. Especially depending on if:
HF_TOKEN
env variable~/.cache/huggingface/token
local fileCurrent error hides this to the user which can be frustrating. Typically if an outdated
HF_TOKEN
env variable is set and user has logged in usinghuggingface-cli login
(i.e. saving token to a file), the env variable will still take precedence. A better error message would be less confusing in that case.See
huggingface_hub/src/huggingface_hub/hf_api.py
Line 1642 in ef46eae
(quickly discussed it on private slack)
The text was updated successfully, but these errors were encountered: