Exciting Updates: The Hugging Face CLI is Now Simplified to hf
We’re thrilled to announce a significant quality-of-life improvement: the Hugging Face Command Line Interface (CLI) has officially undergone a name change from huggingface-cli to hf! This transition isn’t just cosmetic; it’s a step towards a more efficient and user-friendly experience for all our developers and machine learning enthusiasts.
Why the Name Change?
Typing huggingface-cli repeatedly can become cumbersome over time. More importantly, as we’ve added new features like uploading, downloading, cache management, and repository management, the command structure became scattered and less intuitive.
By renaming the CLI to hf, we’re taking this opportunity to reorganize commands into a clearer and more consistent format. The new structure follows a well-known pattern of:
hf <resource> <action>
This logical format enhances ergonomics and discoverability, paving the way for even more groundbreaking features in the future.
Getting Started with hf
Installation
To dive right into the new CLI, first ensure that you have the latest version of the huggingface_hub installed. You can easily update to the newest version by running the following command in your terminal:
bash
pip install -U huggingface_hub
After installation, make sure to reload your terminal session. To verify that everything is set up correctly, run:
bash
hf version
You should see an output confirming the installed version of huggingface_hub.
Understanding the New Syntax
To familiarize yourself with the updated syntax, simply enter:
bash
hf –help
This will display a helpful usage guide. You’ll see that commands are now organized by resource categories, making it easier to find what you’re looking for:
- Auth: Manage user authentication.
- Cache: Handle your local cache directory.
- Download: Download files from the Hub.
- Repo: Oversee repositories on the Hub.
- Upload: Upload files or folders effortlessly.
For instance, if you want to explore the authentication commands, just run:
bash
hf auth –help
You’ll receive a detailed list of all authentication subcommands like login, logout, whoami, and more.
Smooth Migration from huggingface-cli
Switching to hf is straightforward. Many commands will feel familiar, but there’s a structural tweak primarily in the authentication commands. For example, instead of:
bash
huggingface-cli login
You’ll now use:
bash
hf auth login
This is just one of several streamlined commands. The legacy huggingface-cli will remain active for the time being to ensure an easy transition. If you try using a deprecated command, you’ll receive a helpful warning pointing you toward the new equivalent.
Introducing hf jobs
In addition to the revamped command structure, we’re excited to introduce our first dedicated command: hf jobs. This new feature allows you to run scripts or Docker images on Hugging Face Infrastructure with ease, using the hardware flavor of your choice.
The billing for this service is straightforward — it operates on a "pay-as-you-go" model, meaning you only pay for what you use. To get started with your first command, type:
bash
hf jobs run –flavor=a10g-small ubuntu nvidia-smi
Familiar Command Style
If you’re familiar with Docker commands, you’ll find hf jobs intuitive. You can investigate your jobs or manage them effortlessly using commands like:
bash
hf jobs –help
This will provide options to list jobs, inspect details, view logs, and even cancel jobs.
Note: Hugging Face Jobs are currently available only for Pro users and Team or Enterprise organizations. Upgrade your plan to start leveraging this exciting feature today!
By enhancing the CLI’s structure and introducing new functionalities, we’re committed to making your experience with Hugging Face even better. With the launch of hf, diving into machine learning with Hugging Face has never been more accessible!
Inspired by: Source

