How to login to Huggingface Hub with Access Token

I have the same issue, when i enter or paste the string, nothing happens on the coursor, like all my input gets blocked, yes im also on windows:

hoping for help :slight_smile:

1 Like

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!!

10 Likes

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. :frowning:

1 Like

How do you even right click? I can’t right click on anaconda prompt :confused:

1 Like

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

Even when I paste the token into the command line, it calls the token invalid

EDIT: I did it several times in a row and it finally worked, don’t know how.

i just have to come here and say that:

  1. run the command prompt as admin
  2. copy your token in
  3. wait about 5 minutes
  4. run huggingface-cli login
  5. right-click the top bar of the command line window, go to “Edit”, and then Paste
  6. it should work. IF IT DOESN’T WORK, DO IT UNTIL IT DOES.
1 Like

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.

1 Like

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.

1 Like

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.

2 Likes

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.

1 Like

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: ")

save file then run huggingface-cli login

2 Likes

If you are using anaconda prompt and is having [WinError 2] File Not Found issue, try to install git first using the following command,

conda install -c anaconda git

2 Likes

thanks for this! this worked for me :slight_smile:

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.

same for me, this seems to be the problem

I initially created read and write tokens at Hugging Face – The AI community building the future. as below:

In the python code, I am using the following import and the necessary access token.

from huggingface_hub import login
access_token_read = “abc”
access_token_write = “xyz”
login(token = access_token_read)

1 Like

That worked !!

So I’m guessing you guys are on Windows, the EASIEST thing is in your command prompt set the environment variable HF_TOKEN and the download-model.py script will do the rest assuming you’re using oogabooga

set HF_TOKEN=<YOUR_TOKEN>

ctrl + “right click”