Spaces:
Sleeping
Sleeping
metadata
name: hf-cli
description: >-
Hugging Face Hub CLI (`hf`) for downloading, uploading, and managing models,
datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face
Hub. Use when: handling authentication; managing local cache; managing Hugging
Face Buckets; running or scheduling jobs on Hugging Face infrastructure;
managing Hugging Face repos; discussions and pull requests; browsing models,
datasets and spaces; reading, searching, or browsing academic papers; managing
collections; querying datasets; configuring spaces; setting up webhooks; or
deploying and managing HF Inference Endpoints. Make sure to use this skill
whenever the user mentions 'hf', 'huggingface', 'Hugging Face',
'huggingface-cli', or 'hugging face cli', or wants to do anything related to
the Hugging Face ecosystem and to AI and ML in general. Also use for cloud
storage needs like training checkpoints, data pipelines, or agent traces. Use
even if the user doesn't explicitly ask for a CLI command. Replaces the
deprecated `huggingface-cli`.
Install: curl -LsSf https://hf.co/cli/install.sh | bash -s.
The Hugging Face Hub CLI tool hf is available. IMPORTANT: The hf command replaces the deprecated huggingface-cli command.
Use hf --help to view available functions. Note that auth commands are now all under hf auth e.g. hf auth whoami.
Generated with huggingface_hub v1.13.0. Run hf skills add --force to regenerate.
Commands
hf download REPO_IDβ Download files from the Hub.[--type CHOICE --revision TEXT --include TEXT --exclude TEXT --cache-dir TEXT --local-dir TEXT --force-download --dry-run --max-workers INTEGER --format CHOICE]hf envβ Print information about the environment.[--format CHOICE]hf syncβ Sync files between local directory and a bucket.[--delete --ignore-times --ignore-sizes --plan TEXT --apply TEXT --dry-run --include TEXT --exclude TEXT --filter-from TEXT --existing --ignore-existing --verbose --format CHOICE]hf updateβ Update thehfCLI to the latest version.[--format CHOICE]hf upload REPO_IDβ Upload a file or a folder to the Hub. Recommended for single-commit uploads.[--type CHOICE --revision TEXT --private --include TEXT --exclude TEXT --delete TEXT --commit-message TEXT --commit-description TEXT --create-pr --every FLOAT --format CHOICE]hf upload-large-folder REPO_ID LOCAL_PATHβ Upload a large folder to the Hub. Recommended for resumable uploads.[--type CHOICE --revision TEXT --private --include TEXT --exclude TEXT --num-workers INTEGER --no-report --no-bars --format CHOICE]hf versionβ Print information about the hf version.[--format CHOICE]
hf auth β Manage authentication (login, logout, etc.).
hf auth listβ List all stored access tokens.[--format CHOICE]hf auth loginβ Login using a token from huggingface.co/settings/tokens.[--add-to-git-credential --force --format CHOICE]hf auth logoutβ Logout from a specific token.[--token-name TEXT --format CHOICE]hf auth switchβ Switch between access tokens.[--token-name TEXT --add-to-git-credential --format CHOICE]hf auth tokenβ Print the current access token to stdout.[--format CHOICE]hf auth whoamiβ Find out which huggingface.co account you are logged in as.[--format CHOICE]
hf buckets β Commands to interact with buckets.
hf buckets cp SRCβ Copy files to or from buckets.[--format CHOICE]hf buckets create BUCKET_IDβ Create a new bucket.[--private --exist-ok --format CHOICE]hf buckets delete BUCKET_IDβ Delete a bucket.[--yes --missing-ok --format CHOICE]hf buckets info BUCKET_IDβ Get info about a bucket.[--format CHOICE]hf buckets listβ List buckets or files in a bucket.[--human-readable --tree --recursive --search TEXT --format CHOICE]hf buckets move FROM_ID TO_IDβ Move (rename) a bucket to a new name or namespace.[--format CHOICE]hf buckets remove ARGUMENTβ Remove files from a bucket.[--recursive --yes --dry-run --include TEXT --exclude TEXT --format CHOICE]hf buckets syncβ Sync files between local directory and a bucket.[--delete --ignore-times --ignore-sizes --plan TEXT --apply TEXT --dry-run --include TEXT --exclude TEXT --filter-from TEXT --existing --ignore-existing --verbose --format CHOICE]
hf cache β Manage local cache directory.
hf cache listβ List cached repositories or revisions.[--cache-dir TEXT --revisions --filter TEXT --sort CHOICE --limit INTEGER --format CHOICE]hf cache pruneβ Remove detached revisions from the cache.[--cache-dir TEXT --yes --dry-run --format CHOICE]hf cache rm TARGETSβ Remove cached repositories or revisions.[--cache-dir TEXT --yes --dry-run --format CHOICE]hf cache verify REPO_IDβ Verify checksums for a single repo revision from cache or a local directory.[--type CHOICE --revision TEXT --cache-dir TEXT --local-dir TEXT --fail-on-missing-files --fail-on-extra-files --format CHOICE]
hf collections β Interact with collections on the Hub.
hf collections add-item COLLECTION_SLUG ITEM_ID ITEM_TYPEβ Add an item to a collection.[--note TEXT --exists-ok --format CHOICE]hf collections create TITLEβ Create a new collection on the Hub.[--namespace TEXT --description TEXT --private --exists-ok --format CHOICE]hf collections delete COLLECTION_SLUGβ Delete a collection from the Hub.[--missing-ok --format CHOICE]hf collections delete-item COLLECTION_SLUG ITEM_OBJECT_IDβ Delete an item from a collection.[--missing-ok --format CHOICE]hf collections info COLLECTION_SLUGβ Get info about a collection on the Hub.[--format CHOICE]hf collections listβ List collections on the Hub.[--owner TEXT --item TEXT --sort CHOICE --limit INTEGER --format CHOICE]hf collections update COLLECTION_SLUGβ Update a collection's metadata on the Hub.[--title TEXT --description TEXT --position INTEGER --private --theme TEXT --format CHOICE]hf collections update-item COLLECTION_SLUG ITEM_OBJECT_IDβ Update an item in a collection.[--note TEXT --position INTEGER --format CHOICE]
hf datasets β Interact with datasets on the Hub.
hf datasets card DATASET_IDβ Get the dataset card (README) for a dataset on the Hub.[--metadata --text --format CHOICE]hf datasets info DATASET_IDβ Get info about a dataset on the Hub.[--revision TEXT --expand TEXT --format CHOICE]hf datasets leaderboard DATASET_IDβ List model scores from a dataset leaderboard. This command helps find the best models for a task or compare models by benchmark scores.[--limit INTEGER --format CHOICE]hf datasets listβ List datasets on the Hub, or files in a dataset repo.[--search TEXT --author TEXT --filter TEXT --sort CHOICE --limit INTEGER --expand TEXT --human-readable --tree --recursive --revision TEXT --format CHOICE]hf datasets parquet DATASET_IDβ List parquet file URLs available for a dataset.[--subset TEXT --split TEXT --format CHOICE]hf datasets sql SQLβ Execute a raw SQL query with DuckDB against dataset parquet URLs.[--format CHOICE]
hf discussions β Manage discussions and pull requests on the Hub.
hf discussions close REPO_ID NUMβ Close a discussion or pull request.[--comment TEXT --yes --type CHOICE --format CHOICE]hf discussions comment REPO_ID NUMβ Comment on a discussion or pull request.[--body TEXT --body-file PATH --type CHOICE --format CHOICE]hf discussions create REPO_ID --title TEXTβ Create a new discussion or pull request on a repo.[--body TEXT --body-file PATH --pull-request --type CHOICE --format CHOICE]hf discussions diff REPO_ID NUMβ Show the diff of a pull request.[--type CHOICE --format CHOICE]hf discussions info REPO_ID NUMβ Get info about a discussion or pull request.[--type CHOICE --format CHOICE]hf discussions list REPO_IDβ List discussions and pull requests on a repo.[--status CHOICE --kind CHOICE --author TEXT --limit INTEGER --type CHOICE --format CHOICE]hf discussions merge REPO_ID NUMβ Merge a pull request.[--comment TEXT --yes --type CHOICE --format CHOICE]hf discussions rename REPO_ID NUM NEW_TITLEβ Rename a discussion or pull request.[--type CHOICE --format CHOICE]hf discussions reopen REPO_ID NUMβ Reopen a closed discussion or pull request.[--comment TEXT --yes --type CHOICE --format CHOICE]
hf endpoints β Manage Hugging Face Inference Endpoints.
hf endpoints catalog deploy --repo TEXTβ Deploy an Inference Endpoint from the Model Catalog.[--name TEXT --accelerator TEXT --namespace TEXT --format CHOICE]hf endpoints catalog listβ List available Catalog models.[--format CHOICE]hf endpoints delete NAMEβ Delete an Inference Endpoint permanently.[--namespace TEXT --yes --format CHOICE]hf endpoints deploy NAME --repo TEXT --framework TEXT --accelerator TEXT --instance-size TEXT --instance-type TEXT --region TEXT --vendor TEXTβ Deploy an Inference Endpoint from a Hub repository.[--namespace TEXT --task TEXT --min-replica INTEGER --max-replica INTEGER --scale-to-zero-timeout INTEGER --scaling-metric CHOICE --scaling-threshold FLOAT --format CHOICE]hf endpoints describe NAMEβ Get information about an existing endpoint.[--namespace TEXT --format CHOICE]hf endpoints listβ Lists all Inference Endpoints for the given namespace.[--namespace TEXT --format CHOICE]hf endpoints pause NAMEβ Pause an Inference Endpoint.[--namespace TEXT --format CHOICE]hf endpoints resume NAMEβ Resume an Inference Endpoint.[--namespace TEXT --fail-if-already-running --format CHOICE]hf endpoints scale-to-zero NAMEβ Scale an Inference Endpoint to zero.[--namespace TEXT --format CHOICE]hf endpoints update NAMEβ Update an existing endpoint.[--namespace TEXT --repo TEXT --accelerator TEXT --instance-size TEXT --instance-type TEXT --framework TEXT --revision TEXT --task TEXT --min-replica INTEGER --max-replica INTEGER --scale-to-zero-timeout INTEGER --scaling-metric CHOICE --scaling-threshold FLOAT --format CHOICE]
hf extensions β Manage hf CLI extensions.
hf extensions exec NAMEβ Execute an installed extension.hf extensions install REPO_IDβ Install an extension from a public GitHub repository.[--force --format CHOICE]hf extensions listβ List installed extension commands.[--format CHOICE]hf extensions remove NAMEβ Remove an installed extension.[--format CHOICE]hf extensions searchβ Search extensions available on GitHub (tagged with 'hf-extension' topic).[--format CHOICE]
hf jobs β Run and manage Jobs on the Hub.
hf jobs cancel JOB_IDβ Cancel a Job[--namespace TEXT --format CHOICE]hf jobs hardwareβ List available hardware options for Jobs[--format CHOICE]hf jobs inspect JOB_IDSβ Display detailed information on one or more Jobs[--namespace TEXT --format CHOICE]hf jobs logs JOB_IDβ Fetch the logs of a Job.[--follow --tail INTEGER --namespace TEXT --format CHOICE]hf jobs psβ List Jobs.[--all --namespace TEXT --filter TEXT --format TEXT --quiet]hf jobs run IMAGE COMMANDβ Run a Job.[--env TEXT --secrets TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --flavor CHOICE --timeout TEXT --detach --namespace TEXT]hf jobs scheduled delete SCHEDULED_JOB_IDβ Delete a scheduled Job.[--namespace TEXT --format CHOICE]hf jobs scheduled inspect SCHEDULED_JOB_IDSβ Display detailed information on one or more scheduled Jobs[--namespace TEXT --format CHOICE]hf jobs scheduled psβ List scheduled Jobs[--all --namespace TEXT --filter TEXT --format TEXT --quiet]hf jobs scheduled resume SCHEDULED_JOB_IDβ Resume (unpause) a scheduled Job.[--namespace TEXT --format CHOICE]hf jobs scheduled run SCHEDULE IMAGE COMMANDβ Schedule a Job.[--suspend --concurrency --env TEXT --secrets TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --flavor CHOICE --timeout TEXT --namespace TEXT]hf jobs scheduled suspend SCHEDULED_JOB_IDβ Suspend (pause) a scheduled Job.[--namespace TEXT --format CHOICE]hf jobs scheduled uv run SCHEDULE SCRIPTβ Run a UV script (local file or URL) on HF infrastructure[--suspend --concurrency --image TEXT --flavor CHOICE --env TEXT --secrets TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --timeout TEXT --namespace TEXT --with TEXT --python TEXT]hf jobs statsβ Fetch the resource usage statistics and metrics of Jobs[--namespace TEXT --format CHOICE]hf jobs uv run SCRIPTβ Run a UV script (local file or URL) on HF infrastructure[--image TEXT --flavor CHOICE --env TEXT --secrets TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --timeout TEXT --detach --namespace TEXT --with TEXT --python TEXT]
hf models β Interact with models on the Hub.
hf models card MODEL_IDβ Get the model card (README) for a model on the Hub.[--metadata --text --format CHOICE]hf models info MODEL_IDβ Get info about a model on the Hub.[--revision TEXT --expand TEXT --format CHOICE]hf models listβ List models on the Hub, or files in a model repo.[--search TEXT --author TEXT --filter TEXT --num-parameters TEXT --sort CHOICE --limit INTEGER --expand TEXT --human-readable --tree --recursive --revision TEXT --format CHOICE]
hf papers β Interact with papers on the Hub.
hf papers info PAPER_IDβ Get info about a paper on the Hub.[--format CHOICE]hf papers listβ List daily papers on the Hub.[--date TEXT --week TEXT --month TEXT --submitter TEXT --sort CHOICE --limit INTEGER --format CHOICE]hf papers read PAPER_IDβ Read a paper as markdown.[--format CHOICE]hf papers search QUERYβ Search papers on the Hub.[--limit INTEGER --format CHOICE]
hf repos β Manage repos on the Hub.
hf repos branch create REPO_ID BRANCHβ Create a new branch for a repo on the Hub.[--revision TEXT --type CHOICE --exist-ok --format CHOICE]hf repos branch delete REPO_ID BRANCHβ Delete a branch from a repo on the Hub.[--type CHOICE --format CHOICE]hf repos create REPO_IDβ Create a new repo on the Hub.[--type CHOICE --space-sdk TEXT --private --public --protected --exist-ok --resource-group-id TEXT --flavor CHOICE --storage CHOICE --sleep-time INTEGER --secrets TEXT --secrets-file TEXT --env TEXT --env-file TEXT --volume TEXT --format CHOICE]hf repos delete REPO_IDβ Delete a repo from the Hub. This is an irreversible operation.[--type CHOICE --missing-ok --yes --format CHOICE]hf repos delete-files REPO_ID PATTERNSβ Delete files from a repo on the Hub.[--type CHOICE --revision TEXT --commit-message TEXT --commit-description TEXT --create-pr --format CHOICE]hf repos duplicate FROM_IDβ Duplicate a repo on the Hub (model, dataset, or Space).[--type CHOICE --private --public --protected --exist-ok --flavor CHOICE --storage CHOICE --sleep-time INTEGER --secrets TEXT --secrets-file TEXT --env TEXT --env-file TEXT --volume TEXT --format CHOICE]hf repos move FROM_ID TO_IDβ Move a repository from a namespace to another namespace.[--type CHOICE --format CHOICE]hf repos settings REPO_IDβ Update the settings of a repository.[--gated CHOICE --private --public --protected --type CHOICE --format CHOICE]hf repos tag create REPO_ID TAGβ Create a tag for a repo.[--message TEXT --revision TEXT --type CHOICE --format CHOICE]hf repos tag delete REPO_ID TAGβ Delete a tag for a repo.[--yes --type CHOICE --format CHOICE]hf repos tag list REPO_IDβ List tags for a repo.[--type CHOICE --format CHOICE]
hf skills β Manage skills for AI assistants.
hf skills addβ Download a Hugging Face skill and install it for an AI assistant.[--claude --global --dest PATH --force --format CHOICE]hf skills previewβ Print the generatedhf-cliSKILL.md to stdout.[--format CHOICE]hf skills upgradeβ Upgrade installed Hugging Face marketplace skills.[--claude --global --dest PATH --format CHOICE]
hf spaces β Interact with spaces on the Hub.
hf spaces card SPACE_IDβ Get the Space card (README) for a Space on the Hub.[--metadata --text --format CHOICE]hf spaces dev-mode SPACE_IDβ Enable or disable dev mode on a Space.[--stop --format CHOICE]hf spaces hardwareβ List available hardware options for Spaces.[--format CHOICE]hf spaces hot-reload SPACE_IDβ Hot-reload any Python file of a Space without a full rebuild + restart.[--local-file PATH --skip-checks --skip-summary --format CHOICE]hf spaces info SPACE_IDβ Get info about a space on the Hub.[--revision TEXT --expand TEXT --format CHOICE]hf spaces listβ List spaces on the Hub, or files in a space repo.[--search TEXT --author TEXT --filter TEXT --sort CHOICE --limit INTEGER --expand TEXT --human-readable --tree --recursive --revision TEXT --format CHOICE]hf spaces logs SPACE_IDβ Fetch the run or build logs of a Space.[--build --follow --tail INTEGER --format CHOICE]hf spaces pause SPACE_IDβ Pause a Space.[--format CHOICE]hf spaces restart SPACE_IDβ Restart a Space.[--factory-reboot --format CHOICE]hf spaces search QUERYβ Search spaces on the Hub using semantic search.[--filter TEXT --sdk TEXT --include-non-running --description --limit INTEGER --format CHOICE]hf spaces settings SPACE_IDβ Update the settings of a Space.[--sleep-time INTEGER --hardware CHOICE --format CHOICE]hf spaces volumes delete SPACE_IDβ Remove all volumes from a Space.[--yes --format CHOICE]hf spaces volumes list SPACE_IDβ List volumes mounted in a Space.[--format CHOICE]hf spaces volumes set SPACE_IDβ Set (replace) volumes for a Space.[--volume TEXT --format CHOICE]
hf webhooks β Manage webhooks on the Hub.
hf webhooks create --watch TEXTβ Create a new webhook.[--url TEXT --job-id TEXT --domain CHOICE --secret TEXT --format CHOICE]hf webhooks delete WEBHOOK_IDβ Delete a webhook permanently.[--yes --format CHOICE]hf webhooks disable WEBHOOK_IDβ Disable an active webhook.[--format CHOICE]hf webhooks enable WEBHOOK_IDβ Enable a disabled webhook.[--format CHOICE]hf webhooks info WEBHOOK_IDβ Show full details for a single webhook.[--format CHOICE]hf webhooks listβ List all webhooks for the current user.[--format CHOICE]hf webhooks update WEBHOOK_IDβ Update an existing webhook. Only provided options are changed.[--url TEXT --watch TEXT --domain CHOICE --secret TEXT --format CHOICE]
Common options
--formatβ Output format:--format json(or--json) or--format table(default).-q / --quietβ Print only IDs (one per line).--revisionβ Git revision id which can be a branch name, a tag, or a commit hash.--tokenβ Use a User Access Token. Prefer settingHF_TOKENenv var instead of passing--token.--typeβ The type of repository (model, dataset, or space).
Mounting repos as local filesystems
To mount Hub repositories or buckets as local filesystems β no download, no copy, no waiting β use hf-mount. Files are fetched on demand. GitHub: https://github.com/huggingface/hf-mount
Install: curl -fsSL https://raw.githubusercontent.com/huggingface/hf-mount/main/install.sh | sh
Some command examples:
hf-mount start repo openai-community/gpt2 /tmp/gpt2β mount a repo (read-only)hf-mount start --hf-token $HF_TOKEN bucket myuser/my-bucket /tmp/dataβ mount a bucket (read-write)hf-mount status/hf-mount stop /tmp/dataβ list or unmount
Tips
- Use
hf <command> --helpfor full options, descriptions, usage, and real-world examples - Authenticate with
HF_TOKENenv var (recommended) or with--token - Update the CLI with
hf update(uses the correct command for the detected install method)