Hugging Face cheatsheet
Hugging Face: Command line (hf)
10 common Hugging Face tasks.
Install the Hub client
Install the library that provides the hf command.
pip install -U huggingface_hub
Log in
Sign in with an access token from your account settings, to use private models or upload.
hf auth login
Authenticate with an environment variable
Set a token for scripts and CI instead of logging in interactively. Keep it out of source control.
export HF_TOKEN="your-access-token"
Download a model
Download all files of a model repository into the local cache.
hf download Qwen/Qwen2.5-0.5B-Instruct
Download one file
Download a single file from a repository.
hf download bert-base-uncased config.json
Download a dataset
Download a dataset repository by naming its type.
hf download squad --repo-type dataset
Download into a folder
Save files in a folder of your choice instead of the cache.
hf download Qwen/Qwen2.5-0.5B-Instruct --local-dir ./model
Upload files
Upload a local folder to the root of a repository.
hf upload my-user/my-model ./model-folder .