#machine-learning #huggingface #hub #python-packages #hf

hf-hub

This crates aims ease the interaction with huggingface It aims to be compatible with huggingface_hub python package, but only implements a smaller subset of functions

8 releases

0.3.2 Oct 4, 2023
0.3.1 Sep 13, 2023
0.3.0 Aug 29, 2023
0.2.0 Jul 27, 2023
0.1.3 Jul 20, 2023

#47 in Machine learning

Download history 13140/week @ 2024-07-23 13658/week @ 2024-07-30 13157/week @ 2024-08-06 13524/week @ 2024-08-13 12867/week @ 2024-08-20 13213/week @ 2024-08-27 12723/week @ 2024-09-03 13878/week @ 2024-09-10 13885/week @ 2024-09-17 14215/week @ 2024-09-24 15522/week @ 2024-10-01 14236/week @ 2024-10-08 13378/week @ 2024-10-15 14429/week @ 2024-10-22 12623/week @ 2024-10-29 12702/week @ 2024-11-05

56,598 downloads per month
Used in 76 crates (40 directly)

Apache-2.0

73KB
1.5K SLoC

This crates aims to emulate and be compatible with the huggingface_hub python package.

compatible means the Api should reuse the same files skipping downloads if they are already present and whenever this crate downloads or modifies this cache it should be consistent with huggingface_hub

At this time only a limited subset of the functionality is present, the goal is to add new features over time. We are currently treating this as an internel/external tool, meaning we will are currently modifying everything at will for out internal needs. This will eventually stabilize as it matures to accomodate most of our needs.

If you're interested in using this, you're welcome to do it but be warned about potential changing grounds.

If you want to contribute, you are more than welcome.

However allowing new features or creating new features might be denied by lack of maintainability time. We're focusing on what we currently internally need. Hopefully that subset is already interesting to more users.

How to use

Add the dependency

cargo add hf-hub  # --features tokio

tokio feature will enable an async (and potentially faster) API.

Use the crate:

use hf_hub::api::sync::Api;

let api = Api::new().unwrap();

let repo = api.model("bert-base-uncased".to_string());
let _filename = repo.get("config.json").unwrap();

// filename  is now the local location within hf cache of the config.json file

Dependencies

~0.1–14MB
~193K SLoC