hf-hub  by huggingface

Rust client for Hugging Face Hub API

Created 2 years ago
301 stars

Top 88.3% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

hf-hub is a Rust client library for the Hugging Face Hub API, designed to provide a typed, ergonomic, and performant interface for Rust developers. It offers a direct Rust equivalent to the popular huggingface-hub Python package, enabling seamless integration with Hugging Face's vast ecosystem of models, datasets, and spaces directly from Rust applications.

How It Works

The library provides dual interfaces: an asynchronous HFClient (default) and a synchronous HFClientSync (enabled via the blocking feature). Both interfaces mirror each other method-for-method, covering repository metadata operations, file uploads/downloads, commit history, branch/tag management, user/organization details, and bucket operations. It leverages Rust's type system for robust API interactions and supports Xet high-performance transfers for efficient data handling. Asynchronous list endpoints utilize Stream for lazy, memory-efficient iteration.

Quick Start & Requirements

  • Installation: Add hf-hub = "1.0.0" to Cargo.toml. For synchronous operations, use hf-hub = { version = "1.0.0", features = ["blocking"] }.
  • CLI Tool: Install the hfrs command-line interface via cargo install --git https://github.com/huggingface/hf-hub.git.
  • Prerequisites: Standard Rust toolchain. No specific hardware or external services beyond Hugging Face Hub access are detailed.
  • Documentation: Usage examples are provided within the README.

Highlighted Details

  • Dual async/blocking API design for flexible integration.
  • Comprehensive Hub feature support: repository, file, commit, branch, tag, user, organization, and bucket management.
  • Optimized data transfers via Xet backend support.
  • Memory-efficient lazy iteration using Stream for async list operations.
  • hfrs CLI tool for direct terminal interaction with the Hub.

Maintenance & Community

No specific details regarding maintainers, community channels (e.g., Discord, Slack), or roadmap are present in the provided README.

Licensing & Compatibility

The project is licensed under the Apache-2.0 license. This permissive license allows for commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

The provided README does not detail specific limitations, known bugs, or alpha/beta status. The library appears to offer a stable, feature-complete Rust interface mirroring the Python huggingface-hub package.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
17
Issues (30d)
1
Star History
11 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Travis Fischer Travis Fischer(Founder of Agentic), and
1 more.

fastmcp by punkpeye

0.8%
3k
TypeScript framework for building MCP servers handling client sessions
Created 1 year ago
Updated 3 weeks ago
Starred by Jason Knight Jason Knight(Director AI Compilers at NVIDIA; Cofounder of OctoML) and Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm).

rust-sdk by modelcontextprotocol

0.7%
3k
Rust SDK for Model Context Protocol
Created 1 year ago
Updated 1 week ago
Feedback? Help us improve.