source
stringclasses 40
values | file_type
stringclasses 1
value | chunk
stringlengths 3
512
| chunk_id
stringlengths 5
8
|
---|---|---|---|
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | <!--⚠️ 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.
--> | 0_0_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | The [Hugging Face Hub](https://huggingface.co/) is the go-to place for sharing machine learning
models, demos, datasets, and metrics. `huggingface_hub` library helps you interact with
the Hub without leaving your development environment. You can create and manage
repositories easily, download and upload files, and get useful model and dataset
metadata from the Hub. | 0_1_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | To get started, install the `huggingface_hub` library:
```bash
pip install --upgrade huggingface_hub
```
For more details, check out the [installation](installation) guide. | 0_2_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | Repositories on the Hub are git version controlled, and users can download a single file
or the whole repository. You can use the [`hf_hub_download`] function to download files.
This function will download and cache a file on your local disk. The next time you need
that file, it will load from your cache, so you don't need to re-download it.
You will need the repository id and the filename of the file you want to download. For | 0_3_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | You will need the repository id and the filename of the file you want to download. For
example, to download the [Pegasus](https://huggingface.co/google/pegasus-xsum) model
configuration file:
```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download(repo_id="google/pegasus-xsum", filename="config.json")
```
To download a specific version of the file, use the `revision` parameter to specify the
branch name, tag, or commit hash. If you choose to use the commit hash, it must be the | 0_3_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | branch name, tag, or commit hash. If you choose to use the commit hash, it must be the
full-length hash instead of the shorter 7-character commit hash:
```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download(
... repo_id="google/pegasus-xsum",
... filename="config.json",
... revision="4d33b01d79672f27f001f6abade33f22d993b151"
... )
```
For more details and options, see the API reference for [`hf_hub_download`].
<a id="login"></a> <!-- backward compatible anchor --> | 0_3_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | In a lot of cases, you must be authenticated with a Hugging Face account to interact with
the Hub: download private repos, upload files, create PRs,...
[Create an account](https://huggingface.co/join) if you don't already have one, and then sign in
to get your [User Access Token](https://huggingface.co/docs/hub/security-tokens) from
your [Settings page](https://huggingface.co/settings/tokens). The User Access Token is
used to authenticate your identity to the Hub.
<Tip> | 0_4_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | used to authenticate your identity to the Hub.
<Tip>
Tokens can have `read` or `write` permissions. Make sure to have a `write` access token if you want to create or edit a repository. Otherwise, it's best to generate a `read` token to reduce risk in case your token is inadvertently leaked.
</Tip> | 0_4_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | The easiest way to authenticate is to save the token on your machine. You can do that from the terminal using the [`login`] command:
```bash
huggingface-cli login
```
The command will tell you if you are already logged in and prompt you for your token. The token is then validated and saved in your `HF_HOME` directory (defaults to `~/.cache/huggingface/token`). Any script or library interacting with the Hub will use this token when sending requests. | 0_5_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | Alternatively, you can programmatically login using [`login`] in a notebook or a script:
```py
>>> from huggingface_hub import login
>>> login()
```
You can only be logged in to one account at a time. Logging in to a new account will automatically log you out of the previous one. To determine your currently active account, simply run the `huggingface-cli whoami` command.
<Tip warning={true}> | 0_5_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | <Tip warning={true}>
Once logged in, all requests to the Hub - even methods that don't necessarily require authentication - will use your access token by default. If you want to disable the implicit use of your token, you should set `HF_HUB_DISABLE_IMPLICIT_TOKEN=1` as an environment variable (see [reference](../package_reference/environment_variables#hfhubdisableimplicittoken)).
</Tip> | 0_5_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | You can save multiple tokens on your machine by simply logging in with the [`login`] command with each token. If you need to switch between these tokens locally, you can use the [`auth switch`] command:
```bash
huggingface-cli auth switch
```
This command will prompt you to select a token by its name from a list of saved tokens. Once selected, the chosen token becomes the _active_ token, and it will be used for all interactions with the Hub. | 0_6_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | You can list all available access tokens on your machine with `huggingface-cli auth list`. | 0_6_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | The environment variable `HF_TOKEN` can also be used to authenticate yourself. This is especially useful in a Space where you can set `HF_TOKEN` as a [Space secret](https://huggingface.co/docs/hub/spaces-overview#managing-secrets).
<Tip>
**NEW:** Google Colaboratory lets you define [private keys](https://twitter.com/GoogleColab/status/1719798406195867814) for your notebooks. Define a `HF_TOKEN` secret to be automatically authenticated!
</Tip> | 0_7_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | </Tip>
Authentication via an environment variable or a secret has priority over the token stored on your machine. | 0_7_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | Finally, it is also possible to authenticate by passing your token to any method that accepts `token` as a parameter.
```
from huggingface_hub import whoami | 0_8_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | user = whoami(token=...)
```
This is usually discouraged except in an environment where you don't want to store your token permanently or if you need to handle several tokens at once.
<Tip warning={true}>
Please be careful when passing tokens as a parameter. It is always best practice to load the token from a secure vault instead of hardcoding it in your codebase or notebook. Hardcoded tokens present a major leak risk if you share your code inadvertently.
</Tip> | 0_8_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | Once you've registered and logged in, create a repository with the [`create_repo`]
function:
```py
>>> from huggingface_hub import HfApi
>>> api = HfApi()
>>> api.create_repo(repo_id="super-cool-model")
```
If you want your repository to be private, then:
```py
>>> from huggingface_hub import HfApi
>>> api = HfApi()
>>> api.create_repo(repo_id="super-cool-model", private=True)
```
Private repositories will not be visible to anyone except yourself.
<Tip> | 0_9_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | ```
Private repositories will not be visible to anyone except yourself.
<Tip>
To create a repository or to push content to the Hub, you must provide a User Access
Token that has the `write` permission. You can choose the permission when creating the
token in your [Settings page](https://huggingface.co/settings/tokens).
</Tip> | 0_9_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | Use the [`upload_file`] function to add a file to your newly created repository. You
need to specify:
1. The path of the file to upload.
2. The path of the file in the repository.
3. The repository id of where you want to add the file.
```py
>>> from huggingface_hub import HfApi
>>> api = HfApi()
>>> api.upload_file(
... path_or_fileobj="/home/lysandre/dummy-test/README.md",
... path_in_repo="README.md",
... repo_id="lysandre/test-model",
... )
``` | 0_10_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | ... path_in_repo="README.md",
... repo_id="lysandre/test-model",
... )
```
To upload more than one file at a time, take a look at the [Upload](./guides/upload) guide
which will introduce you to several methods for uploading files (with or without git). | 0_10_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | The `huggingface_hub` library provides an easy way for users to interact with the Hub
with Python. To learn more about how you can manage your files and repositories on the
Hub, we recommend reading our [how-to guides](./guides/overview) to:
- [Manage your repository](./guides/repository).
- [Download](./guides/download) files from the Hub.
- [Upload](./guides/upload) files to the Hub.
- [Search the Hub](./guides/search) for your desired model or dataset. | 0_11_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | .md | - [Upload](./guides/upload) files to the Hub.
- [Search the Hub](./guides/search) for your desired model or dataset.
- [Access the Inference API](./guides/inference) for fast inference. | 0_11_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | <!--⚠️ 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.
--> | 1_0_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | The `huggingface_hub` library allows you to interact with the [Hugging Face
Hub](https://hf.co), a machine learning platform for creators and collaborators.
Discover pre-trained models and datasets for your projects or play with the hundreds of
machine learning apps hosted on the Hub. You can also create and share your own models
and datasets with the community. The `huggingface_hub` library provides a simple way to
do all these things with Python. | 1_1_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | and datasets with the community. The `huggingface_hub` library provides a simple way to
do all these things with Python.
Read the [quick start guide](quick-start) to get up and running with the
`huggingface_hub` library. You will learn how to download files from the Hub, create a
repository, and upload files to the Hub. Keep reading to learn more about how to manage
your repositories on the 🤗 Hub, how to interact in discussions or even how to access
the Inference API.
<div class="mt-10"> | 1_1_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | your repositories on the 🤗 Hub, how to interact in discussions or even how to access
the Inference API.
<div class="mt-10">
<div class="w-full flex flex-col space-y-4 md:space-y-0 md:grid md:grid-cols-2 md:gap-y-4 md:gap-x-5">
<a class="!no-underline border dark:border-gray-700 p-5 rounded-lg shadow hover:shadow-lg" href="./guides/overview"> | 1_1_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | <a class="!no-underline border dark:border-gray-700 p-5 rounded-lg shadow hover:shadow-lg" href="./guides/overview">
<div class="w-full text-center bg-gradient-to-br from-indigo-400 to-indigo-500 rounded-lg py-1.5 font-semibold mb-5 text-white text-lg leading-relaxed">How-to guides</div>
<p class="text-gray-700">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.</p>
</a> | 1_1_3 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | </a>
<a class="!no-underline border dark:border-gray-700 p-5 rounded-lg shadow hover:shadow-lg" href="./package_reference/overview">
<div class="w-full text-center bg-gradient-to-br from-purple-400 to-purple-500 rounded-lg py-1.5 font-semibold mb-5 text-white text-lg leading-relaxed">Reference</div>
<p class="text-gray-700">Exhaustive and technical description of huggingface_hub classes and methods.</p>
</a> | 1_1_4 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | <p class="text-gray-700">Exhaustive and technical description of huggingface_hub classes and methods.</p>
</a>
<a class="!no-underline border dark:border-gray-700 p-5 rounded-lg shadow hover:shadow-lg" href="./concepts/git_vs_http">
<div class="w-full text-center bg-gradient-to-br from-pink-400 to-pink-500 rounded-lg py-1.5 font-semibold mb-5 text-white text-lg leading-relaxed">Conceptual guides</div> | 1_1_5 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | <p class="text-gray-700">High-level explanations for building a better understanding of huggingface_hub philosophy.</p>
</a>
</div>
</div>
<!--
<a class="!no-underline border dark:border-gray-700 p-5 rounded-lg shadow hover:shadow-lg" href="./tutorials/overview"
><div class="w-full text-center bg-gradient-to-br from-blue-400 to-blue-500 rounded-lg py-1.5 font-semibold mb-5 text-white text-lg leading-relaxed">Tutorials</div> | 1_1_6 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | <p class="text-gray-700">Learn the basics and become familiar with using huggingface_hub to programmatically interact with the 🤗 Hub!</p>
</a> --> | 1_1_7 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | All contributions to the `huggingface_hub` are welcomed and equally valued! 🤗 Besides
adding or fixing existing issues in the code, you can also help improve the
documentation by making sure it is accurate and up-to-date, help answer questions on
issues, and request new features you think will improve the library. Take a look at the
[contribution
guide](https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md) to | 1_2_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | .md | [contribution
guide](https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md) to
learn more about how to submit a new issue or feature request, how to submit a pull
request, and how to test your contributions to make sure everything works as expected.
Contributors should also be respectful of our [code of
conduct](https://github.com/huggingface/huggingface_hub/blob/main/CODE_OF_CONDUCT.md) to
create an inclusive and welcoming collaborative space for everyone. | 1_2_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | <!--⚠️ 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.
--> | 2_0_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | Before you start, you will need to setup your environment by installing the appropriate packages.
`huggingface_hub` is tested on **Python 3.8+**. | 2_1_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | It is highly recommended to install `huggingface_hub` in a [virtual environment](https://docs.python.org/3/library/venv.html).
If you are unfamiliar with Python virtual environments, take a look at this [guide](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/).
A virtual environment makes it easier to manage different projects, and avoid compatibility issues between dependencies.
Start by creating a virtual environment in your project directory:
```bash | 2_2_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | Start by creating a virtual environment in your project directory:
```bash
python -m venv .env
```
Activate the virtual environment. On Linux and macOS:
```bash
source .env/bin/activate
```
Activate virtual environment on Windows:
```bash
.env/Scripts/activate
```
Now you're ready to install `huggingface_hub` [from the PyPi registry](https://pypi.org/project/huggingface-hub/):
```bash
pip install --upgrade huggingface_hub
``` | 2_2_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | ```bash
pip install --upgrade huggingface_hub
```
Once done, [check installation](#check-installation) is working correctly. | 2_2_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | Some dependencies of `huggingface_hub` are [optional](https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies) because they are not required to run the core features of `huggingface_hub`. However, some features of the `huggingface_hub` may not be available if the optional dependencies aren't installed.
You can install optional dependencies via `pip`:
```bash
# Install dependencies for tensorflow-specific features | 2_3_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | You can install optional dependencies via `pip`:
```bash
# Install dependencies for tensorflow-specific features
# /!\ Warning: this is not equivalent to `pip install tensorflow`
pip install 'huggingface_hub[tensorflow]' | 2_3_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | # Install dependencies for both torch-specific and CLI-specific features.
pip install 'huggingface_hub[cli,torch]'
```
Here is the list of optional dependencies in `huggingface_hub`:
- `cli`: provide a more convenient CLI interface for `huggingface_hub`.
- `fastai`, `torch`, `tensorflow`: dependencies to run framework-specific features.
- `dev`: dependencies to contribute to the lib. Includes `testing` (to run tests), `typing` (to run type checker) and `quality` (to run linters). | 2_3_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | In some cases, it is interesting to install `huggingface_hub` directly from source.
This allows you to use the bleeding edge `main` version rather than the latest stable version.
The `main` version is useful for staying up-to-date with the latest developments, for instance
if a bug has been fixed since the last official release but a new release hasn't been rolled out yet.
However, this means the `main` version may not always be stable. We strive to keep the | 2_4_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | However, this means the `main` version may not always be stable. We strive to keep the
`main` version operational, and most issues are usually resolved
within a few hours or a day. If you run into a problem, please open an Issue so we can
fix it even sooner!
```bash
pip install git+https://github.com/huggingface/huggingface_hub
```
When installing from source, you can also specify a specific branch. This is useful if you
want to test a new feature or a new bug-fix that has not been merged yet: | 2_4_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | want to test a new feature or a new bug-fix that has not been merged yet:
```bash
pip install git+https://github.com/huggingface/huggingface_hub@my-feature-branch
```
Once done, [check installation](#check-installation) is working correctly. | 2_4_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | Installing from source allows you to setup an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs).
This is a more advanced installation if you plan to contribute to `huggingface_hub`
and need to test changes in the code. You need to clone a local copy of `huggingface_hub`
on your machine.
```bash
# First, clone repo locally
git clone https://github.com/huggingface/huggingface_hub.git | 2_5_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | # Then, install with -e flag
cd huggingface_hub
pip install -e .
```
These commands will link the folder you cloned the repository to and your Python library paths.
Python will now look inside the folder you cloned to in addition to the normal library paths.
For example, if your Python packages are typically installed in `./.venv/lib/python3.13/site-packages/`,
Python will also search the folder you cloned `./huggingface_hub/`. | 2_5_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | If you are more familiar with it, you can install `huggingface_hub` using the [conda-forge channel](https://anaconda.org/conda-forge/huggingface_hub):
```bash
conda install -c conda-forge huggingface_hub
```
Once done, [check installation](#check-installation) is working correctly. | 2_6_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | Once installed, check that `huggingface_hub` works properly by running the following command:
```bash
python -c "from huggingface_hub import model_info; print(model_info('gpt2'))"
```
This command will fetch information from the Hub about the [gpt2](https://huggingface.co/gpt2) model.
Output should look like this:
```text
Model Name: gpt2 | 2_7_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | Output should look like this:
```text
Model Name: gpt2
Tags: ['pytorch', 'tf', 'jax', 'tflite', 'rust', 'safetensors', 'gpt2', 'text-generation', 'en', 'doi:10.57967/hf/0039', 'transformers', 'exbert', 'license:mit', 'has_space']
Task: text-generation
``` | 2_7_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | With our goal of democratizing good ML everywhere, we built `huggingface_hub` to be a
cross-platform library and in particular to work correctly on both Unix-based and Windows
systems. However, there are a few cases where `huggingface_hub` has some limitations when
run on Windows. Here is an exhaustive list of known issues. Please let us know if you
encounter any undocumented problem by opening [an issue on Github](https://github.com/huggingface/huggingface_hub/issues/new/choose). | 2_8_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | - `huggingface_hub`'s cache system relies on symlinks to efficiently cache files downloaded
from the Hub. On Windows, you must activate developer mode or run your script as admin to
enable symlinks. If they are not activated, the cache-system still works but in a non-optimized
manner. Please read [the cache limitations](./guides/manage-cache#limitations) section for more details.
- Filepaths on the Hub can have special characters (e.g. `"path/to?/my/file"`). Windows is | 2_8_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | - Filepaths on the Hub can have special characters (e.g. `"path/to?/my/file"`). Windows is
more restrictive on [special characters](https://learn.microsoft.com/en-us/windows/win32/intl/character-sets-used-in-file-names)
which makes it impossible to download those files on Windows. Hopefully this is a rare case.
Please reach out to the repo owner if you think this is a mistake or to us to figure out
a solution. | 2_8_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | .md | Once `huggingface_hub` is properly installed on your machine, you might want
[configure environment variables](package_reference/environment_variables) or [check one of our guides](guides/overview) to get started. | 2_9_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | <!--⚠️ 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.
--> | 3_0_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | The `huggingface_hub` library allows users to programmatically manage authentication to the Hub. This includes logging in, logging out, switching between tokens, and listing available tokens.
For more details about authentication, check out [this section](../quick-start#authentication). | 3_1_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | ```python
Login the machine to access the Hub.
The `token` is persisted in cache and set as a git credential. Once done, the machine
is logged in and the access token will be available across all `huggingface_hub`
components. If `token` is not provided, it will be prompted to the user either with
a widget (in a notebook) or via the terminal.
To log in from outside of a script, one can also use `huggingface-cli login` which is
a cli command that wraps [`login`].
<Tip> | 3_2_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | <Tip>
[`login`] is a drop-in replacement method for [`notebook_login`] as it wraps and
extends its capabilities.
</Tip>
<Tip>
When the token is not passed, [`login`] will automatically detect if the script runs
in a notebook or not. However, this detection might not be accurate due to the
variety of notebooks that exists nowadays. If that is the case, you can always force
the UI by using [`notebook_login`] or [`interpreter_login`].
</Tip> | 3_2_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | Args:
token (`str`, *optional*):
User access token to generate from https://huggingface.co/settings/token.
add_to_git_credential (`bool`, defaults to `False`):
If `True`, token will be set as git credential. If no git credential helper
is configured, a warning will be displayed to the user. If `token` is `None`,
the value of `add_to_git_credential` is ignored and will be prompted again
to the end user.
new_session (`bool`, defaults to `True`): | 3_2_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | to the end user.
new_session (`bool`, defaults to `True`):
If `True`, will request a token even if one is already saved on the machine.
write_permission (`bool`):
Ignored and deprecated argument.
Raises:
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
If an organization token is passed. Only personal account tokens are valid
to log in.
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
If token is invalid. | 3_2_3 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | to log in.
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
If token is invalid.
[`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError)
If running in a notebook but `ipywidgets` is not installed.
``` | 3_2_4 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | ```python
Displays a prompt to log in to the HF website and store the token.
This is equivalent to [`login`] without passing a token when not run in a notebook.
[`interpreter_login`] is useful if you want to force the use of the terminal prompt
instead of a notebook widget.
For more details, see [`login`].
Args:
new_session (`bool`, defaults to `True`):
If `True`, will request a token even if one is already saved on the machine.
write_permission (`bool`):
Ignored and deprecated argument.
``` | 3_3_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | ```python
Displays a widget to log in to the HF website and store the token.
This is equivalent to [`login`] without passing a token when run in a notebook.
[`notebook_login`] is useful if you want to force the use of the notebook widget
instead of a prompt in the terminal.
For more details, see [`login`].
Args:
new_session (`bool`, defaults to `True`):
If `True`, will request a token even if one is already saved on the machine.
write_permission (`bool`):
Ignored and deprecated argument.
``` | 3_4_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | ```python
Logout the machine from the Hub.
Token is deleted from the machine and removed from git credential.
Args:
token_name (`str`, *optional*):
Name of the access token to logout from. If `None`, will logout from all saved access tokens.
Raises:
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError):
If the access token name is not found.
``` | 3_5_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | ```python
Switch to a different access token.
Args:
token_name (`str`):
Name of the access token to switch to.
add_to_git_credential (`bool`, defaults to `False`):
If `True`, token will be set as git credential. If no git credential helper
is configured, a warning will be displayed to the user. If `token` is `None`,
the value of `add_to_git_credential` is ignored and will be prompted again
to the end user. | 3_6_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | Raises:
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError):
If the access token name is not found.
``` | 3_6_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | .md | ```python
List all stored access tokens.
``` | 3_7_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | Inference Endpoints provides a secure production solution to easily deploy 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). This page is a reference for `huggingface_hub`'s integration with Inference Endpoints. For more information about the Inference Endpoints product, check out its [official documentation](https://huggingface.co/docs/inference-endpoints/index).
<Tip> | 4_0_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | <Tip>
Check out the [related guide](../guides/inference_endpoints) to learn how to use `huggingface_hub` to manage your Inference Endpoints programmatically.
</Tip>
Inference Endpoints can be fully managed via API. The endpoints are documented with [Swagger](https://api.endpoints.huggingface.cloud/). The [`InferenceEndpoint`] class is a simple wrapper built on top on this API. | 4_0_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | A subset of the Inference Endpoint features are implemented in [`HfApi`]:
- [`get_inference_endpoint`] and [`list_inference_endpoints`] to get information about your Inference Endpoints
- [`create_inference_endpoint`], [`update_inference_endpoint`] and [`delete_inference_endpoint`] to deploy and manage Inference Endpoints
- [`pause_inference_endpoint`] and [`resume_inference_endpoint`] to pause and resume an Inference Endpoint | 4_1_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | - [`pause_inference_endpoint`] and [`resume_inference_endpoint`] to pause and resume an Inference Endpoint
- [`scale_to_zero_inference_endpoint`] to manually scale an Endpoint to 0 replicas | 4_1_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | The main dataclass is [`InferenceEndpoint`]. It contains information about a deployed `InferenceEndpoint`, including its configuration and current state. Once deployed, you can run inference on the Endpoint using the [`InferenceEndpoint.client`] and [`InferenceEndpoint.async_client`] properties that respectively return an [`InferenceClient`] and an [`AsyncInferenceClient`] object. | 4_2_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | ```python
Contains information about a deployed Inference Endpoint. | 4_3_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | Args:
name (`str`):
The unique name of the Inference Endpoint.
namespace (`str`):
The namespace where the Inference Endpoint is located.
repository (`str`):
The name of the model repository deployed on this Inference Endpoint.
status ([`InferenceEndpointStatus`]):
The current status of the Inference Endpoint.
url (`str`, *optional*):
The URL of the Inference Endpoint, if available. Only a deployed Inference Endpoint will have a URL.
framework (`str`):
The machine learning framework used for the model. | 4_3_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | framework (`str`):
The machine learning framework used for the model.
revision (`str`):
The specific model revision deployed on the Inference Endpoint.
task (`str`):
The task associated with the deployed model.
created_at (`datetime.datetime`):
The timestamp when the Inference Endpoint was created.
updated_at (`datetime.datetime`):
The timestamp of the last update of the Inference Endpoint.
type ([`InferenceEndpointType`]):
The type of the Inference Endpoint (public, protected, private).
raw (`Dict`): | 4_3_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | type ([`InferenceEndpointType`]):
The type of the Inference Endpoint (public, protected, private).
raw (`Dict`):
The raw dictionary data returned from the API.
token (`str` or `bool`, *optional*):
Authentication token for the Inference Endpoint, if set when requesting the API. Will default to the
locally saved token if not provided. Pass `token=False` if you don't want to send your token to the server. | 4_3_3 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | Example:
```python
>>> from huggingface_hub import get_inference_endpoint
>>> endpoint = get_inference_endpoint("my-text-to-image")
>>> endpoint
InferenceEndpoint(name='my-text-to-image', ...) | 4_3_4 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | >>> endpoint.status
'running'
>>> endpoint.url
'https://my-text-to-image.region.vendor.endpoints.huggingface.cloud' | 4_4_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | >>> endpoint.client.text_to_image(...) | 4_5_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | >>> endpoint.pause() | 4_6_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | >>> endpoint.resume()
>>> endpoint.wait()
>>> endpoint.client.text_to_image(...)
```
```
- from_raw
- client
- async_client
- all | 4_7_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | ```python
An enumeration.
``` | 4_8_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | ```python
An enumeration.
``` | 4_9_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | .md | ```python
Generic exception when dealing with Inference Endpoints.
``` | 4_10_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | <!--⚠️ 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.
--> | 5_0_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | Below is the documentation for the `HfApi` class, which serves as a Python wrapper for the Hugging Face Hub's API.
All methods from the `HfApi` are also accessible from the package's root directly. Both approaches are detailed below.
Using the root method is more straightforward but the [`HfApi`] class gives you more flexibility.
In particular, you can pass a token that will be reused in all HTTP calls. This is different | 5_1_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | In particular, you can pass a token that will be reused in all HTTP calls. This is different
than `huggingface-cli login` or [`login`] as the token is not persisted on the machine.
It is also possible to provide a different endpoint or configure a custom user-agent.
```python
from huggingface_hub import HfApi, list_models | 5_1_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | # Use root method
models = list_models()
# Or configure a HfApi client
hf_api = HfApi(
endpoint="https://huggingface.co", # Can be a Private Hub endpoint.
token="hf_xxx", # Token is not persisted on the machine.
)
models = hf_api.list_models()
``` | 5_1_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | ```python
Client to interact with the Hugging Face Hub via HTTP.
The client is initialized with some high-level settings used in all requests
made to the Hub (HF endpoint, authentication, user agents...). Using the `HfApi`
client is preferred but not mandatory as all of its public methods are exposed
directly at the root of `huggingface_hub`. | 5_2_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | Args:
endpoint (`str`, *optional*):
Endpoint of the Hub. Defaults to <https://huggingface.co>.
token (Union[bool, str, None], optional):
A valid user access token (string). Defaults to the locally saved
token, which is the recommended method for authentication (see
https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
To disable authentication, pass `False`.
library_name (`str`, *optional*):
The name of the library that is making the HTTP request. Will be added to | 5_2_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | library_name (`str`, *optional*):
The name of the library that is making the HTTP request. Will be added to
the user-agent header. Example: `"transformers"`.
library_version (`str`, *optional*):
The version of the library that is making the HTTP request. Will be added
to the user-agent header. Example: `"4.24.0"`.
user_agent (`str`, `dict`, *optional*):
The user agent info in the form of a dictionary or a single string. It will
be completed with information about the installed packages. | 5_2_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | be completed with information about the installed packages.
headers (`dict`, *optional*):
Additional headers to be sent with each request. Example: `{"X-My-Header": "value"}`.
Headers passed here are taking precedence over the default headers.
``` | 5_2_3 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | ```python
Data structure containing information about a user access request. | 5_3_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | Attributes:
username (`str`):
Username of the user who requested access.
fullname (`str`):
Fullname of the user who requested access.
email (`Optional[str]`):
Email of the user who requested access.
Can only be `None` in the /accepted list if the user was granted access manually.
timestamp (`datetime`):
Timestamp of the request.
status (`Literal["pending", "accepted", "rejected"]`):
Status of the request. Can be one of `["pending", "accepted", "rejected"]`.
fields (`Dict[str, Any]`, *optional*): | 5_3_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | Status of the request. Can be one of `["pending", "accepted", "rejected"]`.
fields (`Dict[str, Any]`, *optional*):
Additional fields filled by the user in the gate form.
``` | 5_3_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | ```python
Data structure containing information about a newly created commit.
Returned by any method that creates a commit on the Hub: [`create_commit`], [`upload_file`], [`upload_folder`],
[`delete_file`], [`delete_folder`]. It inherits from `str` for backward compatibility but using methods specific
to `str` is deprecated.
Attributes:
commit_url (`str`):
Url where to find the commit.
commit_message (`str`):
The summary (first line) of the commit that has been created. | 5_4_0 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | commit_message (`str`):
The summary (first line) of the commit that has been created.
commit_description (`str`):
Description of the commit that has been created. Can be empty.
oid (`str`):
Commit hash id. Example: `"91c54ad1727ee830252e457677f467be0bfd8a57"`.
pr_url (`str`, *optional*):
Url to the PR that has been created, if any. Populated when `create_pr=True`
is passed. | 5_4_1 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | pr_url (`str`, *optional*):
Url to the PR that has been created, if any. Populated when `create_pr=True`
is passed.
pr_revision (`str`, *optional*):
Revision of the PR that has been created, if any. Populated when
`create_pr=True` is passed. Example: `"refs/pr/1"`.
pr_num (`int`, *optional*):
Number of the PR discussion that has been created, if any. Populated when
`create_pr=True` is passed. Can be passed as `discussion_num` in
[`get_discussion_details`]. Example: `1`. | 5_4_2 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | repo_url (`RepoUrl`):
Repo URL of the commit containing info like repo_id, repo_type, etc.
_url (`str`, *optional*):
Legacy url for `str` compatibility. Can be the url to the uploaded file on the Hub (if returned by
[`upload_file`]), to the uploaded folder on the Hub (if returned by [`upload_folder`]) or to the commit on
the Hub (if returned by [`create_commit`]). Defaults to `commit_url`. It is deprecated to use this
attribute. Please use `commit_url` instead.
``` | 5_4_3 |
/Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | .md | ```python
Contains information about a dataset on the Hub.
<Tip>
Most attributes of this class are optional. This is because the data returned by the Hub depends on the query made.
In general, the more specific the query, the more information is returned. On the contrary, when listing datasets
using [`list_datasets`] only a subset of the attributes are returned.
</Tip> | 5_5_0 |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 8