hugging-face-cli by huggingface/skills
npx skills add https://github.com/huggingface/skills --skill hugging-face-clihf CLI 提供了对 Hugging Face Hub 的直接终端访问,用于下载、上传和管理仓库、缓存以及计算资源。
| 任务 | 命令 |
|---|---|
| 登录 | hf auth login |
| 下载模型 | hf download <repo_id> |
| 下载到文件夹 | hf download <repo_id> --local-dir ./path |
| 上传文件夹 | hf upload <repo_id> . . |
| 创建仓库 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
hf repo create <name> |
| 创建标签 | hf repo tag create <repo_id> <tag> |
| 删除文件 | hf repo-files delete <repo_id> <files> |
| 列出缓存 | hf cache ls |
| 从缓存移除 | hf cache rm <repo_or_revision> |
| 列出模型 | hf models ls |
| 获取模型信息 | hf models info <model_id> |
| 列出数据集 | hf datasets ls |
| 获取数据集信息 | hf datasets info <dataset_id> |
| 列出 Spaces | hf spaces ls |
| 获取 Space 信息 | hf spaces info <space_id> |
| 列出端点 | hf endpoints ls |
| 运行 GPU 任务 | hf jobs run --flavor a10g-small <image> <cmd> |
| 环境信息 | hf env |
hf auth login # 交互式登录
hf auth login --token $HF_TOKEN # 非交互式登录
hf auth whoami # 检查当前用户
hf auth list # 列出存储的令牌
hf auth switch # 在令牌之间切换
hf auth logout # 登出
hf download <repo_id> # 完整仓库到缓存
hf download <repo_id> file.safetensors # 特定文件
hf download <repo_id> --local-dir ./models # 到本地目录
hf download <repo_id> --include "*.safetensors" # 按模式过滤
hf download <repo_id> --repo-type dataset # 数据集
hf download <repo_id> --revision v1.0 # 特定版本
hf upload <repo_id> . . # 当前目录到根目录
hf upload <repo_id> ./models /weights # 文件夹到路径
hf upload <repo_id> model.safetensors # 单个文件
hf upload <repo_id> . . --repo-type dataset # 数据集
hf upload <repo_id> . . --create-pr # 创建 PR
hf upload <repo_id> . . --commit-message="msg" # 自定义提交信息
hf repo create <name> # 创建模型仓库
hf repo create <name> --repo-type dataset # 创建数据集
hf repo create <name> --private # 私有仓库
hf repo create <name> --repo-type space --space_sdk gradio # Gradio Space
hf repo delete <repo_id> # 删除仓库
hf repo move <from_id> <to_id> # 将仓库移动到新的命名空间
hf repo settings <repo_id> --private true # 更新仓库设置
hf repo list --repo-type model # 列出仓库
hf repo branch create <repo_id> release-v1 # 创建分支
hf repo branch delete <repo_id> release-v1 # 删除分支
hf repo tag create <repo_id> v1.0 # 创建标签
hf repo tag list <repo_id> # 列出标签
hf repo tag delete <repo_id> v1.0 # 删除标签
hf repo-files delete <repo_id> folder/ # 删除文件夹
hf repo-files delete <repo_id> "*.txt" # 按模式删除
hf cache ls # 列出缓存的仓库
hf cache ls --revisions # 包含各个修订版本
hf cache rm model/gpt2 # 移除缓存的仓库
hf cache rm <revision_hash> # 移除缓存的修订版本
hf cache prune # 移除分离的修订版本
hf cache verify gpt2 # 验证缓存的校验和
# 模型
hf models ls # 列出热门模型
hf models ls --search "MiniMax" --author MiniMaxAI # 搜索模型
hf models ls --filter "text-generation" --limit 20 # 按任务过滤
hf models info MiniMaxAI/MiniMax-M2.1 # 获取模型信息
# 数据集
hf datasets ls # 列出热门数据集
hf datasets ls --search "finepdfs" --sort downloads # 搜索数据集
hf datasets info HuggingFaceFW/finepdfs # 获取数据集信息
# Spaces
hf spaces ls # 列出热门 Spaces
hf spaces ls --filter "3d" --limit 10 # 按 3D 建模 Spaces 过滤
hf spaces info enzostvs/deepsite # 获取 Space 信息
hf jobs run python:3.12 python script.py # 在 CPU 上运行
hf jobs run --flavor a10g-small <image> <cmd> # 在 GPU 上运行
hf jobs run --secrets HF_TOKEN <image> <cmd> # 使用 HF 令牌
hf jobs ps # 列出任务
hf jobs logs <job_id> # 查看日志
hf jobs cancel <job_id> # 取消任务
hf endpoints ls # 列出端点
hf endpoints deploy my-endpoint \
--repo openai/gpt-oss-120b \
--framework vllm \
--accelerator gpu \
--instance-size x4 \
--instance-type nvidia-a10g \
--region us-east-1 \
--vendor aws
hf endpoints describe my-endpoint # 显示端点详情
hf endpoints pause my-endpoint # 暂停端点
hf endpoints resume my-endpoint # 恢复端点
hf endpoints scale-to-zero my-endpoint # 缩放到零
hf endpoints delete my-endpoint --yes # 删除端点
GPU 类型: cpu-basic, cpu-upgrade, cpu-xl, t4-small, t4-medium, l4x1, l4x4, l40sx1, l40sx4, l40sx8, a10g-small, a10g-large, a10g-largex2, a10g-largex4, a100-large, h100, h100x8
# 下载到本地目录以进行部署
hf download meta-llama/Llama-3.2-1B-Instruct --local-dir ./model
# 或使用缓存并获取路径
MODEL_PATH=$(hf download meta-llama/Llama-3.2-1B-Instruct --quiet)
hf repo create my-username/my-model --private
hf upload my-username/my-model ./output . --commit-message="初始版本"
hf repo tag create my-username/my-model v1.0
hf upload my-username/my-space . . --repo-type space \
--exclude="logs/*" --delete="*" --commit-message="同步"
hf cache ls # 查看所有缓存的仓库及其大小
hf cache rm model/gpt2 # 从缓存中移除仓库
--repo-type: model (默认), dataset, space--revision: 分支、标签或提交哈希--token: 覆盖身份验证--quiet: 仅输出基本信息(路径/URL)每周安装量
249
仓库
GitHub Stars
9.9K
首次出现
2026年1月20日
安全审计
安装于
opencode187
claude-code178
gemini-cli178
codex178
github-copilot161
cursor156
The hf CLI provides direct terminal access to the Hugging Face Hub for downloading, uploading, and managing repositories, cache, and compute resources.
| Task | Command |
|---|---|
| Login | hf auth login |
| Download model | hf download <repo_id> |
| Download to folder | hf download <repo_id> --local-dir ./path |
| Upload folder | hf upload <repo_id> . . |
| Create repo | hf repo create <name> |
| Create tag | hf repo tag create <repo_id> <tag> |
| Delete files | hf repo-files delete <repo_id> <files> |
| List cache | hf cache ls |
| Remove from cache | hf cache rm <repo_or_revision> |
| List models | hf models ls |
| Get model info | hf models info <model_id> |
| List datasets | hf datasets ls |
| Get dataset info | hf datasets info <dataset_id> |
| List spaces | hf spaces ls |
| Get space info | hf spaces info <space_id> |
| List endpoints | hf endpoints ls |
| Run GPU job | hf jobs run --flavor a10g-small <image> <cmd> |
| Environment info | hf env |
hf auth login # Interactive login
hf auth login --token $HF_TOKEN # Non-interactive
hf auth whoami # Check current user
hf auth list # List stored tokens
hf auth switch # Switch between tokens
hf auth logout # Log out
hf download <repo_id> # Full repo to cache
hf download <repo_id> file.safetensors # Specific file
hf download <repo_id> --local-dir ./models # To local directory
hf download <repo_id> --include "*.safetensors" # Filter by pattern
hf download <repo_id> --repo-type dataset # Dataset
hf download <repo_id> --revision v1.0 # Specific version
hf upload <repo_id> . . # Current dir to root
hf upload <repo_id> ./models /weights # Folder to path
hf upload <repo_id> model.safetensors # Single file
hf upload <repo_id> . . --repo-type dataset # Dataset
hf upload <repo_id> . . --create-pr # Create PR
hf upload <repo_id> . . --commit-message="msg" # Custom message
hf repo create <name> # Create model repo
hf repo create <name> --repo-type dataset # Create dataset
hf repo create <name> --private # Private repo
hf repo create <name> --repo-type space --space_sdk gradio # Gradio space
hf repo delete <repo_id> # Delete repo
hf repo move <from_id> <to_id> # Move repo to new namespace
hf repo settings <repo_id> --private true # Update repo settings
hf repo list --repo-type model # List repos
hf repo branch create <repo_id> release-v1 # Create branch
hf repo branch delete <repo_id> release-v1 # Delete branch
hf repo tag create <repo_id> v1.0 # Create tag
hf repo tag list <repo_id> # List tags
hf repo tag delete <repo_id> v1.0 # Delete tag
hf repo-files delete <repo_id> folder/ # Delete folder
hf repo-files delete <repo_id> "*.txt" # Delete with pattern
hf cache ls # List cached repos
hf cache ls --revisions # Include individual revisions
hf cache rm model/gpt2 # Remove cached repo
hf cache rm <revision_hash> # Remove cached revision
hf cache prune # Remove detached revisions
hf cache verify gpt2 # Verify checksums from cache
# Models
hf models ls # List top trending models
hf models ls --search "MiniMax" --author MiniMaxAI # Search models
hf models ls --filter "text-generation" --limit 20 # Filter by task
hf models info MiniMaxAI/MiniMax-M2.1 # Get model info
# Datasets
hf datasets ls # List top trending datasets
hf datasets ls --search "finepdfs" --sort downloads # Search datasets
hf datasets info HuggingFaceFW/finepdfs # Get dataset info
# Spaces
hf spaces ls # List top trending spaces
hf spaces ls --filter "3d" --limit 10 # Filter by 3D modeling spaces
hf spaces info enzostvs/deepsite # Get space info
hf jobs run python:3.12 python script.py # Run on CPU
hf jobs run --flavor a10g-small <image> <cmd> # Run on GPU
hf jobs run --secrets HF_TOKEN <image> <cmd> # With HF token
hf jobs ps # List jobs
hf jobs logs <job_id> # View logs
hf jobs cancel <job_id> # Cancel job
hf endpoints ls # List endpoints
hf endpoints deploy my-endpoint \
--repo openai/gpt-oss-120b \
--framework vllm \
--accelerator gpu \
--instance-size x4 \
--instance-type nvidia-a10g \
--region us-east-1 \
--vendor aws
hf endpoints describe my-endpoint # Show endpoint details
hf endpoints pause my-endpoint # Pause endpoint
hf endpoints resume my-endpoint # Resume endpoint
hf endpoints scale-to-zero my-endpoint # Scale to zero
hf endpoints delete my-endpoint --yes # Delete endpoint
GPU Flavors: cpu-basic, cpu-upgrade, cpu-xl, t4-small, t4-medium, l4x1, l4x4, l40sx1, l40sx4, l40sx8, a10g-small, a10g-large, , , , ,
# Download to local directory for deployment
hf download meta-llama/Llama-3.2-1B-Instruct --local-dir ./model
# Or use cache and get path
MODEL_PATH=$(hf download meta-llama/Llama-3.2-1B-Instruct --quiet)
hf repo create my-username/my-model --private
hf upload my-username/my-model ./output . --commit-message="Initial release"
hf repo tag create my-username/my-model v1.0
hf upload my-username/my-space . . --repo-type space \
--exclude="logs/*" --delete="*" --commit-message="Sync"
hf cache ls # See all cached repos and sizes
hf cache rm model/gpt2 # Remove a repo from cache
--repo-type: model (default), dataset, space--revision: Branch, tag, or commit hash--token: Override authentication--quiet: Output only essential info (paths/URLs)Weekly Installs
249
Repository
GitHub Stars
9.9K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
opencode187
claude-code178
gemini-cli178
codex178
github-copilot161
cursor156
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
102,600 周安装
Avalonia UI布局优化指南:使用Zafiro.Avalonia实现现代简洁布局
244 周安装
Schema结构化数据完整指南:实现富媒体结果与AI搜索优化(2025)
244 周安装
实用程序员框架:DRY、正交性等七大元原则提升软件质量与架构设计
244 周安装
Python PDF处理指南:合并拆分、提取文本表格、创建PDF文件教程
244 周安装
Ruby on Rails 应用开发指南:构建功能全面的Rails应用,包含模型、控制器、身份验证与最佳实践
245 周安装
代码规范库技能 - 多语言编码标准库,支持Python/Go/Rust/TypeScript等自动加载
245 周安装
a10g-largex2a10g-largex4a100-largeh100h100x8