Hugging Face CLI Login

Hi,

Been trying to use hugging face to use some of the image models. However when I try to login using the CLI, it asks me for a token. I am then able to retrieve the token, but I cannot input the token into my terminal at all. I cannot type it in, I cannot paste it in. Nothing works to get that token in there and authenticate my account. Any help on this issue would be appreciated. Thanks.

To protect your login token, you can use an environment variable. Here’s how you can code to use environment variables for storing sensitive information:

Say you’re using Python
import os
token = os.getenv(‘HUGGINGFACE_TOKEN’)
if token is None:
raise ValueError(“HUGGINGFACE_TOKEN is not set in the environment variables”)
login(token=token)

This way, your token remains hidden and is not directly exposed in your code.

what is your login?
NameError: name ‘login’ is not defined

If I already download how to set the parameter to load the model that I download

When it asks you to input your Token, it doesn’t display when you type it to protect it. Every keystroke is being typed, it just doesn’t show. Once you copy your token, you can right click in the terminal window to paste it. Then just press Enter even though the line looks blank. It may ask you for a yes or no (just type Y and press enter)

Now you’re logged in!

if I want to design a server that everyone can use without token.
Does I need to use many token?