← 返回命令列表

Linux command

huggingface-cli 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Login to Hugging Face

huggingface-cli login

Download a model

huggingface-cli download [model-name]

Download specific files from a model

huggingface-cli download [model-name] [config.json] [model.safetensors]

Download to a local directory

huggingface-cli download [model-name] --local-dir [path]

Download a dataset

huggingface-cli download [dataset-name] --repo-type dataset

Upload a folder to a repo

huggingface-cli upload [repo-id] [local_path] [path_in_repo]

Scan the local cache

huggingface-cli scan-cache

Show current logged-in user

huggingface-cli whoami

说明

huggingface-cli is the command-line interface for Hugging Face Hub, also available as the hf command. Download models and datasets, manage repositories, and authenticate your machine. Part of the huggingface_hub Python package. The newer hf CLI uses a resource-action pattern (e.g. `hf auth login`, `hf download`). Default cache location is ~/.cache/huggingface or HF_HOME environment variable.

参数

--token _token_
Use specific access token.
--repo-type _type_
Repository type: model, dataset, or space (default: model).
--local-dir _path_
Download to a specific local directory instead of cache.
--include _pattern_
Glob pattern for files to include in download.
--exclude _pattern_
Glob pattern for files to exclude from download.
--revision _rev_
Specific revision to download (branch, tag, or commit hash).
--quiet
Suppress progress output.

FAQ

What is the huggingface-cli command used for?

huggingface-cli is the command-line interface for Hugging Face Hub, also available as the hf command. Download models and datasets, manage repositories, and authenticate your machine. Part of the huggingface_hub Python package. The newer hf CLI uses a resource-action pattern (e.g. `hf auth login`, `hf download`). Default cache location is ~/.cache/huggingface or HF_HOME environment variable.

How do I run a basic huggingface-cli example?

Run `huggingface-cli login` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --token _token_ do in huggingface-cli?

Use specific access token.