| name | hugging-face-cli |
| description | Operates the Hugging Face Hub via the hf CLI (replaces huggingface-cli): download/upload models datasets spaces, auth, cache, buckets, jobs, inference endpoints, collections, papers, and webhooks. Use when the task is Hub file or repo operations from a terminal. Not for training loops, Gradio Space Python, or treating huggingface_hub Python as the primary interface. |
| version | 1.0.1 |
| risk | unknown |
| source | https://github.com/huggingface/skills/tree/main/skills/hf-cli |
| source_repo | huggingface/skills |
| source_type | official |
| date_added | 2026-07-01T00:00:00.000Z |
| license | Apache-2.0 |
| license_source | https://github.com/huggingface/skills/blob/main/LICENSE |
When to Use
Use this skill when you need to interact with the Hugging Face Hub via the hf CLI. This includes:
- Downloading, uploading, and managing models, datasets, and spaces.
- Handling authentication and managing local cache.
- Managing Hugging Face Buckets.
- Running or scheduling jobs on Hugging Face infrastructure.
- Deploying and managing Inference Endpoints.
- Interacting with collections, discussions, papers, and webhooks.
Prerequisites
- The
hf CLI must be installed.
- A Hugging Face account and Access Token (set as
HF_TOKEN environment variable or passed via --token).
- Windows host is primary (PowerShell). If using bash commands from external sources, ensure you have a compatible shell (e.g., Git Bash, WSL) or adapt them.
Procedure
1. Installation
Install the hf CLI by downloading the installer script, reviewing it, and running it locally.
PowerShell (Windows Host):
$tmpdir = New-Item -ItemType Directory -Path (Join-Path $env:TEMP ([System.Guid]::NewGuid().ToString()))
$installScript = Join-Path $tmpdir.FullName "hf-install.sh"
Invoke-WebRequest -Uri "https://hf.co/cli/install.sh" -OutFile $installScript
# Review the script before running
Get-Content $installScript
# Run the script (requires bash, e.g., via Git Bash or WSL)
bash $installScript
Remove-Item -Recurse -Force $tmpdir.FullName
Note: The hf command replaces the deprecated huggingface-cli command.
2. Authentication
Authenticate using a token from huggingface.co/settings/tokens.
# Recommended: Set HF_TOKEN environment variable
$env:HF_TOKEN = "YOUR_KEY"
# Or login via browser
hf auth login
# Verify login
hf auth whoami
3. Core Commands
Downloading and Uploading
- Download a model:
hf download openai-community/gpt2 --local-dir ./gpt2
- Upload a folder:
hf upload my-username/my-model ./local-folder --type model
- Upload large folder (resumable):
hf upload-large-folder my-username/my-model ./large-folder --type model