https://github.com/mlverse/hfhub
Download and cache HuggingFace Hub files
https://github.com/mlverse/hfhub
Last synced: 12 months ago
JSON representation
Download and cache HuggingFace Hub files
- Host: GitHub
- URL: https://github.com/mlverse/hfhub
- Owner: mlverse
- License: other
- Created: 2023-05-17T07:25:35.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-09-17T14:44:30.000Z (almost 2 years ago)
- Last Synced: 2025-07-14T11:50:46.673Z (12 months ago)
- Language: R
- Homepage: https://mlverse.github.io/hfhub/
- Size: 1.19 MB
- Stars: 18
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
# hfhub
[](https://github.com/mlverse/hfhub/actions/workflows/R-CMD-check.yaml)
hfhub is a minimal port of [huggingface_hub](https://github.com/huggingface/huggingface_hub) that allows downloading files from Hugging Face Hub and caching them with the same structure used in the original implementation.
## Installation
`hfhub` can be installed from CRAN with:
```
install.packages("hfhub")
```
You can install the development version of hfhub like so:
``` r
remotes::install_github("mlverse/hfhub")
```
## Example
`hub_download` the the only exported function in the package and can be used to
download and cache a file from any Hugging Face Hub repository. It returns a
path to the file.
``` r
library(hfhub)
path <- hub_download("gpt2", "config.json")
str(jsonlite::fromJSON(path))
```
## Authentication
You can set the `HUGGING_FACE_HUB_TOKEN` environment variable with the value
of a token obtained in the Access Token section of the Hugging Face account setting page.
This will allow you to download private files from Hugging Face Hub.