Traceback (most recent call last):
File "/pfss/mlde/workspaces/mlde_wsp_Rohrbach/users/ns94feza/.conda/envs/llmonk2/bin/huggingface-cli", line 8, in <module>
sys.exit(main())
^^^^^^
File "/pfss/mlde/workspaces/mlde_wsp_Rohrbach/users/ns94feza/.conda/envs/llmonk2/lib/python3.11/site-packages/huggingface_hub/commands/huggingface_cli.py", line 57, in main
service.run()
File "/pfss/mlde/workspaces/mlde_wsp_Rohrbach/users/ns94feza/.conda/envs/llmonk2/lib/python3.11/site-packages/huggingface_hub/commands/user.py", line 98, in run
login(token=self.args.token, add_to_git_credential=self.args.add_to_git_credential)
File "/pfss/mlde/workspaces/mlde_wsp_Rohrbach/users/ns94feza/.conda/envs/llmonk2/lib/python3.11/site-packages/huggingface_hub/_login.py", line 115, in login
interpreter_login(new_session=new_session, write_permission=write_permission)
File "/pfss/mlde/workspaces/mlde_wsp_Rohrbach/users/ns94feza/.conda/envs/llmonk2/lib/python3.11/site-packages/huggingface_hub/_login.py", line 194, in interpreter_login
_login(token=token, add_to_git_credential=add_to_git_credential, write_permission=write_permission)
File "/pfss/mlde/workspaces/mlde_wsp_Rohrbach/users/ns94feza/.conda/envs/llmonk2/lib/python3.11/site-packages/huggingface_hub/_login.py", line 307, in _login
raise ValueError("Invalid token passed!")
ValueError: Invalid token passed!
I have tried pasting via a right-click instead of cmd+v but that didnât work. This token has worked in the past, and I have tried using a fresh token as well, but nothing has worked so far.
For context, I recently got rate limited while trying to upload some data, so Iâm wondering if that caused this issue. Is there a way to lift the limit? itâs been a few hours since it was applied.
@Wauplin I was wondering if you could somehow help here
Hey @nishadsinghi,
Can you maybe try logging in by passing the token directly as a flag in the terminal:
huggingface-cli login --token hf_yourtoken
If this doesnât resolve the issue, you can try some other discussed solutions in a similar discussion in (@ How to login to Huggingface Hub with Access Token). Let me know if this helps! If the issue persists, feel free to update here.
I tried huggingface-cli login --token my_token and got the same error.
I tried the tips from the link you shared (like pasting the token using the mouse instead of cmd+v) and that doesnât work either.
Let me know if you have any other suggestions!
Itâs not just because of the token, but it seems to happen for other reasons too, such as an old version of git itself⌠As a result, it cannot interpret the tokens.
This happens particularly on Windows.
Hey @nishadsinghi,
Another workaround that seems to work on my end is using a notebook to log in within the same environment where huggingface_hub[cli] is installed. You can try running the following in a .ipynb notebook and paste your token into the displayed textbox:
from huggingface_hub import login
login()
After entering your token, check if youâre successfully logged in by running the following in a terminal:
huggingface-cli whoami
If it displays your Hugging Face username, the login was successful.
Additionally, as @John6666 pointed out, outdated versions of Git can also lead to silent issues. You can check your Git version with:
git --version
If itâs an older version, updating it might help. You can update Git using:
git update
After this, try logging in again using the different methods discussed earlier. Let us know if it works or if youâre still facing issues!
Hi @nnilayy, thanks for the suggestions. I tried logging in through a notebook but still got the same error.
I am using this on a cluster, and I think updating git requires sudo access, so I couldnât do it. I have a feeling that this is not the root cause of the issue, since things were working fine until recently (but I could be wrong).
Maybe cluster is suspicious. But for example, there are often cases where authentication fails due to SSL settings, but in that case, the error message shouldnât be thatâŚ
So Iâm confused.
Hi @nishadsinghi sorry for the inconvenience. Could you try to login using a script just to be 100% sure itâs not a encoding issue with the terminal:
from huggingface_hub import login, whoami
login(token="hf_....")
whoami()
Also, could you install huggingface_hub from source (see install steps) and retry? Weâve recently pushed a small feature that tells you which token has been used when whoami fails. Sometimes it can be due to an environement vairable (HF_TOKEN) mixing with the locally saved one.
Note:huggingface_hub/huggingface-cli are only using HTTP calls and are completely separated from git. There is nothing you can do on the git side that breaks huggingface-cli (and therefore nothing you can do to fix it using git)
And I still get the same âInvalid tokenâ error.
Just for context, I am doing all of this on a remote cluster.
I also tried to login on my local machine using the same token and that works, so the token is not the issue.