huggingface-cli(1)
Command-line interface for interacting with Hugging Face Hub, managing models, datasets, and user authentication.
Synopsis
huggingface-cli [COMMAND] [OPTIONS]Description
The huggingface-cli tool provides a command-line interface to the Hugging Face Hub, enabling users to download models and datasets, manage repositories, handle authentication, and perform model inference directly from the terminal.
It integrates with the transformers and datasets libraries, allowing seamless interaction with thousands of pre-trained models and datasets hosted on huggingface.co without writing Python code.
Common options
| Flag | What it does |
|---|---|
login | Authenticate with Hugging Face Hub using your access token |
logout | Remove stored Hugging Face credentials from the system |
whoami | Display the currently logged-in user information |
--help | Show help message and list available commands |
-v, --version | Display the installed version of huggingface-cli |
download | Download a model or dataset from Hub to local storage |
scan-cache | Inspect and manage cached models and datasets |
delete-cache | Delete cached Hub repositories from the local cache directory |
repo create | Create a new model or dataset repository on the Hub |
repo upload | Upload local files to an existing Hub repository |
Examples
Interactively authenticate with Hugging Face Hub using your token from huggingface.co/settings/tokens
huggingface-cli loginDisplay the username and organization of the currently authenticated user
huggingface-cli whoamiDownload the GPT-2 model from the Hub to the local directory ./my-model
huggingface-cli download gpt2 --local-dir ./my-modelList all cached models and datasets with their sizes and last access times
huggingface-cli scan-cacheRemove cached repositories not accessed in the last 30 days
huggingface-cli delete-cache --strategy delete-older-than --strategy-config 30Create a new public model repository on the Hub under your account
huggingface-cli repo create --repo-type model --repo-name my-awesome-modelRemove stored authentication credentials from the local system
huggingface-cli logout