The `hf` library provides a command-line interface (CLI) for interacting with the Hugging Face Hub. It allows users to manage models, datasets, and Spaces, perform authentication, and execute various repository operations directly from the terminal. As of version 1.11.0, it includes features like semantic search for Spaces and server-side file copy operations. This library is updated frequently, often in sync with releases of the underlying `huggingface_hub` Python library.
pip install hfNo compatibility data collected yet for this library.
This quickstart demonstrates how to log in, verify authentication, create a new repository, and upload a file using the `hf` CLI. Replace `username` with your Hugging Face username.
For Python API interactions, use `from huggingface_hub import HfApi, login` etc., rather than trying to `import hf`.
If using Homebrew, ensure you have updated Homebrew. For new installations, use `brew install hf`.
Migrate your Spaces configurations to use the 'Volumes' feature, which offers more flexible mounting of models, datasets, and storage buckets. Refer to the `huggingface_hub` documentation for `set_space_volumes` and related API/CLI.
Run `hf login` in your terminal and provide your Hugging Face token (preferably a write token if performing write operations). You can generate tokens on the Hugging Face website under your profile settings.
Install the `hf` package using pip: `pip install hf`. If already installed, ensure your Python installation's script directory is in your PATH.
Log in using the CLI: `hf login`. Provide your Hugging Face Hub token when prompted. For automation, consider using `hf login --token <YOUR_TOKEN>` or setting the `HF_TOKEN` environment variable.
If you need Python APIs to interact with the Hugging Face Hub, use the `huggingface_hub` library. For example: `from huggingface_hub import HfApi`.