Skip to content

Add Hugging Face authentication procedure for IDEs (PyCharm, VS Code,…#38954

Merged
stevhliu merged 2 commits into
huggingface:mainfrom
marcndo:doc/38918_authentication
Jun 24, 2025
Merged

Add Hugging Face authentication procedure for IDEs (PyCharm, VS Code,…#38954
stevhliu merged 2 commits into
huggingface:mainfrom
marcndo:doc/38918_authentication

Conversation

@marcndo

@marcndo marcndo commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

… etc.)

What does this PR do?

This PR aims to resolve #38918 by guiding users on how to authenticate their Hugging Face accounts using IDEs (PyCharm, VS Code, etc.).

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@marcndo

marcndo commented Jun 21, 2025

Copy link
Copy Markdown
Contributor Author

Hi @stevhliu, could you please review this PR and let me know if any improvements are needed?

@marcndo

marcndo commented Jun 23, 2025

Copy link
Copy Markdown
Contributor Author

Hi @stevhliu, just following up on the PR to check if you had a chance to review it, and let me know if any changes are required. Thanks a lot!

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, left some notes about keeping it simple!

Comment thread docs/source/en/quicktour.md Outdated
Comment on lines +35 to +44
### Authenticate with Hugging Face
<hfoptions id="authenticate">
1. For Jupyter Notebooks:
<hfoption id="notebook">
If you're working in a Jupyter Notebook, you can log in to your Hugging Face account using the `notebook_login` function from the `huggingface_hub` library. Here's how to do it:
- Install the necessary library if you haven't already:
```bash
pip install huggingface_hub
```
- Use the following code to log in:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be even simpler:

Suggested change
### Authenticate with Hugging Face
<hfoptions id="authenticate">
1. For Jupyter Notebooks:
<hfoption id="notebook">
If you're working in a Jupyter Notebook, you can log in to your Hugging Face account using the `notebook_login` function from the `huggingface_hub` library. Here's how to do it:
- Install the necessary library if you haven't already:
```bash
pip install huggingface_hub
```
- Use the following code to log in:
<hfoptions id="authenticate">
<hfoption id="notebook">
Paste your User Access Token into [`~huggingface_hub.notebook_login`] when prompted to log in.

Comment thread docs/source/en/quicktour.md Outdated
Comment on lines +50 to +53
This will trigger a login prompt that will ask you to paste your Hugging Face token.
You can find your token on your [Hugging Face settings page](https://huggingface.co/settings/tokens)
</hfoption>

2. For IDEs (PyCharm, VS Code, etc.):
<hfoption id="CLI">
If you're using an IDE like PyCharm or VS Code, follow these steps to log in to your Hugging Face account via the command line interface (CLI):
- Install the `huggingface_hub` CLI:
You need to install the `huggingface_hub[cli]` package. You can do this by running the following command:
```bash
pip install -U "huggingface_hub[cli]"
```
- Log in using the CLI:
Run the following command in your terminal:
```huggingface-cli login```
This will prompt you to enter your Hugging Face token. Paste your token and hit Enter.
Once you input the token, the CLI will authenticate your session, and you will be logged into Hugging Face.
For more details and available options for huggingface-cli, you can use:
```bash
huggingface-cli --help
```
Or check the official [documentation](https://huggingface.co/docs/huggingface_hub/guides/cli
) for further information.
</hfoption>
</hfoptions>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This will trigger a login prompt that will ask you to paste your Hugging Face token.
You can find your token on your [Hugging Face settings page](https://huggingface.co/settings/tokens)
</hfoption>
2. For IDEs (PyCharm, VS Code, etc.):
<hfoption id="CLI">
If you're using an IDE like PyCharm or VS Code, follow these steps to log in to your Hugging Face account via the command line interface (CLI):
- Install the `huggingface_hub` CLI:
You need to install the `huggingface_hub[cli]` package. You can do this by running the following command:
```bash
pip install -U "huggingface_hub[cli]"
```
- Log in using the CLI:
Run the following command in your terminal:
```huggingface-cli login```
This will prompt you to enter your Hugging Face token. Paste your token and hit Enter.
Once you input the token, the CLI will authenticate your session, and you will be logged into Hugging Face.
For more details and available options for huggingface-cli, you can use:
```bash
huggingface-cli --help
```
Or check the official [documentation](https://huggingface.co/docs/huggingface_hub/guides/cli
) for further information.
</hfoption>
</hfoptions>
</hfoption>
<hfoption id="CLI">
Make sure the [huggingface_hub[cli]](https://huggingface.co/docs/huggingface_hub/guides/cli#getting-started) package is installed and run the command below. Paste your User Access Token when prompted to log in.
```bash
huggingface-cli login
```

@marcndo

marcndo commented Jun 24, 2025

Copy link
Copy Markdown
Contributor Author

Hi @stevhliu, I made some changes. Please review and let me know if there's room for improvement.

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving!

@stevhliu
stevhliu merged commit 48b6ef0 into huggingface:main Jun 24, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lack of IDE-Specific Authentication Instructions in Hugging Face "Quickstart" Documentation

3 participants