hf-cli について
Hugging Face Hub のコマンドラインツール `hf` で、Hub のコンテンツやアカウントアクセスを管理するスキルです。非推奨の `huggingface-cli` に代わり、リポジトリ、データセット、バケットなどの操作を扱います。
主な機能
- 01Hub ファイルのアップロードとダウンロード
- 02認証トークンの管理
- 03ローカルファイルとバケットの同期
- 04ローカルキャッシュの確認と管理
- 05データセットとディスカッションの管理
活用シーン
- 01Hub リポジトリのローカルディレクトリへのダウンロード
- 02モデルまたはデータセットリポジトリへのファイルのアップロード
- 03ローカルデータとバケットの同期
- 04Hugging Face アカウントトークンの切り替え
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ huggingface/ skills --skill hf-cliインストール後、Claude Code で/hf-cliを入力して読み込まれたか確認します。
詳細
インストール:curl -LsSf https://hf.co/cli/install.sh | bash -s。
Hugging Face Hub CLI ツール hf を利用できます。重要:hf コマンドは、非推奨となった huggingface-cli コマンドに代わるものです。
利用可能な機能を確認するには、hf --help を使用してください。認証関連のコマンドはすべて hf auth の下にあります。例:hf auth whoami。
huggingface_hub v2.2.0 で生成されました。再生成するには、hf skills add --force を実行してください。
コマンド
hf cp SRC— ローカルパス、リポジトリ、バケット間でファイルをコピーします。[--format [auto|human|agent|json|quiet]]hf download REPO_ID— Hub からファイルをダウンロードします。[--type [model|dataset|space|kernel] --revision TEXT --include TEXT --exclude TEXT --cache-dir TEXT --local-dir TEXT --force-download --dry-run --max-workers INTEGER --format [auto|human|agent|json|quiet]]hf env— 環境に関する情報を表示します。[--format [auto|human|agent|json|quiet]]hf sync— ローカルディレクトリとバケット間でファイルを同期します。[--delete --ignore-times --ignore-sizes --plan TEXT --apply TEXT --dry-run --include TEXT --exclude TEXT --filter-from TEXT --existing --ignore-existing --verbose --format [auto|human|agent|json|quiet]]hf update—hfCLI を最新バージョンに更新します。[--format [auto|human|agent|json|quiet]]hf upload REPO_ID— Hub にファイルまたはフォルダーをアップロードします。[--type [model|dataset|space|kernel] --revision TEXT --private --include TEXT --exclude TEXT --delete TEXT --commit-message TEXT --commit-description TEXT --create-pr --every FLOAT --format [auto|human|agent|json|quiet]]hf version— hf のバージョンに関する情報を表示します。[--format [auto|human|agent|json|quiet]]
hf auth — 認証を管理します(ログイン、ログアウトなど)。
hf auth list— 保存されているすべてのアクセストークンを一覧表示します。[--format [auto|human|agent|json|quiet]]hf auth login— ブラウザーから、または huggingface.co/settings/tokens のトークンを使ってログインします。[--add-to-git-credential --force --format [auto|human|agent|json|quiet]]hf auth logout— 指定したトークンからログアウトします。[--token-name TEXT --format [auto|human|agent|json|quiet]]hf auth switch— アクセストークンを切り替えます。[--token-name TEXT --add-to-git-credential --format [auto|human|agent|json|quiet]]hf auth token— 現在のアクセストークンを標準出力に表示します。[--format [auto|human|agent|json|quiet]]hf auth whoami— ログイン中の huggingface.co アカウントを確認します。[--format [auto|human|agent|json|quiet]]
hf buckets — バケットを操作するコマンドです。
hf buckets cp SRC— ローカルパス、リポジトリ、バケット間でファイルをコピーします。[--format [auto|human|agent|json|quiet]]hf buckets create BUCKET_ID— 新しいバケットを作成します。[--private --region [us|eu] --exist-ok --format [auto|human|agent|json|quiet]]hf buckets delete BUCKET_ID— バケットを削除します。[--yes --missing-ok --format [auto|human|agent|json|quiet]]hf buckets info BUCKET_ID— バケットに関する情報を取得します。[--format [auto|human|agent|json|quiet]]hf buckets list— バケットまたはバケット内のファイルを一覧表示します。[--human-readable --tree --recursive --search TEXT --format [auto|human|agent|json|quiet]]hf buckets move FROM_ID TO_ID— バケットを新しい名前または名前空間に移動(名前を変更)します。[--format [auto|human|agent|json|quiet]]hf buckets remove ARGUMENT— バケットからファイルを削除します。[--recursive --yes --dry-run --include TEXT --exclude TEXT --format [auto|human|agent|json|quiet]]hf buckets settings BUCKET_ID— バケットの設定(公開範囲)を更新します。[--private --public --format [auto|human|agent|json|quiet]]hf buckets sync— ローカルディレクトリとバケット間でファイルを同期します。[--delete --ignore-times --ignore-sizes --plan TEXT --apply TEXT --dry-run --include TEXT --exclude TEXT --filter-from TEXT --existing --ignore-existing --verbose --format [auto|human|agent|json|quiet]]
hf cache — ローカルキャッシュディレクトリを管理します。
hf cache list— キャッシュされたリポジトリまたはリビジョンを一覧表示します。[--cache-dir TEXT --revisions --filter TEXT --sort [accessed|accessed:asc|accessed:desc|modified|modified:asc|modified:desc|name|name:asc|name:desc|size|size:asc|size:desc] --limit INTEGER --show-warnings --format [auto|human|agent|json|quiet]]hf cache prune— キャッシュから、関連付けのないリビジョンと未完了のダウンロードを削除します。[--cache-dir TEXT --yes --dry-run --format [auto|human|agent|json|quiet]]hf cache rm TARGETS— キャッシュされたリポジトリ、リビジョン、またはファイルを削除します。[--cache-dir TEXT --yes --dry-run --format [auto|human|agent|json|quiet]]hf cache verify REPO_ID— キャッシュまたはローカルディレクトリにある単一のリポジトリリビジョンのチェックサムを検証します。[--type [model|dataset|space|kernel] --revision TEXT --cache-dir TEXT --local-dir TEXT --fail-on-missing-files --fail-on-extra-files --format [auto|human|agent|json|quiet]]
hf collections — Hub 上のコレクションを操作します。
hf collections add-item COLLECTION_SLUG ITEM_ID ITEM_TYPE— コレクションにアイテムを追加します。[--note TEXT --exists-ok --format [auto|human|agent|json|quiet]]hf collections create TITLE— Hub 上に新しいコレクションを作成します。[--namespace TEXT --description TEXT --private --exists-ok --format [auto|human|agent|json|quiet]]hf collections delete COLLECTION_SLUG— Hub からコレクションを削除します。[--missing-ok --format [auto|human|agent|json|quiet]]hf collections delete-item COLLECTION_SLUG ITEM_OBJECT_ID— コレクションからアイテムを削除します。[--missing-ok --format [auto|human|agent|json|quiet]]hf collections info COLLECTION_SLUG— Hub 上のコレクション情報を取得します。[--format [auto|human|agent|json|quiet]]hf collections list— Hub 上のコレクションを一覧表示します。[--owner TEXT --item TEXT --sort [lastModified|trending|upvotes] --limit INTEGER --format [auto|human|agent|json|quiet]]hf collections update COLLECTION_SLUG— Hub 上のコレクションのメタデータを更新します。[--title TEXT --description TEXT --position INTEGER --private --theme TEXT --format [auto|human|agent|json|quiet]]hf collections update-item COLLECTION_SLUG ITEM_OBJECT_ID— コレクション内のアイテムを更新します。[--note TEXT --position INTEGER --format [auto|human|agent|json|quiet]]
hf datasets — Hub 上のデータセットを操作します。
hf datasets card DATASET_ID— Hub 上のデータセットのデータセットカード(README)を取得します。[--metadata --text --format [auto|human|agent|json|quiet]]hf datasets info DATASET_ID— Hub 上のデータセット情報を取得します。[--revision TEXT --expand TEXT --format [auto|human|agent|json|quiet]]hf datasets leaderboard DATASET_ID— データセットのリーダーボードからモデルのスコアを一覧表示します。このコマンドを使うと、タスクに最適なモデルを見つけたり、ベンチマークスコアでモデルを比較したりできます。利用可能なリーダーボードを一覧表示するには、hf datasets ls --filter benchmark:officialを使用してください。[--limit INTEGER --format [auto|human|agent|json|quiet]]hf datasets list— Hub 上のデータセット、またはデータセットリポジトリ内のファイルを一覧表示します。[--search TEXT --author TEXT --filter TEXT --sort [created_at|downloads|last_modified|likes|trending_score] --limit INTEGER --expand TEXT --human-readable --tree --recursive --revision TEXT --format [auto|human|agent|json|quiet]]hf datasets parquet DATASET_ID— データセットで利用可能な Parquet ファイルの URL を一覧表示します。[--subset TEXT --split TEXT --format [auto|human|agent|json|quiet]]hf datasets sql SQL— データセットの Parquet URL に対して DuckDB で生の SQL クエリを実行します。[--format [auto|human|agent|json|quiet]]
hf discussions — Hub 上のディスカッションとプルリクエストを管理します。
hf discussions close REPO_ID NUM— ディスカッションまたはプルリクエストをクローズします。[--comment TEXT --yes --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions comment REPO_ID NUM— ディスカッションまたはプルリクエストにコメントします。[--body TEXT --body-file PATH --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions create REPO_ID --title TEXT— リポジトリに新しいディスカッションまたはプルリクエストを作成します。[--body TEXT --body-file PATH --pull-request --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions diff REPO_ID NUM— プルリクエストの差分を表示します。[--type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions edit REPO_ID NUM COMMENT_ID— ディスカッションまたはプルリクエストの既存のコメントを編集します。[--body TEXT --body-file PATH --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions info REPO_ID NUM— ディスカッションまたはプルリクエストの情報を取得します。[--type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions list REPO_ID— リポジトリのディスカッションとプルリクエストを一覧表示します。[--status [open|closed|merged|draft|all] --kind [all|discussion|pull_request] --author TEXT --limit INTEGER --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions merge REPO_ID NUM— プルリクエストをマージします。[--comment TEXT --yes --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions rename REPO_ID NUM NEW_TITLE— ディスカッションまたはプルリクエストの名前を変更します。[--type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf discussions reopen REPO_ID NUM— クローズされたディスカッションまたはプルリクエストを再度開きます。[--comment TEXT --yes --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]
hf endpoints — Hugging Face Inference Endpoints を管理します。
hf endpoints catalog deploy— Model Catalog から Inference Endpoint をデプロイします。[--repo TEXT --recipe TEXT --name TEXT --accelerator [cpu|gpu|neuron] --gguf-file TEXT --namespace TEXT --format [auto|human|agent|json|quiet]]hf endpoints catalog list— Model Catalog で利用可能なモデルを一覧表示します。[--accelerator [cpu|gpu|neuron] --engine [llamacpp|sglang|tei|vllm] --license TEXT --task TEXT --search TEXT --limit INTEGER --format [auto|human|agent|json|quiet]]hf endpoints delete NAME— Inference Endpoint を完全に削除します。[--namespace TEXT --yes --format [auto|human|agent|json|quiet]]hf endpoints deploy NAME --repo TEXT --framework TEXT --accelerator TEXT --instance-size TEXT --instance-type TEXT --region TEXT --vendor TEXT— Hub リポジトリから Inference Endpoint をデプロイします。[--namespace TEXT --task TEXT --min-replica INTEGER --max-replica INTEGER --scale-to-zero-timeout INTEGER --scaling-metric [pendingRequests|hardwareUsage] --scaling-threshold FLOAT --revision TEXT --custom-image TEXT --engine [custom|hf-serve|llamacpp|sglang|tei|tgi|tgi-neuron|vllm|vllm-neuron] --health-route TEXT --port INTEGER --container-registry-username TEXT --container-registry-password TEXT --tensor-parallel-size INTEGER --data-parallel-size INTEGER --container-command TEXT --container-args TEXT --env TEXT --env-file TEXT --secrets TEXT --secrets-file TEXT --type [public|authenticated|private] --format [auto|human|agent|json|quiet]]hf endpoints describe NAME— 既存のエンドポイントに関する情報を取得します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf endpoints hardware— Inference Endpoint のデプロイに利用できるハードウェアを一覧表示します。[--namespace TEXT --vendor TEXT --region TEXT --accelerator TEXT --instance-type TEXT --all --format [auto|human|agent|json|quiet]]hf endpoints list— 指定した名前空間のすべての Inference Endpoint を一覧表示します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf endpoints pause NAME— Inference Endpoint を一時停止します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf endpoints resume NAME— Inference Endpoint を再開します。[--namespace TEXT --fail-if-already-running --format [auto|human|agent|json|quiet]]hf endpoints scale-to-zero NAME— Inference Endpoint のスケールをゼロにします。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf endpoints update NAME— 既存のエンドポイントを更新します。[--namespace TEXT --repo TEXT --accelerator TEXT --instance-size TEXT --instance-type TEXT --framework TEXT --revision TEXT --task TEXT --custom-image TEXT --engine [custom|hf-serve|llamacpp|sglang|tei|tgi|tgi-neuron|vllm|vllm-neuron] --health-route TEXT --port INTEGER --tensor-parallel-size INTEGER --data-parallel-size INTEGER --container-command TEXT --container-args TEXT --min-replica INTEGER --max-replica INTEGER --scale-to-zero-timeout INTEGER --scaling-metric [pendingRequests|hardwareUsage] --scaling-threshold FLOAT --format [auto|human|agent|json|quiet]]
hf extensions — hf CLI 拡張機能を管理します。
hf extensions exec NAME— インストール済みの拡張機能を実行します。hf extensions install REPO_ID— 公開 GitHub リポジトリから拡張機能をインストールします。[--force --format [auto|human|agent|json|quiet]]hf extensions list— インストール済みの拡張機能コマンドを一覧表示します。[--format [auto|human|agent|json|quiet]]hf extensions remove NAME— インストール済みの拡張機能を削除します。[--format [auto|human|agent|json|quiet]]hf extensions search— GitHub で利用可能な拡張機能('hf-extension' トピックが付いたもの)を検索します。[--format [auto|human|agent|json|quiet]]hf extensions update— インストール済みの拡張機能を最新バージョンに更新します。[--format [auto|human|agent|json|quiet]]
hf jobs — Hub 上で Jobs を実行、管理します。
hf jobs cancel JOB_ID— ジョブをキャンセルします[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs expose JOB_ID— 実行中のジョブで公開するポートを置き換えます[--public INTEGER --clear --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs hardware— ジョブで利用可能なハードウェアオプションを一覧表示します[--format [auto|human|agent|json|quiet]]hf jobs inspect JOB_IDS— 1 つ以上のジョブの詳細情報を表示します[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs labels JOB_ID— ジョブのラベルを更新します。--label を指定すると既存のラベルがすべて置き換えられます。--name のみを指定すると、既存のラベルは保持されます。[--name TEXT --label TEXT --clear --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs list— ジョブを一覧表示します。[--all --status [COMPLETED|CANCELED|ERROR|DELETED|SCHEDULING|RUNNING] --label TEXT --name TEXT --limit INTEGER --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs logs JOB_ID— ジョブのログを取得します。[--follow --tail INTEGER --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs rerun JOB_ID— 既存のジョブの仕様を使って、新しいジョブを実行します。[--detach --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs run IMAGE COMMAND— ジョブを実行します。[--env TEXT --secrets TEXT --name TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --flavor [cpu-basic|cpu-upgrade|cpu-performance|cpu-xl|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8|h200|h200x2|h200x4|h200x8|rtx-pro-6000|rtx-pro-6000x2|rtx-pro-6000x4|rtx-pro-6000x8] --timeout TEXT --attempts INTEGER RANGE --detach --dry-run --expose INTEGER --expose-public INTEGER --ssh --network-group TEXT --network-alias TEXT --resource-group-id TEXT --namespace TEXT --format [agent|auto|human|json|quiet] --json --quiet]hf jobs scheduled delete SCHEDULED_JOB_ID— スケジュール済みジョブを削除します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled inspect SCHEDULED_JOB_IDS— 1 つ以上のスケジュール済みジョブの詳細情報を表示します[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled labels SCHEDULED_JOB_ID— スケジュール済みジョブのラベルを更新します。--label を指定すると既存のラベルがすべて置き換えられます。--name のみを指定すると、既存のラベルは保持されます。[--name TEXT --label TEXT --clear --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled list— スケジュール済みジョブを一覧表示します。[--all --status [active|suspended] --label TEXT --name TEXT --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled reschedule SCHEDULED_JOB_ID SCHEDULE— スケジュール済みジョブの実行日時を変更します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled resume SCHEDULED_JOB_ID— スケジュール済みジョブを再開(一時停止を解除)します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled run SCHEDULE IMAGE COMMAND— ジョブをスケジュールします。[--suspend --concurrency --env TEXT --secrets TEXT --name TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --flavor [cpu-basic|cpu-upgrade|cpu-performance|cpu-xl|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8|h200|h200x2|h200x4|h200x8|rtx-pro-6000|rtx-pro-6000x2|rtx-pro-6000x4|rtx-pro-6000x8] --timeout TEXT --attempts INTEGER RANGE --dry-run --expose INTEGER --expose-public INTEGER --resource-group-id TEXT --namespace TEXT --format [agent|auto|human|json|quiet] --json --quiet]hf jobs scheduled suspend SCHEDULED_JOB_ID— スケジュール済みジョブを一時停止します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled trigger SCHEDULED_JOB_ID— スケジュールを変更せずに、スケジュール済みジョブをただちに実行します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs scheduled uv run SCHEDULE SCRIPT— HF インフラストラクチャ上で UV スクリプト(ローカルファイルまたは URL)を実行します[--suspend --concurrency --image TEXT --flavor [cpu-basic|cpu-upgrade|cpu-performance|cpu-xl|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8|h200|h200x2|h200x4|h200x8|rtx-pro-6000|rtx-pro-6000x2|rtx-pro-6000x4|rtx-pro-6000x8] --env TEXT --secrets TEXT --name TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --timeout TEXT --attempts INTEGER RANGE --dry-run --expose INTEGER --expose-public INTEGER --resource-group-id TEXT --namespace TEXT --with TEXT --python TEXT --format [agent|auto|human|json|quiet] --json --quiet]hf jobs ssh JOB_ID— 実行中のジョブに SSH 接続します。[--identity-file PATH --dry-run --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs stats— ジョブのリソース使用状況の統計情報とメトリクスを取得します。[--follow --namespace TEXT --format [auto|human|agent|json|quiet]]hf jobs uv run SCRIPT— HF インフラストラクチャ上で UV スクリプト(ローカルファイルまたは URL)を実行します[--image TEXT --flavor [cpu-basic|cpu-upgrade|cpu-performance|cpu-xl|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8|h200|h200x2|h200x4|h200x8|rtx-pro-6000|rtx-pro-6000x2|rtx-pro-6000x4|rtx-pro-6000x8] --env TEXT --secrets TEXT --name TEXT --label TEXT --volume TEXT --env-file TEXT --secrets-file TEXT --timeout TEXT --attempts INTEGER RANGE --detach --dry-run --expose INTEGER --expose-public INTEGER --ssh --network-group TEXT --network-alias TEXT --resource-group-id TEXT --namespace TEXT --with TEXT --python TEXT --format [agent|auto|human|json|quiet] --json --quiet]hf jobs wait JOB_IDS— 1 つ以上のジョブが終了状態になるまで待機します。[--timeout TEXT --namespace TEXT --format [auto|human|agent|json|quiet]]
hf models — Hub 上のモデルを操作します。
hf models card MODEL_ID— Hub 上のモデルのモデルカード(README)を取得します。[--metadata --text --format [auto|human|agent|json|quiet]]hf models info MODEL_ID— Hub 上のモデルに関する情報を取得します。[--revision TEXT --expand TEXT --format [auto|human|agent|json|quiet]]hf models list— Hub 上のモデル、またはモデルリポジトリ内のファイルを一覧表示します。[--search TEXT --author TEXT --filter TEXT --pipeline-tag TEXT --gated --apps TEXT --num-parameters TEXT --inference-provider [baseten|cerebras|cohere|deepinfra|fal-ai|featherless-ai|fireworks-ai|groq|hf-inference|novita|nscale|openai|ovhcloud|publicai|replicate|scaleway|together|wavespeed|zai-org] --warm --sort [created_at|downloads|last_modified|likes|trending_score] --limit INTEGER --expand TEXT --human-readable --tree --recursive --revision TEXT --format [auto|human|agent|json|quiet]]
hf papers — Hub 上の論文を操作します。
hf papers info PAPER_ID— Hub 上の論文に関する情報を取得します。[--format [auto|human|agent|json|quiet]]hf papers list— Hub 上の日次論文を一覧表示します。[--date TEXT --week TEXT --month TEXT --submitter TEXT --sort [publishedAt|trending] --limit INTEGER --format [auto|human|agent|json|quiet]]hf papers read PAPER_ID— 論文を Markdown として読み込みます。[--format [auto|human|agent|json|quiet]]hf papers search QUERY— Hub 上の論文を検索します。[--limit INTEGER --format [auto|human|agent|json|quiet]]
hf repos — Hub 上のリポジトリを管理します。
hf repos branch create REPO_ID BRANCH— Hub 上のリポジトリに新しいブランチを作成します。[--revision TEXT --type [model|dataset|space|kernel] --exist-ok --format [auto|human|agent|json|quiet]]hf repos branch delete REPO_ID BRANCH— Hub 上のリポジトリからブランチを削除します。[--type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf repos cp SRC— ローカルパス、リポジトリ、バケット間でファイルをコピーします。[--format [auto|human|agent|json|quiet]]hf repos create REPO_ID— Hub 上に新しいリポジトリを作成します。[--type [model|dataset|space|kernel] --sdk TEXT --template TEXT --private --public --protected --exist-ok --resource-group-id TEXT --region [us|eu] --flavor [cpu-basic|cpu-upgrade|zero-a10g|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8] --sleep-time INTEGER --secrets TEXT --secrets-file TEXT --env TEXT --env-file TEXT --volume TEXT --format [auto|human|agent|json|quiet]]hf repos delete REPO_ID— Hub 上のリポジトリを削除します。この操作は取り消せません。[--type [model|dataset|space|kernel] --missing-ok --yes --format [auto|human|agent|json|quiet]]hf repos delete-files REPO_ID PATTERNS— Hub 上のリポジトリからファイルを削除します。[--type [model|dataset|space|kernel] --revision TEXT --commit-message TEXT --commit-description TEXT --create-pr --format [auto|human|agent|json|quiet]]hf repos duplicate FROM_ID— Hub 上のリポジトリ(モデル、データセット、Space)を複製します。[--type [model|dataset|space|kernel] --private --public --protected --exist-ok --resource-group-id TEXT --flavor [cpu-basic|cpu-upgrade|zero-a10g|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8] --sleep-time INTEGER --secrets TEXT --secrets-file TEXT --env TEXT --env-file TEXT --volume TEXT --format [auto|human|agent|json|quiet]]hf repos list— ストレージ情報とともに、すべてのリポジトリ(モデル、データセット、Space、バケット)を一覧表示します。[--namespace TEXT --type [model|dataset|space|bucket] --search TEXT --limit INTEGER --explore --format [auto|human|agent|json|quiet]]hf repos move FROM_ID TO_ID— リポジトリをある名前空間から別の名前空間へ移動します。[--type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf repos settings REPO_ID— リポジトリの設定を更新します。[--gated [auto|manual|false] --private --public --protected --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf repos tag create REPO_ID TAG— リポジトリにタグを作成します。[--message TEXT --revision TEXT --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf repos tag delete REPO_ID TAG— リポジトリのタグを削除します。[--yes --type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]hf repos tag list REPO_ID— リポジトリのタグを一覧表示します。[--type [model|dataset|space|kernel] --format [auto|human|agent|json|quiet]]
hf sandbox — Hugging Face Jobs で実験用サンドボックスを実行、管理します。
hf sandbox cp SRC DST— ローカルマシンとサンドボックス間でファイルをコピーします(docker 形式)。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf sandbox create— サンドボックスを作成します。デフォルトでは専用 VM を作成し、--poolを指定すると低コストの共有 VM を作成します。[--pool TEXT --flavor [cpu-basic|cpu-upgrade|cpu-performance|cpu-xl|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8|h200|h200x2|h200x4|h200x8|rtx-pro-6000|rtx-pro-6000x2|rtx-pro-6000x4|rtx-pro-6000x8] --idle-timeout TEXT --env TEXT --secrets TEXT --label TEXT --env-file TEXT --secrets-file TEXT --volume TEXT --namespace TEXT --forward-hf-token --format [auto|human|agent|json|quiet]]hf sandbox exec SANDBOX_ID COMMAND— サンドボックス内でコマンドを実行し、出力をストリーミングします。コマンドの終了コードで終了します。[--workdir TEXT --env TEXT --env-file TEXT --timeout FLOAT --namespace TEXT]hf sandbox kill— サンドボックス、共有ホスト全体、またはすべて(--all)を終了します。[--all --yes --namespace TEXT --format [auto|human|agent|json|quiet]]hf sandbox pool create— プールをウォームアップします。ホスト VM を 1 台起動し、後でプール ID で見つけられるようタグを付けます。[--flavor [cpu-basic|cpu-upgrade|cpu-performance|cpu-xl|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8|h200|h200x2|h200x4|h200x8|rtx-pro-6000|rtx-pro-6000x2|rtx-pro-6000x4|rtx-pro-6000x8] --per-host INTEGER RANGE --max-hosts INTEGER RANGE --idle-timeout TEXT --namespace TEXT --format [auto|human|agent|json|quiet]]hf sandbox pool delete POOL_ID— プール内のすべてのホスト VM を終了します(したがって、そのプールのすべてのサンドボックスも終了します)。[--yes --namespace TEXT --format [auto|human|agent|json|quiet]]hf sandbox pool ls— 実行中のサンドボックスプールを一覧表示します(ホスト VM ごとにグループ化)。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf sandbox process kill SANDBOX_ID PID— サンドボックス内で実行中のバックグラウンドプロセスを停止します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf sandbox process ls SANDBOX_ID— サンドボックス内で実行中のバックグラウンドプロセス(hf sandbox spawnで起動したもの)を一覧表示します。[--namespace TEXT --format [auto|human|agent|json|quiet]]hf sandbox spawn SANDBOX_ID COMMAND— 長時間実行するコマンドをバックグラウンドで起動し、pid を返します(完了を待ちません)。[--workdir TEXT --env TEXT --env-file TEXT --namespace TEXT]
hf skills — AI アシスタント向けのスキルを管理します。
hf skills add— Hugging Face のスキルを AI アシスタントにインストールします。[--global --dest PATH --force --format [auto|human|agent|json|quiet]]hf skills list— Hugging Face マーケットプレイスで利用できるスキルを一覧表示します。[--format [auto|human|agent|json|quiet]]hf skills preview— 生成されたhf-cliSKILL.md を stdout に出力します。[--format [auto|human|agent|json|quiet]]hf skills update— インストール済みの Hugging Face マーケットプレイスのスキルを更新します。[--global --dest PATH --format [auto|human|agent|json|quiet]]
hf spaces — Hub のスペースを操作します。
hf spaces card SPACE_ID— Hub 上のスペースのカード(README)を取得します。[--metadata --text --format [auto|human|agent|json|quiet]]hf spaces dev-mode SPACE_ID— スペースの開発モードを有効または無効にします。[--stop --format [auto|human|agent|json|quiet]]hf spaces hardware— スペースで利用可能なハードウェアオプションを一覧表示します。[--format [auto|human|agent|json|quiet]]hf spaces hot-reload SPACE_ID— 完全な再ビルドと再起動を行わずに、スペース内の任意の Python ファイルをホットリロードします。[--local-file PATH --skip-checks --skip-summary --format [auto|human|agent|json|quiet]]hf spaces info SPACE_ID— Hub 上のスペースに関する情報を取得します。[--revision TEXT --expand TEXT --format [auto|human|agent|json|quiet]]hf spaces list— Hub 上のスペース、またはスペースのリポジトリ内のファイルを一覧表示します。[--search TEXT --author TEXT --filter TEXT --sort [created_at|last_modified|likes|trending_score] --limit INTEGER --expand TEXT --human-readable --tree --recursive --revision TEXT --format [auto|human|agent|json|quiet]]hf spaces logs SPACE_ID— スペースの実行ログまたはビルドログを取得します。[--build --follow --tail INTEGER --format [auto|human|agent|json|quiet]]hf spaces pause SPACE_ID— スペースを一時停止します。[--format [auto|human|agent|json|quiet]]hf spaces restart SPACE_ID— スペースを再起動します。[--factory-reboot --format [auto|human|agent|json|quiet]]hf spaces search QUERY— セマンティック検索を使って Hub 上のスペースを検索します。[--filter TEXT --sdk TEXT --include-non-running --description --limit INTEGER --format [auto|human|agent|json|quiet]]hf spaces secrets add SPACE_ID— スペースのシークレットを追加または更新します。[--secrets TEXT --secrets-file TEXT --format [auto|human|agent|json|quiet]]hf spaces secrets delete SPACE_ID KEY— スペースからシークレットを削除します。[--yes --format [auto|human|agent|json|quiet]]hf spaces secrets list SPACE_ID— スペースのシークレットを一覧表示します。シークレットの値は書き込み専用で、返されません。[--format [auto|human|agent|json|quiet]]hf spaces settings SPACE_ID— スペースの設定を更新します。[--sleep-time INTEGER --hardware [cpu-basic|cpu-upgrade|zero-a10g|t4-small|t4-medium|l4x1|l4x4|l40sx1|l40sx4|l40sx8|a10g-small|a10g-large|a10g-largex2|a10g-largex4|a100-large|a100x4|a100x8] --format [auto|human|agent|json|quiet]]hf spaces ssh SPACE_ID— スペースの開発モードコンテナに SSH 接続します。[--identity-file PATH --dry-run --auto --format [auto|human|agent|json|quiet]]hf spaces templates— 利用可能なスペースのテンプレートを一覧表示します。[--format [auto|human|agent|json|quiet]]hf spaces variables add SPACE_ID— スペースの環境変数を追加または更新します。[--env TEXT --env-file TEXT --format [auto|human|agent|json|quiet]]hf spaces variables delete SPACE_ID KEY— スペースから環境変数を削除します。[--yes --format [auto|human|agent|json|quiet]]hf spaces variables list SPACE_ID— スペースの環境変数を一覧表示します。[--format [auto|human|agent|json|quiet]]hf spaces volumes delete SPACE_ID— スペースからすべてのボリュームを削除します。[--yes --format [auto|human|agent|json|quiet]]hf spaces volumes list SPACE_ID— スペースにマウントされているボリュームを一覧表示します。[--format [auto|human|agent|json|quiet]]hf spaces volumes set SPACE_ID— スペースのボリュームを設定(置換)します。[--volume TEXT --format [auto|human|agent|json|quiet]]hf spaces wait SPACE_ID— スペースのビルドまたは起動が完了するまで待機します。[--timeout TEXT --format [auto|human|agent|json|quiet]]hf spaces zero-gpu quota— ZeroGPU のクォータ(残りの GPU 時間とリセット日)を表示します。[--format [auto|human|agent|json|quiet]]
hf webhooks — Hub 上の Webhook を管理します。
hf webhooks create --watch TEXT— 新しい Webhook を作成します。[--url TEXT --job-id TEXT --domain [repo|discussions] --secret TEXT --secrets TEXT --secrets-file TEXT --format [auto|human|agent|json|quiet]]hf webhooks delete WEBHOOK_ID— Webhook を完全に削除します。[--yes --format [auto|human|agent|json|quiet]]hf webhooks disable WEBHOOK_ID— 有効な Webhook を無効にします。[--format [auto|human|agent|json|quiet]]hf webhooks enable WEBHOOK_ID— 無効な Webhook を有効にします。[--format [auto|human|agent|json|quiet]]hf webhooks info WEBHOOK_ID— 1 つの Webhook の詳細をすべて表示します。[--format [auto|human|agent|json|quiet]]hf webhooks list— 現在のユーザーのすべての Webhook を一覧表示します。[--format [auto|human|agent|json|quiet]]hf webhooks update WEBHOOK_ID— 既存の Webhook を更新します。指定したオプションのみが変更されます。[--url TEXT --job-id TEXT --watch TEXT --domain [repo|discussions] --secret TEXT --secrets TEXT --secrets-file TEXT --format [auto|human|agent|json|quiet]]
共通オプション
--format— 出力形式:--format json(または--json)、または--format table(デフォルト)。-q / --quiet— 静かな出力(1 行につき ID を 1 つ表示)。'--format quiet'と同等です。--revision— ブランチ名、タグ、またはコミットハッシュを指定できる Git のリビジョン ID です。--token— ユーザーアクセストークンを使用します。--tokenを渡す代わりに、HF_TOKEN環境変数を設定することをおすすめします。--type— リポジトリの種類(model、dataset、space、または kernel)です。
リポジトリをローカルファイルシステムとしてマウントする
Hub リポジトリやバケットをローカルファイルシステムとしてマウントするには(ダウンロード、コピー、待ち時間は不要)、hf-mount を使用します。ファイルは必要に応じて取得されます。GitHub:https://github.com/huggingface/hf-mount
インストール:brew install hf-mount を実行するか、https://github.com/huggingface/hf-mount/releases からバイナリをダウンロードしてください。
コマンドの例:
hf-mount start repo openai-community/gpt2 /tmp/gpt2— リポジトリをマウントします(読み取り専用)hf-mount start --hf-token $HF_TOKEN bucket myuser/my-bucket /tmp/data— バケットをマウントします(読み書き可能)hf-mount status/hf-mount stop /tmp/data— 一覧表示またはアンマウント
ヒント
hf <command> --helpを使用すると、すべてのオプション、説明、使用方法、実際の使用例を確認できます。HF_TOKEN環境変数(推奨)または--tokenを使用して認証します。hf updateで CLI を更新します(検出されたインストール方法に適したコマンドが使用されます)。
コメント
Markdown 対応