PromptShop

Hf Cli

The Hugging Face CLI skill provides access to the hf command-line tool for interacting with the Hugging Face Hub. It allows users to download and upload file...

Install

npx promptshop add hf-cli

Details

What This Skill Does

  • The Hugging Face CLI skill provides access to the hf command-line tool for interacting with the Hugging Face Hub.
  • It allows users to download and upload files, manage authentication, and sync files between local directories and buckets.
  • This skill is helpful for developers who prefer using the command line to manage their Hugging Face resources.

When to Use

  • Download files from the Hugging Face Hub.
  • Upload files or folders to the Hub.
  • Manage authentication (login, logout, switch accounts).
  • Sync files between local directory and a bucket.
  • Print information about the environment.
  • Check the version of the Hugging Face CLI.

Key Features

  • Download files with specific types, revisions, and filters.
  • Upload files with options for privacy, commit messages, and large folders.
  • Manage authentication tokens and switch between accounts.
  • Sync files with options for deletion, ignoring times/sizes, and filtering.
  • List stored access tokens.
  • Provides help documentation via hf --help.

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.8.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 --quiet --max-workers INTEGER] hf env — Print information about the environment. 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 --quiet]

  • 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 --quiet].
  • 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]. hf version — Print information about the hf version.

hf auth — Manage authentication (login, logout, etc.).

hf auth list — List all stored access tokens. hf auth login — Login using a token from huggingface.co/settings/tokens. [--add-to-git-credential --force] hf auth logout — Logout from a specific token. [--token-name TEXT] hf auth switch — Switch between access tokens. [--token-name TEXT --add-to-git-credential] 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 a single file to or from a bucket. [--quiet] hf buckets create BUCKET_ID — Create a new bucket. [--private --exist-ok --quiet] hf buckets delete BUCKET_ID — Delete a bucket. [--yes --missing-ok --quiet] hf buckets info BUCKET_ID — Get info about a bucket. [--quiet] hf buckets list — List buckets or files in a bucket. [--human-readable --tree --recursive --format CHOICE --quiet] hf buckets move FROM_ID TO_ID — Move (rename) a bucket to a new name or namespace. hf buckets remove ARGUMENT — Remove files from a bucket. [--recursive --yes --dry-run --include TEXT --exclude TEXT --quiet] 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 --quiet]

hf cache — Manage local cache directory.

hf cache list — List cached repositories or revisions. [--cache-dir TEXT --revisions --filter TEXT --format CHOICE --quiet --sort CHOICE --limit INTEGER] hf cache prune — Remove detached revisions from the cache. [--cache-dir TEXT --yes --dry-run] hf cache rm TARGETS — Remove cached repositories or revisions. [--cache-dir TEXT --yes --dry-run] 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]

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] hf collections create TITLE — Create a new collection on the Hub. [--namespace TEXT --description TEXT --private --exists-ok] hf collections delete COLLECTION_SLUG — Delete a collection from the Hub. [--missing-ok] hf collections delete-item COLLECTION_SLUG ITEM_OBJECT_ID — Delete an item from a collection. [--missing-ok] hf collections info COLLECTION_SLUG — Get info about a collection on the Hub. Output is in JSON format. hf collections list — List collections on the Hub. [--owner TEXT --item TEXT --sort CHOICE --limit INTEGER --format CHOICE --quiet] hf collections update COLLECTION_SLUG — Update a collection's metadata on the Hub. [--title TEXT --description TEXT --position INTEGER --private --theme TEXT] hf collections update-item COLLECTION_SLUG ITEM_OBJECT_ID — Update an item in a collection. [--note TEXT --position INTEGER]

hf datasets — Interact with datasets on the Hub.

  • hf datasets info DATASET_ID — Get info about a dataset on the Hub.
  • Output is in JSON format.
  • [--revision TEXT --expand TEXT]. hf datasets list — List datasets on the Hub. [--search TEXT --author TEXT --filter TEXT --sort CHOICE --limit INTEGER --expand TEXT --format CHOICE --quiet] hf datasets parquet DATASET_ID — List parquet file URLs available for a dataset. [--subset TEXT --split TEXT --format CHOICE --quiet] 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] hf discussions comment REPO_ID NUM — Comment on a discussion or pull request. [--body TEXT --body-file PATH --type 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] hf discussions diff REPO_ID NUM — Show the diff of a pull request. [--type CHOICE] hf discussions info REPO_ID NUM — Get info about a discussion or pull request. [--comments --diff --no-color --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 --quiet] hf discussions merge REPO_ID NUM — Merge a pull request. [--comment TEXT --yes --type CHOICE] hf discussions rename REPO_ID NUM NEW_TITLE — Rename a discussion or pull request. [--type CHOICE] hf discussions reopen REPO_ID NUM — Reopen a closed discussion or pull request. [--comment TEXT --yes --type 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] hf endpoints catalog list — List available Catalog models. hf endpoints delete NAME — Delete an Inference Endpoint permanently. [--namespace TEXT --yes] 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]