HuggingFaceApi
Documentation for HuggingFaceApi.
HuggingFaceApi.HuggingFaceURLHuggingFaceApi.cached_downloadHuggingFaceApi.dataset_infoHuggingFaceApi.delete_tokenHuggingFaceApi.get_tokenHuggingFaceApi.hf_hub_downloadHuggingFaceApi.huggingface_emojiHuggingFaceApi.list_cacheHuggingFaceApi.list_dataset_filesHuggingFaceApi.list_datasetsHuggingFaceApi.list_metricsHuggingFaceApi.list_model_filesHuggingFaceApi.list_modelsHuggingFaceApi.list_space_filesHuggingFaceApi.list_spacesHuggingFaceApi.loginHuggingFaceApi.logoutHuggingFaceApi.model_infoHuggingFaceApi.remove_cacheHuggingFaceApi.remove_cacheHuggingFaceApi.remove_cacheHuggingFaceApi.save_tokenHuggingFaceApi.space_info
HuggingFaceApi.HuggingFaceURL — TypeHuggingFaceURL(repo_id, [subfolder], filename;
repo_type = nothing,
revision = "main")Construct the real url with the inputs.
HuggingFaceApi.cached_download — Methodcached_download(
hgfurl :: HuggingFaceURL;
local_files_only :: Bool = false,
auth_token :: Union{AbstractString, Nothing} = nothing,
)Find the local cache of given url or do downloading. If local_files_only is set, it will try to find the file from cache, and error out when not found. For downloading from private repo, auth_token need to be set, or do HuggingFaceApi.login() beforehand.
See also: HuggingFaceURL, login
HuggingFaceApi.dataset_info — Functiondataset_info(repo_id; revision = nothing, token = get_token())Get information for a specific dataset repo repo_id.
HuggingFaceApi.delete_token — Methoddelete_token()Remove token from the disk.
HuggingFaceApi.get_token — Methodget_token()Get the token stored on disk.
HuggingFaceApi.hf_hub_download — Methodhf_hub_download(
repo_id :: AbstractString,
filename :: AbstractString;
repo_type = nothing,
revision = "main",
auth_token :: Union{AbstractString, Nothing} = get_token(),
local_files_only :: Bool = false,
cache :: Bool = true,
)Construct HuggingFaceURL and do cached_download. If cache is false, download file to the temp dir with name generated by tempname(). If local_files_only is set, cache must set.
HuggingFaceApi.huggingface_emoji — Methodadd 🤗 autocomplete in REPL
HuggingFaceApi.list_cache — Functionlist_cache()Get the list of all the cache.
HuggingFaceApi.list_dataset_files — Functionlist_dataset_files(repo_id; revision = nothing, token = get_token())List all files in the specific dataset repo repo_id.
HuggingFaceApi.list_datasets — Functionlist_datasets(token = get_token();
search = nothing, author = nothing, filter = nothing,
sort = nothing, direction = nothing, limit = nothing,
full::Bool = false, cardData::Bool = false)Get information from all datasets in the Hub. You can specify additional parameters to have more specific results.
search: Filter based on substrings for repos and their usernames, such as pets or microsoftauthor: Filter datasets by an other or organization, such as huggingface or microsoftfilter: Filter based on tags, such as task_categories:text-classification or languages:en.sort: Property to use when sorting, such as downloads or author.direction: Direction in which to sort, such as -1 for descending, and anything else for ascending.limit: Limit the number of datasets fetched.full: Whether to fetch most dataset data, such as all tags, the files, etc.cardData: Whether to grab the metadata for the dataset as well. Can contain useful information such as the PapersWithCode ID.
HuggingFaceApi.list_metrics — Methodlist_metrics()Get information from all metrics in the Hub.
HuggingFaceApi.list_model_files — Functionlist_model_files(repo_id; revision = nothing, token = get_token())List all files in the specific model repo repo_id.
HuggingFaceApi.list_models — Functionlist_models(token = get_token();
search = nothing, author = nothing, filter = nothing,
sort = nothing, direction = nothing, limit = nothing,
full::Bool = !isnothing(filter), cardData::Bool = false)Get information from all models in the Hub. You can specify additional parameters to have more specific results.
search: Filter based on substrings for repos and their usernames, such as resnet or microsoftauthor: Filter models by an author or organization, such as huggingface or microsoftfilter: Filter based on tags, such as text-classification or spacy.sort: Property to use when sorting, such as downloads or author.direction: Direction in which to sort, such as -1 for descending, and anything else for ascending.limit: Limit the number of models fetched.full: Whether to fetch most model data, such as all tags, the files, etc.cardData: Whether to grab the metadata for the model as well, such as carbon emissions, metrics, and datasets trained on.
HuggingFaceApi.list_space_files — Functionlist_space_files(repo_id; revision = nothing, token = get_token())List all files in the specific space repo repo_id.
HuggingFaceApi.list_spaces — Functionlist_spaces(token = get_token();
search = nothing, author = nothing, filter = nothing,
datasets = nothing, models = nothing, linked::Bool = false,
sort = nothing, direction = nothing, limit = nothing,
full::Bool = false)Get information from all Spaces in the Hub. You can specify additional parameters to have more specific results.
search: Filter based on substrings for repos and their usernames, such as resnet or microsoftauthor: Filter models by an author or organization, such as huggingface or microsoftfilter: Filter based on tags, such as text-classification or spacy.sort: Property to use when sorting, such as downloads or author.direction: Direction in which to sort, such as -1 for descending, and anything else for ascending.limit: Limit the number of models fetched.full: Whether to fetch most model data, such as all tags, the files, etc.datasets: Whether to return Spaces that make use of a dataset. The name of a specific dataset can be passed as a string.models: Whether to return Spaces that make use of a model. The name of a specific model can be passed as a string.linked: Whether to return Spaces that make use of either a model or a dataset.
HuggingFaceApi.login — Methodlogin(user::AbstractString = readline())Login to huggingface hub and get/save the account token for operations that need authentication. Re-run this function with username (i.e. login(username)) if token expired.
HuggingFaceApi.logout — Functionlogout()Logout from huggingface hub and remove all authentication cache.
HuggingFaceApi.model_info — Functionmodel_info(repo_id; revision = nothing, token = get_token())Get information for a specific model repo repo_id.
HuggingFaceApi.remove_cache — Methodremove_cache(repo_id::AbstractString; repo_type = nothing, revision = "main", now = false)Remove all cached files of a given repo. If now is set to true, cache file will be deleted immediately, otherwise waiting OhMyArtifacts to do the garbage collection.
HuggingFaceApi.remove_cache — Methodremove_cache(hgfurl::HuggingFaceURL; now = false)Remove files link to the given url. If now is set to true, cache file will be deleted immediately, otherwise waiting OhMyArtifacts to do the garbage collection.
HuggingFaceApi.remove_cache — Methodremove_cache(; now=false)Remove all cached files. If now is set to true, cache file will be deleted immediately, otherwise waiting OhMyArtifacts to do the garbage collection.
HuggingFaceApi.save_token — Methodsave_token(token)Write token to the disk for future use.
HuggingFaceApi.space_info — Functionspace_info(repo_id; revision = nothing, token = get_token())Get information for a specific space repo repo_id.