text
stringlengths
3
7.31k
source
stringclasses
40 values
url
stringlengths
53
184
source_section
stringlengths
0
105
file_type
stringclasses
1 value
id
stringlengths
3
6
```python Frozen data structure holding information about a cached repository. Args: repo_id (`str`): Repo id of the repo on the Hub. Example: `"google/fleurs"`. repo_type (`Literal["dataset", "model", "space"]`): Type of the cached repo. repo_path (`Path`): Local path to the cached repo. size_on_disk (`int`): Sum of ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cache.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cache/#huggingfacehubcachedrepoinfo
#huggingfacehubcachedrepoinfo
.md
20_10
```python Frozen data structure holding information about a revision. A revision correspond to a folder in the `snapshots` folder and is populated with the exact tree structure as the repo on the Hub but contains only symlinks. A revision can be either referenced by 1 or more `refs` or be "detached" (no refs). Args: ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cache.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cache/#huggingfacehubcachedrevisioninfo
#huggingfacehubcachedrevisioninfo
.md
20_11
```python Frozen data structure holding information about a single cached file. Args: file_name (`str`): Name of the file. Example: `config.json`. file_path (`Path`): Path of the file in the `snapshots` directory. The file path is a symlink referring to a blob in the `blobs` folder. blob_path (`Path`): Path of the blo...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cache.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cache/#huggingfacehubcachedfileinfo
#huggingfacehubcachedfileinfo
.md
20_12
```python Frozen data structure holding the strategy to delete cached revisions. This object is not meant to be instantiated programmatically but to be returned by [`~utils.HFCacheInfo.delete_revisions`]. See documentation for usage example. Args: expected_freed_size (`float`): Expected freed size once strategy is ex...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cache.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cache/#huggingfacehubdeletecachestrategy
#huggingfacehubdeletecachestrategy
.md
20_13
```python Exception for any unexpected structure in the Huggingface cache-system. ```
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cache.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cache/#huggingfacehubcorruptedcacheexception
#huggingfacehubcorruptedcacheexception
.md
20_14
<!--⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. -->
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/
.md
21_0
`huggingface_hub` can be configured using environment variables. If you are unfamiliar with environment variable, here are generic articles about them [on macOS and Linux](https://linuxize.com/post/how-to-set-and-list-environment-variables-in-linux/) and on [Windows](https://phoenixnap.com/kb/windows-set-environment-...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#environment-variables
#environment-variables
.md
21_1
To configure the inference api base url. You might want to set this variable if your organization is pointing at an API Gateway rather than directly at the inference api. Defaults to `"/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co"`.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfinferenceendpoint
#hfinferenceendpoint
.md
21_2
To configure where `huggingface_hub` will locally store data. In particular, your token and the cache will be stored in this folder. Defaults to `"~/.cache/huggingface"` unless [XDG_CACHE_HOME](#xdgcachehome) is set.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhome
#hfhome
.md
21_3
To configure where repositories from the Hub will be cached locally (models, datasets and spaces). Defaults to `"$HF_HOME/hub"` (e.g. `"~/.cache/huggingface/hub"` by default).
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubcache
#hfhubcache
.md
21_4
To configure where [assets](../guides/manage-cache#caching-assets) created by downstream libraries will be cached locally. Those assets can be preprocessed data, files downloaded from GitHub, logs,... Defaults to `"$HF_HOME/assets"` (e.g. `"~/.cache/huggingface/assets"` by default).
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfassetscache
#hfassetscache
.md
21_5
To configure the User Access Token to authenticate to the Hub. If set, this value will overwrite the token stored on the machine (in either `$HF_TOKEN_PATH` or `"$HF_HOME/token"` if the former is not set). For more details about authentication, check out [this section](../quick-start#authentication).
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hftoken
#hftoken
.md
21_6
To configure where `huggingface_hub` should store the User Access Token. Defaults to `"$HF_HOME/token"` (e.g. `~/.cache/huggingface/token` by default).
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hftokenpath
#hftokenpath
.md
21_7
Set the verbosity level of the `huggingface_hub`'s logger. Must be one of `{"debug", "info", "warning", "error", "critical"}`. Defaults to `"warning"`. For more details, see [logging reference](../package_reference/utilities#huggingface_hub.utils.logging.get_verbosity).
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubverbosity
#hfhubverbosity
.md
21_8
This environment variable has been deprecated and is now ignored by `huggingface_hub`. Downloading files to the local dir does not rely on symlinks anymore.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhublocaldirautosymlinkthreshold
#hfhublocaldirautosymlinkthreshold
.md
21_9
Integer value to define the number of seconds to wait for server response when fetching the latest metadata from a repo before downloading a file. If the request times out, `huggingface_hub` will default to the locally cached files. Setting a lower value speeds up the workflow for machines with a slow connection that h...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubetagtimeout
#hfhubetagtimeout
.md
21_10
Integer value to define the number of seconds to wait for server response when downloading a file. If the request times out, a TimeoutError is raised. Setting a higher value is beneficial on machine with a slow connection. A smaller value makes the process fail quicker in case of complete network outage. Default to 10s...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubdownloadtimeout
#hfhubdownloadtimeout
.md
21_11
The following environment variables expect a boolean value. The variable will be considered as `True` if its value is one of `{"1", "ON", "YES", "TRUE"}` (case-insensitive). Any other value (or undefined) will be considered as `False`.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#boolean-values
#boolean-values
.md
21_12
If set, no HTTP calls will be made to the Hugging Face Hub. If you try to download files, only the cached files will be accessed. If no cache file is detected, an error is raised This is useful in case your network is slow and you don't care about having the latest version of a file. If `HF_HUB_OFFLINE=1` is set as e...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhuboffline
#hfhuboffline
.md
21_13
Authentication is not mandatory for every requests to the Hub. For instance, requesting details about `"gpt2"` model does not require to be authenticated. However, if a user is [logged in](../package_reference/login), the default behavior will be to always send the token in order to ease user experience (never get a HT...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubdisableimplicittoken
#hfhubdisableimplicittoken
.md
21_14
For time consuming tasks, `huggingface_hub` displays a progress bar by default (using tqdm). You can disable all the progress bars at once by setting `HF_HUB_DISABLE_PROGRESS_BARS=1`.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubdisableprogressbars
#hfhubdisableprogressbars
.md
21_15
If you are on a Windows machine, it is recommended to enable the developer mode or to run `huggingface_hub` in admin mode. If not, `huggingface_hub` will not be able to create symlinks in your cache system. You will be able to execute any script but your user experience will be degraded as some huge files might end-up ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubdisablesymlinkswarning
#hfhubdisablesymlinkswarning
.md
21_16
Some features of `huggingface_hub` are experimental. This means you can use them but we do not guarantee they will be maintained in the future. In particular, we might update the API or behavior of such features without any deprecation cycle. A warning message is triggered when using an experimental feature to warn you...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubdisableexperimentalwarning
#hfhubdisableexperimentalwarning
.md
21_17
By default, some data is collected by HF libraries (`transformers`, `datasets`, `gradio`,..) to monitor usage, debug issues and help prioritize features. Each library defines its own policy (i.e. which usage to monitor) but the core implementation happens in `huggingface_hub` (see [`send_telemetry`]). You can set `HF...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubdisabletelemetry
#hfhubdisabletelemetry
.md
21_18
Set to `True` for faster uploads and downloads from the Hub using `hf_transfer`. By default, `huggingface_hub` uses the Python-based `requests.get` and `requests.post` functions. Although these are reliable and versatile, they may not be the most efficient choice for machines with high bandwidth. [`hf_transfer`](http...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#hfhubenablehftransfer
#hfhubenablehftransfer
.md
21_19
In order to standardize all environment variables within the Hugging Face ecosystem, some variables have been marked as deprecated. Although they remain functional, they no longer take precedence over their replacements. The following table outlines the deprecated variables and their corresponding alternatives: | Dep...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#deprecated-environment-variables
#deprecated-environment-variables
.md
21_20
Some environment variables are not specific to `huggingface_hub` but are still taken into account when they are set.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#from-external-tools
#from-external-tools
.md
21_21
Boolean value. Equivalent to `HF_HUB_DISABLE_TELEMETRY`. When set to true, telemetry is globally disabled in the Hugging Face Python ecosystem (`transformers`, `diffusers`, `gradio`, etc.). See https://consoledonottrack.com/ for more details.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#donottrack
#donottrack
.md
21_22
Boolean value. When set, `huggingface-cli` tool will not print any ANSI color. See [no-color.org](https://no-color.org/).
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#nocolor
#nocolor
.md
21_23
Used only when `HF_HOME` is not set! This is the default way to configure where [user-specific non-essential (cached) data should be written](https://wiki.archlinux.org/title/XDG_Base_Directory) on linux machines. If `HF_HOME` is not set, the default home will be `"$XDG_CACHE_HOME/huggingface"` instead of `"~/.cach...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/environment_variables.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables/#xdgcachehome
#xdgcachehome
.md
21_24
<!--⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. -->
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/
.md
22_0
The huggingface_hub library provides a Python interface to create, share, and update Model/Dataset Cards. Visit the [dedicated documentation page](https://huggingface.co/docs/hub/models-cards) for a deeper view of what Model Cards on the Hub are, and how they work under the hood. You can also check out our [Model Cards...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#repository-cards
#repository-cards
.md
22_1
The `RepoCard` object is the parent class of [`ModelCard`], [`DatasetCard`] and `SpaceCard`.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#repo-card
#repo-card
.md
22_2
No docstring found for huggingface_hub.repocard.RepoCard - __init__ - all
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#huggingfacehubrepocardrepocard
#huggingfacehubrepocardrepocard
.md
22_3
The [`CardData`] object is the parent class of [`ModelCardData`] and [`DatasetCardData`].
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#card-data
#card-data
.md
22_4
```python Structure containing metadata from a RepoCard. [`CardData`] is the parent class of [`ModelCardData`] and [`DatasetCardData`]. Metadata can be exported as a dictionary or YAML. Export can be customized to alter the representation of the data (example: flatten evaluation results). `CardData` behaves as a dict...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#huggingfacehubrepocarddatacarddata
#huggingfacehubrepocarddatacarddata
.md
22_5
No docstring found for huggingface_hub.ModelCard
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#modelcard
#modelcard
.md
22_6
```python Model Card Metadata that is used by Hugging Face Hub when included at the top of your README.md Args: base_model (`str` or `List[str]`, *optional*): The identifier of the base model from which the model derives. This is applicable for example if your model is a fine-tune or adapter of an existing model. The ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#modelcarddata
#modelcarddata
.md
22_7
Dataset cards are also known as Data Cards in the ML Community.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#dataset-cards
#dataset-cards
.md
22_8
No docstring found for huggingface_hub.DatasetCard
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#datasetcard
#datasetcard
.md
22_9
```python Dataset Card Metadata that is used by Hugging Face Hub when included at the top of your README.md Args: language (`List[str]`, *optional*): Language of dataset's data or metadata. It must be an ISO 639-1, 639-2 or 639-3 code (two/three letters), or a special value like "code", "multilingual". license (`Union...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#datasetcarddata
#datasetcarddata
.md
22_10
No docstring found for huggingface_hub.SpaceCard
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#spacecard
#spacecard
.md
22_11
```python Space Card Metadata that is used by Hugging Face Hub when included at the top of your README.md To get an exhaustive reference of Spaces configuration, please visit https://huggingface.co/docs/hub/spaces-config-reference#spaces-configuration-reference. Args: title (`str`, *optional*) Title of the Space. sdk...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#spacecarddata
#spacecarddata
.md
22_12
```python Flattened representation of individual evaluation results found in model-index of Model Cards. For more information on the model-index spec, see https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1. Args: task_type (`str`): The task identifier. Example: "image-classification". dataset_type...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#evalresult
#evalresult
.md
22_13
```python Takes in a model index and returns the model name and a list of `huggingface_hub.EvalResult` objects. A detailed spec of the model index can be found here: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1 Args: model_index (`List[Dict[str, Any]]`): A model index data structure, likely ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#huggingfacehubrepocarddatamodelindextoevalresults
#huggingfacehubrepocarddatamodelindextoevalresults
.md
22_14
```python Takes in given model name and list of `huggingface_hub.EvalResult` and returns a valid model-index that will be compatible with the format expected by the Hugging Face Hub. Args: model_name (`str`): Name of the model (ex. "my-cool-model"). This is used as the identifier for the model on leaderboards like Pap...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#huggingfacehubrepocarddataevalresultstomodelindex
#huggingfacehubrepocarddataevalresultstomodelindex
.md
22_15
```python Creates a metadata dict with the result from a model evaluated on a dataset. Args: model_pretty_name (`str`): The name of the model in natural language. task_pretty_name (`str`): The name of a task in natural language. task_id (`str`): Example: automatic-speech-recognition. A task id. metrics_pretty_name (`s...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#huggingfacehubrepocardmetadataevalresult
#huggingfacehubrepocardmetadataevalresult
.md
22_16
```python Updates the metadata in the README.md of a repository on the Hugging Face Hub. If the README.md file doesn't exist yet, a new one is created with metadata and an the default ModelCard or DatasetCard template. For `space` repo, an error is thrown as a Space cannot exist without a `README.md` file. Args: repo_...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/cards.md
https://huggingface.co/docs/huggingface_hub/en/package_reference/cards/#huggingfacehubrepocardmetadataupdate
#huggingfacehubrepocardmetadataupdate
.md
22_17
Inference Endpoints provides a secure production solution to easily deploy any `transformers`, `sentence-transformers`, and `diffusers` models on a dedicated and autoscaling infrastructure managed by Hugging Face. An Inference Endpoint is built from a model from the [Hub](https://huggingface.co/models). In this guide, ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#inference-endpoints
#inference-endpoints
.md
23_0
The first step is to create an Inference Endpoint using [`create_inference_endpoint`]: ```py >>> from huggingface_hub import create_inference_endpoint >>> endpoint = create_inference_endpoint( ... "my-endpoint-name", ... repository="gpt2", ... framework="pytorch", ... task="text-generation", ... ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#create-an-inference-endpoint
#create-an-inference-endpoint
.md
23_1
By default the Inference Endpoint is built from a docker image provided by Hugging Face. However, it is possible to specify any docker image using the `custom_image` parameter. A common use case is to run LLMs using the [text-generation-inference](https://github.com/huggingface/text-generation-inference) framework. Thi...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#using-a-custom-image
#using-a-custom-image
.md
23_2
In some cases, you might need to manage Inference Endpoints you created previously. If you know the name, you can fetch it using [`get_inference_endpoint`], which returns an [`InferenceEndpoint`] object. Alternatively, you can use [`list_inference_endpoints`] to retrieve a list of all Inference Endpoints. Both methods ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#get-or-list-existing-inference-endpoints
#get-or-list-existing-inference-endpoints
.md
23_3
In the rest of this guide, we will assume that we have a [`InferenceEndpoint`] object called `endpoint`. You might have noticed that the endpoint has a `status` attribute of type [`InferenceEndpointStatus`]. When the Inference Endpoint is deployed and accessible, the status should be `"running"` and the `url` attribute...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#check-deployment-status
#check-deployment-status
.md
23_4
Once your Inference Endpoint is up and running, you can finally run inference on it! [`InferenceEndpoint`] has two properties `client` and `async_client` returning respectively an [`InferenceClient`] and an [`AsyncInferenceClient`] objects. ```py # Run text_generation task: >>> endpoint.client.text_generation("I am...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#run-inference
#run-inference
.md
23_5
Now that we saw how to create an Inference Endpoint and run inference on it, let's see how to manage its lifecycle. <Tip> In this section, we will see methods like [`~InferenceEndpoint.pause`], [`~InferenceEndpoint.resume`], [`~InferenceEndpoint.scale_to_zero`], [`~InferenceEndpoint.update`] and [`~InferenceEndpoin...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#manage-lifecycle
#manage-lifecycle
.md
23_6
To reduce costs when your Inference Endpoint is not in use, you can choose to either pause it using [`~InferenceEndpoint.pause`] or scale it to zero using [`~InferenceEndpoint.scale_to_zero`]. <Tip> An Inference Endpoint that is *paused* or *scaled to zero* doesn't cost anything. The difference between those two is...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#pause-or-scale-to-zero
#pause-or-scale-to-zero
.md
23_7
In some cases, you might also want to update your Inference Endpoint without creating a new one. You can either update the hosted model or the hardware requirements to run the model. You can do this using [`~InferenceEndpoint.update`]: ```py # Change target model >>> endpoint.update(repository="gpt2-large") Inference...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#update-model-or-hardware-requirements
#update-model-or-hardware-requirements
.md
23_8
Finally if you won't use the Inference Endpoint anymore, you can simply call [`~InferenceEndpoint.delete()`]. <Tip warning={true}> This is a non-revertible action that will completely remove the endpoint, including its configuration, logs and usage metrics. You cannot restore a deleted Inference Endpoint. </Tip>
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#delete-the-endpoint
#delete-the-endpoint
.md
23_9
A typical use case of Inference Endpoints is to process a batch of jobs at once to limit the infrastructure costs. You can automate this process using what we saw in this guide: ```py >>> import asyncio >>> from huggingface_hub import create_inference_endpoint # Start endpoint + wait until initialized >>> endpoint =...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference_endpoints.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference_endpoints/#an-end-to-end-example
#an-end-to-end-example
.md
23_10
<!--⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. -->
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/
.md
24_0
Inference is the process of using a trained model to make predictions on new data. As this process can be compute-intensive, running on a dedicated server can be an interesting option. The `huggingface_hub` library provides an easy way to call a service that runs inference for hosted models. There are several services ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#run-inference-on-servers
#run-inference-on-servers
.md
24_1
Let's get started with a text-to-image task: ```python >>> from huggingface_hub import InferenceClient >>> client = InferenceClient() >>> image = client.text_to_image("An astronaut riding a horse on the moon.") >>> image.save("astronaut.png") # 'image' is a PIL.Image object ``` In the example above, we initialize...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#getting-started
#getting-started
.md
24_2
What if you want to use a specific model? You can specify it either as a parameter or directly at an instance level: ```python >>> from huggingface_hub import InferenceClient # Initialize client for a specific model >>> client = InferenceClient(model="prompthero/openjourney-v4") >>> client.text_to_image(...) # Or use...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#using-a-specific-model
#using-a-specific-model
.md
24_3
The examples we saw above use the Serverless Inference API. This proves to be very useful for prototyping and testing things quickly. Once you're ready to deploy your model to production, you'll need to use a dedicated infrastructure. That's where [Inference Endpoints](https://huggingface.co/docs/inference-endpoints/in...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#using-a-specific-url
#using-a-specific-url
.md
24_4
Calls made with the [`InferenceClient`] can be authenticated using a [User Access Token](https://huggingface.co/docs/hub/security-tokens). By default, it will use the token saved on your machine if you are logged in (check out [how to authenticate](https://huggingface.co/docs/huggingface_hub/quick-start#authentication)...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#authentication
#authentication
.md
24_5
The `chat_completion` task follows [OpenAI's Python client](https://github.com/openai/openai-python) syntax. What does it mean for you? It means that if you are used to play with `OpenAI`'s APIs you will be able to switch to `huggingface_hub.InferenceClient` to work with open-source models by updating just 2 line of co...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#openai-compatibility
#openai-compatibility
.md
24_6
[`InferenceClient`]'s goal is to provide the easiest interface to run inference on Hugging Face models. It has a simple API that supports the most common tasks. Here is a list of the currently supported tasks: | Domain | Task | Supported | Documentation | |----...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#supported-tasks
#supported-tasks
.md
24_7
However, it is not always possible to cover all use cases. For custom requests, the [`InferenceClient.post`] method gives you the flexibility to send any request to the Inference API. For example, you can specify how to parse the inputs and outputs. In the example below, the generated image is returned as raw bytes ins...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#custom-requests
#custom-requests
.md
24_8
An async version of the client is also provided, based on `asyncio` and `aiohttp`. You can either install `aiohttp` directly or use the `[inference]` extra: ```sh pip install --upgrade huggingface_hub[inference] # or # pip install aiohttp ``` After installation all async API endpoints are available via [`AsyncInfer...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#async-client
#async-client
.md
24_9
In the above section, we saw the main aspects of [`InferenceClient`]. Let's dive into some more advanced tips.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#advanced-tips
#advanced-tips
.md
24_10
When doing inference, there are two main causes for a timeout: - The inference process takes a long time to complete. - The model is not available, for example when Inference API is loading it for the first time. [`InferenceClient`] has a global `timeout` parameter to handle those two aspects. By default, it is set t...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#timeout
#timeout
.md
24_11
Some tasks require binary inputs, for example, when dealing with images or audio files. In this case, [`InferenceClient`] tries to be as permissive as possible and accept different types: - raw `bytes` - a file-like object, opened as binary (`with open("audio.flac", "rb") as f: ...`) - a path (`str` or `Path`) pointing...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#binary-inputs
#binary-inputs
.md
24_12
[`InferenceClient`] acts as a replacement for the legacy [`InferenceApi`] client. It adds specific support for tasks and handles inference on both [Inference API](https://huggingface.co/docs/api-inference/index) and [Inference Endpoints](https://huggingface.co/docs/inference-endpoints/index). Here is a short guide to...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#legacy-inferenceapi-client
#legacy-inferenceapi-client
.md
24_13
Change from ```python >>> from huggingface_hub import InferenceApi >>> inference = InferenceApi(repo_id="bert-base-uncased", token=API_TOKEN) ``` to ```python >>> from huggingface_hub import InferenceClient >>> inference = InferenceClient(model="bert-base-uncased", token=API_TOKEN) ```
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#initialization
#initialization
.md
24_14
Change from ```python >>> from huggingface_hub import InferenceApi >>> inference = InferenceApi(repo_id="paraphrase-xlm-r-multilingual-v1", task="feature-extraction") >>> inference(...) ``` to ```python >>> from huggingface_hub import InferenceClient >>> inference = InferenceClient() >>> inference.feature_extract...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#run-on-a-specific-task
#run-on-a-specific-task
.md
24_15
Change from ```python >>> from huggingface_hub import InferenceApi >>> inference = InferenceApi(repo_id="bert-base-uncased") >>> inference(inputs="The goal of life is [MASK].") [{'sequence': 'the goal of life is life.', 'score': 0.10933292657136917, 'token': 2166, 'token_str': 'life'}] ``` to ```python >>> from h...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#run-custom-request
#run-custom-request
.md
24_16
Change from ```python >>> from huggingface_hub import InferenceApi >>> inference = InferenceApi(repo_id="typeform/distilbert-base-uncased-mnli") >>> inputs = "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!" >>> params = {"candidate_labels":["re...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/inference.md
https://huggingface.co/docs/huggingface_hub/en/guides/inference/#run-with-parameters
#run-with-parameters
.md
24_17
<!--⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. -->
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/search.md
https://huggingface.co/docs/huggingface_hub/en/guides/search/
.md
25_0
In this tutorial, you will learn how to search models, datasets and spaces on the Hub using `huggingface_hub`.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/search.md
https://huggingface.co/docs/huggingface_hub/en/guides/search/#search-the-hub
#search-the-hub
.md
25_1
`huggingface_hub` library includes an HTTP client [`HfApi`] to interact with the Hub. Among other things, it can list models, datasets and spaces stored on the Hub: ```py >>> from huggingface_hub import HfApi >>> api = HfApi() >>> models = api.list_models() ``` The output of [`list_models`] is an iterator over the ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/search.md
https://huggingface.co/docs/huggingface_hub/en/guides/search/#how-to-list-repositories-
#how-to-list-repositories-
.md
25_2
Listing repositories is great but now you might want to filter your search. The list helpers have several attributes like: - `filter` - `author` - `search` - ... Let's see an example to get all models on the Hub that does image classification, have been trained on the imagenet dataset and that runs with PyTorch. ``...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/search.md
https://huggingface.co/docs/huggingface_hub/en/guides/search/#how-to-filter-repositories-
#how-to-filter-repositories-
.md
25_3
<!--⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. -->
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/overview.md
https://huggingface.co/docs/huggingface_hub/en/guides/overview/
.md
26_0
In this section, you will find practical guides to help you achieve a specific goal. Take a look at these guides to learn how to use huggingface_hub to solve real-world problems: <div class="mt-10"> <div class="w-full flex flex-col space-y-4 md:space-y-0 md:grid md:grid-cols-3 md:gap-y-4 md:gap-x-5"> <a class="!no-...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/overview.md
https://huggingface.co/docs/huggingface_hub/en/guides/overview/#how-to-guides
#how-to-guides
.md
26_1
<!--⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. -->
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/
.md
27_0
A collection is a group of related items on the Hub (models, datasets, Spaces, papers) that are organized together on the same page. Collections are useful for creating your own portfolio, bookmarking content in categories, or presenting a curated list of items you want to share. Check out this [guide](https://huggingf...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#collections
#collections
.md
27_1
Use [`get_collection`] to fetch your collections or any public ones. You must have the collection's *slug* to retrieve a collection. A slug is an identifier for a collection based on the title and a unique ID. You can find the slug in the URL of the collection page. <div class="flex justify-center"> <img src="https:/...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#fetch-a-collection
#fetch-a-collection
.md
27_2
We can also retrieve collections using [`list_collections`]. Collections can be filtered using some parameters. Let's list all the collections from the user [`teknium`](https://huggingface.co/teknium). ```py >>> from huggingface_hub import list_collections >>> collections = list_collections(owner="teknium") ``` This...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#list-collections
#list-collections
.md
27_3
Now that we know how to get a [`Collection`], let's create our own! Use [`create_collection`] with a title and description. To create a collection on an organization page, pass `namespace="my-cool-org"` when creating the collection. Finally, you can also create private collections by passing `private=True`. ```py >>>...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#create-a-new-collection
#create-a-new-collection
.md
27_4
Now that we have a [`Collection`], we want to add items to it and organize them.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#manage-items-in-a-collection
#manage-items-in-a-collection
.md
27_5
Items have to be added one by one using [`add_collection_item`]. You only need to know the `collection_slug`, `item_id` and `item_type`. Optionally, you can also add a `note` to the item (500 characters maximum). ```py >>> from huggingface_hub import create_collection, add_collection_item >>> collection = create_col...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#add-items
#add-items
.md
27_6
You can modify an existing item to add or modify the note attached to it using [`update_collection_item`]. Let's reuse the example above: ```py >>> from huggingface_hub import get_collection, update_collection_item # Fetch collection with newly added items >>> collection_slug = "osanseviero/os-week-highlights-sept-1...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#add-a-note-to-an-existing-item
#add-a-note-to-an-existing-item
.md
27_7
Items in a collection are ordered. The order is determined by the `position` attribute of each item. By default, items are ordered by appending new items at the end of the collection. You can update the order using [`update_collection_item`] the same way you would add a note. Let's reuse our example above: ```py >>...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#reorder-items
#reorder-items
.md
27_8
Finally, you can also remove an item using [`delete_collection_item`]. ```py >>> from huggingface_hub import get_collection, update_collection_item # Fetch collection >>> collection_slug = "osanseviero/os-week-highlights-sept-18-24-650bfed7f795a59f491afb80" >>> collection = get_collection(collection_slug) # Remove ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#remove-items
#remove-items
.md
27_9
A collection can be deleted using [`delete_collection`]. <Tip warning={true}> This is a non-revertible action. A deleted collection cannot be restored. </Tip> ```py >>> from huggingface_hub import delete_collection >>> collection = delete_collection("username/useless-collection-64f9a55bb3115b4f513ec026", missin...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/collections.md
https://huggingface.co/docs/huggingface_hub/en/guides/collections/#delete-collection
#delete-collection
.md
27_10
<!--⚠️ Note that this file is in Markdown but contains specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. -->
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/cli.md
https://huggingface.co/docs/huggingface_hub/en/guides/cli/
.md
28_0
The `huggingface_hub` Python package comes with a built-in CLI called `huggingface-cli`. This tool allows you to interact with the Hugging Face Hub directly from a terminal. For example, you can login to your account, create a repository, upload and download files, etc. It also comes with handy features to configure yo...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/cli.md
https://huggingface.co/docs/huggingface_hub/en/guides/cli/#command-line-interface-cli
#command-line-interface-cli
.md
28_1
First of all, let's install the CLI: ``` >>> pip install -U "huggingface_hub[cli]" ``` <Tip> In the snippet above, we also installed the `[cli]` extra dependencies to make the user experience better, especially when using the `delete-cache` command. </Tip> Once installed, you can check that the CLI is correct...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/cli.md
https://huggingface.co/docs/huggingface_hub/en/guides/cli/#getting-started
#getting-started
.md
28_2
[Pkgx](https://pkgx.sh) is a blazingly fast cross platform package manager that runs anything. You can install huggingface-cli using pkgx as follows: ```bash >>> pkgx install huggingface-cli ``` Or you can run huggingface-cli directly: ```bash >>> pkgx huggingface-cli --help ``` Check out the pkgx huggingface ...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/cli.md
https://huggingface.co/docs/huggingface_hub/en/guides/cli/#using-pkgx
#using-pkgx
.md
28_3
You can also install the CLI using [Homebrew](https://brew.sh/): ```bash >>> brew install huggingface-cli ``` Check out the Homebrew huggingface page [here](https://formulae.brew.sh/formula/huggingface-cli) for more details.
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/cli.md
https://huggingface.co/docs/huggingface_hub/en/guides/cli/#using-homebrew
#using-homebrew
.md
28_4
In many cases, you must be logged in to a Hugging Face account to interact with the Hub (download private repos, upload files, create PRs, etc.). To do so, you need a [User Access Token](https://huggingface.co/docs/hub/security-tokens) from your [Settings page](https://huggingface.co/settings/tokens). The User Access T...
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/guides/cli.md
https://huggingface.co/docs/huggingface_hub/en/guides/cli/#huggingface-cli-login
#huggingface-cli-login
.md
28_5