The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Title: Hugging Face Hub Interface
Version: 0.1.1
Description: Provides functionality to download and cache files from 'Hugging Face Hub' https://huggingface.co/models. Uses the same caching structure so files can be shared between different client libraries.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.3
Imports: httr, filelock, fs, cli, withr, curl, glue, urltools, rlang
Suggests: testthat (≥ 3.0.0), jsonlite
Config/testthat/edition: 3
URL: https://mlverse.github.io/hfhub/
NeedsCompilation: no
Packaged: 2023-08-18 19:06:18 UTC; dfalbel
Author: Daniel Falbel [aut, cre], Posit [cph]
Maintainer: Daniel Falbel <daniel@posit.co>
Repository: CRAN
Date/Publication: 2023-08-18 19:22:33 UTC

Weight file names in HUB

Description

Weight file names in HUB

Usage

WEIGHTS_NAME()

WEIGHTS_INDEX_NAME()

Value

A string with the default file names for indexes in the Hugging Face Hub.

Functions

Examples

WEIGHTS_NAME()
WEIGHTS_INDEX_NAME()

Downloads files from HuggingFace repositories

Description

Downloads files from HuggingFace repositories

Usage

hub_download(
  repo_id,
  filename,
  ...,
  revision = "main",
  repo_type = "model",
  local_files_only = FALSE,
  force_download = FALSE
)

Arguments

repo_id

The repository identifier, eg "bert-base-uncased" or "deepset/sentence_bert".

filename

Filename to download from the repository. Example "config.json".

...

currenytly unused.

revision

Revision (branch, tag or commitid) to download the file from.

repo_type

The type of the repository. Currently only "model" is supported.

local_files_only

Only use cached files?

force_download

For re-downloading of files that are cached.

Value

The file path of the downloaded or cached file. The snapshot path is returned as an attribute.

Examples

try({
withr::with_envvar(c(HUGGINGFACE_HUB_CACHE = tempdir()), {
path <- hub_download("gpt2", "config.json")
print(path)
str(jsonlite::fromJSON(path))
})
})


Queries information about Hub repositories

Description

Queries information about Hub repositories

Usage

hub_repo_info(
  repo_id,
  ...,
  repo_type = NULL,
  revision = NULL,
  files_metadata = FALSE
)

hub_dataset_info(repo_id, ..., revision = NULL, files_metadata = FALSE)

Arguments

repo_id

The repository identifier, eg "bert-base-uncased" or "deepset/sentence_bert".

...

currenytly unused.

repo_type

The type of the repository. Currently only "model" is supported.

revision

Revision (branch, tag or commitid) to download the file from.

files_metadata

Obtain files metadata information when querying repository information.

Functions


Snapshot the entire repository

Description

Downloads and stores all files from a Hugging Face Hub repository.

Usage

hub_snapshot(
  repo_id,
  ...,
  revision = "main",
  repo_type = "model",
  local_files_only = FALSE,
  force_download = FALSE,
  allow_patterns = NULL,
  ignore_patterns = NULL
)

Arguments

repo_id

The repository identifier, eg "bert-base-uncased" or "deepset/sentence_bert".

...

currenytly unused.

revision

Revision (branch, tag or commitid) to download the file from.

repo_type

The type of the repository. Currently only "model" is supported.

local_files_only

Only use cached files?

force_download

For re-downloading of files that are cached.

allow_patterns

A character vector containing patters that are used to filter allowed files to snapshot.

ignore_patterns

A character vector contaitning patterns to reject files from being downloaded.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.