huggingface_hub and the hf CLI download, upload, and manage models and datasets on the Hub. They also support search, inference, and repository workflows.
Overview
The huggingface_hub package is the official Python client for the Hugging Face Hub platform. It helps you discover pretrained models and datasets, interact with community-hosted machine learning apps, and publish your own models, datasets, and demos.
The same distribution includes the hf command-line tool for terminal workflows and the Python API for scripts and applications. Typical tasks include downloading files or whole repositories to a local cache, creating repositories, uploading single files or folders, searching Hub content, running inference on deployed models, and managing community interactions such as pull requests and comments.
Authentication uses Hub tokens. Installation is available via pip, with optional dependency groups for features like MCP integration. The CLI is also documented for use with coding agents, adapting output when invoked from automated tools.
The project partners with open-source ML libraries to offer hosted model storage with versioning for large files, discoverability via tags, and integration guides for library authors who want Hub hosting.
Key features
- hf CLI and Python API
- Download and upload Hub files
- Repository create and manage
- Model and dataset search
- Hub token authentication
- Inference on deployed models
- Optional MCP dependencies
- ML library Hub integrations
Use cases
- Publish trained models to the Hub
- Sync datasets from Python jobs
- Script Hub downloads in pipelines
- Automate repo management via CLI