Title: | Hugging Face Hub Interface |
---|---|
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. |
Authors: | Daniel Falbel [aut, cre], Regouby Christophe [ctb], Posit [cph] |
Maintainer: | Daniel Falbel <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1.9000 |
Built: | 2024-11-16 05:50:57 UTC |
Source: | https://github.com/mlverse/hfhub |
Downloads files from HuggingFace repositories
hub_download( repo_id, filename, ..., revision = "main", repo_type = "model", local_files_only = FALSE, force_download = FALSE )
hub_download( repo_id, filename, ..., revision = "main", repo_type = "model", local_files_only = FALSE, force_download = FALSE )
repo_id |
The repository identifier, eg |
filename |
Filename to download from the repository. Example |
... |
currenytly unused. |
revision |
Revision (branch, tag or commitid) to download the file from. |
repo_type |
The type of the repository. Currently only |
local_files_only |
Only use cached files? |
force_download |
For re-downloading of files that are cached. |
The file path of the downloaded or cached file. The snapshot path is returned as an attribute.
try({ withr::with_envvar(c(HUGGINGFACE_HUB_CACHE = tempdir()), { path <- hub_download("gpt2", "config.json") print(path) str(jsonlite::fromJSON(path)) }) })
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
hub_repo_info( repo_id, ..., repo_type = NULL, revision = NULL, files_metadata = FALSE ) hub_dataset_info(repo_id, ..., revision = NULL, files_metadata = FALSE)
hub_repo_info( repo_id, ..., repo_type = NULL, revision = NULL, files_metadata = FALSE ) hub_dataset_info(repo_id, ..., revision = NULL, files_metadata = FALSE)
repo_id |
The repository identifier, eg |
... |
currenytly unused. |
repo_type |
The type of the repository. Currently only |
revision |
Revision (branch, tag or commitid) to download the file from. |
files_metadata |
Obtain files metadata information when querying repository information. |
hub_dataset_info()
: Query information from a Hub Dataset
Downloads and stores all files from a Hugging Face Hub repository.
hub_snapshot( repo_id, ..., revision = "main", repo_type = "model", local_files_only = FALSE, force_download = FALSE, allow_patterns = NULL, ignore_patterns = NULL )
hub_snapshot( repo_id, ..., revision = "main", repo_type = "model", local_files_only = FALSE, force_download = FALSE, allow_patterns = NULL, ignore_patterns = NULL )
repo_id |
The repository identifier, eg |
... |
currenytly unused. |
revision |
Revision (branch, tag or commitid) to download the file from. |
repo_type |
The type of the repository. Currently only |
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. |
Weight file names in HUB
WEIGHTS_NAME() WEIGHTS_INDEX_NAME()
WEIGHTS_NAME() WEIGHTS_INDEX_NAME()
A string with the default file names for indexes in the Hugging Face Hub.
WEIGHTS_NAME()
: Name of weights file
WEIGHTS_INDEX_NAME()
: Name of weights index file
WEIGHTS_NAME() WEIGHTS_INDEX_NAME()
WEIGHTS_NAME() WEIGHTS_INDEX_NAME()