hub_download {hfhub} | R Documentation |
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 |
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. |
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))
})
})
[Package hfhub version 0.1.1 Index]