$linuxjunkies
>

huggingface-cli(1)

Command-line interface for interacting with Hugging Face Hub, managing models, datasets, and user authentication.

UbuntuDebianFedoraArch

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

FlagWhat it does
loginAuthenticate with Hugging Face Hub using your access token
logoutRemove stored Hugging Face credentials from the system
whoamiDisplay the currently logged-in user information
--helpShow help message and list available commands
-v, --versionDisplay the installed version of huggingface-cli
downloadDownload a model or dataset from Hub to local storage
scan-cacheInspect and manage cached models and datasets
delete-cacheDelete cached Hub repositories from the local cache directory
repo createCreate a new model or dataset repository on the Hub
repo uploadUpload local files to an existing Hub repository

Examples

Interactively authenticate with Hugging Face Hub using your token from huggingface.co/settings/tokens

huggingface-cli login

Display the username and organization of the currently authenticated user

huggingface-cli whoami

Download the GPT-2 model from the Hub to the local directory ./my-model

huggingface-cli download gpt2 --local-dir ./my-model

List all cached models and datasets with their sizes and last access times

huggingface-cli scan-cache

Remove cached repositories not accessed in the last 30 days

huggingface-cli delete-cache --strategy delete-older-than --strategy-config 30

Create a new public model repository on the Hub under your account

huggingface-cli repo create --repo-type model --repo-name my-awesome-model

Remove stored authentication credentials from the local system

huggingface-cli logout

Related commands