Huggingface Hub
Link to Huggingface Hub for acess to Models and Datasets
We will be connecting to the Huggingface Hub to allow models and datasets to be downloaded to the Axolotl directory.
What is the Huggingface Hub?
The Hugging Face Hub is a platform with a collection of model and datasets. Huggingface aim to be the github repository for artificial intelligence and machine learning.
Signing Up for a Hugging Face Account
Visit the Hugging Face Website: Head to the Hugging Face website (https://huggingface.co/) to begin the account creation process.
Click on “Sign Up”: Locate the “Sign Up” button on the top right corner of the homepage and click on it.
Choose a Sign-Up Method: Hugging Face offers multiple sign-up methods, including Google, GitHub, and email. Select your preferred method and follow the prompts to complete the registration.
Verify Your Email (if applicable): If you choose to sign up via email, verify your email address by clicking on the confirmation link sent to your inbox.
Complete Your Profile: Enhance your Hugging Face experience by completing your profile. Add a profile picture, a short bio, and any other details you’d like to share with the community.
Creating an Access Token
To get a Huggingface access token follow these instructions:
Command Line Interface (CLI)
With a Huggingface account established and an access token you can now access the HuggingFace hub through a command line interface.
The huggingface_hub
Python package comes with a built-in CLI called huggingface-cli
. This tool allows you to interact with the Hugging Face Hub directly from a terminal.
First, install the CLI and its extra dependencies, including the [cli] extras, for an improved user experience:
pip3 install -U "huggingface_hub[cli]"
Verify that the CLI is correctly set up by running the following command:
huggingface-cli --help
You should see a list of available options and commands. If you encounter an error like "command not found: huggingface-cli," please refer to the installation guide for troubleshooting.
Now try this command:
huggingface-cli whoami
When logged into the HuggingFace Hub this command prints your username and the organisations you are a part of on the Hub.
At this stage, we have not yet logged into the HuggingFace Hub, so the response will be:
Not logged in
To connect to the Huggingface Hub prepare your machine to allow storing of the Huggingface token:
git config --global credential.helper store
This command tells Git to use a simple storage method to save your credentials, which can be a security risk as credentials are stored in plain text - but is fine during development.
Enter the command to login to the Huggingface Hub
huggingface-cli login
You will be asked to enter a Huggingface token as per the code block below:
> huggingface-cli login
_| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|
_| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|
_| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|
A token is already saved on your machine. Run `huggingface-cli whoami` to get more information or `huggingface-cli logout` if you want to log out.
Setting a new token will erase the existing one.
To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Token:
You will then be asked whether you want to add the Huggingface token to be added as a git credential. Answer yes (y) to this question. The output should be as below:
Add token as git credential? (Y/n) Y
Token is valid (permission: read).
Your token has been saved in your configured git credential helpers (store).
Your token has been saved to /home/jack/.cache/huggingface/token
Login successful
This command tells Git to use a simple storage method to save your credentials, which can be a security risk as credentials are stored in plain text - but is fine during development.
Now check to ensure you are logged in:
huggingface-cli whoami
Now that we have logged into the HuggingFace hub the output should be:
<your name>
orgs: <your organisation>
You can clearly see your name, and the name of the organization.
Congratulations!
You have established the Axolotl platform and connected to Huggingface.
Last updated
Was this helpful?