Hello and thank you! I looked up this issue but I keep getting topics about ‘tokenizer’ and did not find anything on using access tokens.
I simply want to login to Huggingface HUB using an access token. I signed up, read the card, accepted its terms by checking the box, setup a conda env, installed huggingface-cli, and then executed huggingface-cli login. When I try and paste my access token (I have tried both read and write) it gives me the following error:
Traceback (most recent call last):
File "C:\Users\mrlor\anaconda3\envs\ldm\Scripts\huggingface-cli-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\huggingface_cli.py", line 41, in main
service.run()
File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\user.py", line 176, in run
_login(self._api, token=token)
File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\user.py", line 343, in _login
token, name = hf_api._validate_or_retrieve_token(token)
File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\hf_api.py", line 691, in _validate_or_retrieve_token
raise ValueError("Invalid token passed!")
ValueError: Invalid token passed!
I have also tried typing in the access token by hand. I have deleted and created new access tokens. I also have git lfs setup. I restarted my computer and have updated my conda environment. I am sure this is something silly but I have been trying for hours to login with no avail. I thank you for your help!
Not sure if it’s as convenient as pasting your token, but it might work.
UPDATE: Oh I just realized you are on Windows. I guess my advice might not apply, since I don’t know how to pass code in the command line in Windows. But in general, I guess try using Python to do the login?
So what ended up working for me was instead of using Ctrl+V to paste the access token I right-clicked on the command line and it pasted it. Note that you still won’t see anything on the ‘Token:’ line but it is should be there. Hope this helps!!
I cant yet. I have the same problem. I right clicked before to verify that it copied it and if it was pasted, then I used huggingface-cli login, Enter, right click on the command line and enter and nothing. It won’t let me write either.
I wasn’t able to create my token with a username or my name so I tried my email registered to huggingface. I used the right click to paste function and it worked. Hope that helps
Thank you all for posting your tricks for logging in! It seems that using hotkeys to paste in the token DOES NOT work (in Windows) so you will have to resort to right-clicking to paste in your token or using Edit->Paste from the toolbar. Note again that you will not see the token on the command line and will not see asterixis in its place; it will appear completely invisible but will be submitted after your press enter.
Same issue. "ValueError: Invalid token passed! in powershell with correct toket right clicked (at top) and pasted in. I even cleared my token and tried a fresh one…no luck.
Nevermind. Right click edit paste worked. You just won’t see any indication you put in the key. Then press enter. I was probably pasting multiple times or something stupid as the key input field would not show any change but just blink even with the key put it. Anyhoo, it works.
In the anaconda prompt, just the act of right-clicking will paste your item. I got mine to work by copying the token, typing: huggingface-cli login into the anaconda prompt, literally just right-clicking on the window, and pressing enter.
Also, another way to go is to go to your “\virtualenv\Lib\site-packages\huggingface_hub\commands” folder and there is a file in there called “user” or “userpy”. Edit the file and go to the area in the middle that looks like the huggingface login. The line should say token = getpass ("Token: ") Change this line to say token = “this is where your hugging face token goes including the quotation marks” #getpass("Token: ")
It looks like pasting the token actually works fine for me. The problem is just that the login screen doesn’t show any visual indication that it does! So, just use whatever way you normally paste text onto your terminal screen on this login screen and hit Enter, and it’ll work. Seems like a very trivial fix on the login screen to at least shows dots in-place once the pasted text is entered.