Add Hugging Face authentication procedure for IDEs (PyCharm, VS Code,…#38954
Merged
Conversation
Contributor
Author
|
Hi @stevhliu, could you please review this PR and let me know if any improvements are needed? |
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
reviewed
Jun 23, 2025
stevhliu
left a comment
Member
There was a problem hiding this comment.
Thanks, left some notes about keeping it simple!
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: |
Member
There was a problem hiding this comment.
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 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> |
Member
There was a problem hiding this comment.
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 |
Contributor
Author
|
Hi @stevhliu, I made some changes. Please review and let me know if there's room for improvement. |
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… 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
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
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.