Hugging Face CLI

1.11.0 · active · verified Fri Apr 17

The `hf` library provides a command-line interface (CLI) for interacting with the Hugging Face Hub. It allows users to manage models, datasets, and Spaces, perform authentication, and execute various repository operations directly from the terminal. As of version 1.11.0, it includes features like semantic search for Spaces and server-side file copy operations. This library is updated frequently, often in sync with releases of the underlying `huggingface_hub` Python library.

Common errors

Warnings

Install

Quickstart

This quickstart demonstrates how to log in, verify authentication, create a new repository, and upload a file using the `hf` CLI. Replace `username` with your Hugging Face username.

# Log in to the Hugging Face Hub
hf login

# Check your current logged-in user
hf whoami

# Create a new private model repository
hf repo create my-awesome-model --type model --private

# Upload a file to an existing repository
echo "Hello from CLI" > README.md
hf upload README.md --repo-id username/my-awesome-model --commit-message "Add README via CLI"

view raw JSON →