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 |
|---|---|---|---|---|---|
<!--⚠️ 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/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/ | .md | 0_0 | |
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 ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#quickstart | #quickstart | .md | 0_1 |
To get started, install the `huggingface_hub` library:
```bash
pip install --upgrade huggingface_hub
```
For more details, check out the [installation](installation) guide. | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#installation | #installation | .md | 0_2 |
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 ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#download-files | #download-files | .md | 0_3 |
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/securit... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#authentication | #authentication | .md | 0_4 |
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` directo... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#login-command | #login-command | .md | 0_5 |
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... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#manage-multiple-tokens-locally | #manage-multiple-tokens-locally | .md | 0_6 |
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.co... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#environment-variable | #environment-variable | .md | 0_7 |
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
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 handl... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#method-parameters | #method-parameters | .md | 0_8 |
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 = HfAp... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#create-a-repository | #create-a-repository | .md | 0_9 |
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_fil... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#upload-files | #upload-files | .md | 0_10 |
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/downl... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/quick-start.md | https://huggingface.co/docs/huggingface_hub/en/quick-start/#next-steps | #next-steps | .md | 0_11 |
<!--⚠️ 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/index.md | https://huggingface.co/docs/huggingface_hub/en/index/ | .md | 1_0 | |
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... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | https://huggingface.co/docs/huggingface_hub/en/index/#-hub-client-library | #-hub-client-library | .md | 1_1 |
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. Tak... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/index.md | https://huggingface.co/docs/huggingface_hub/en/index/#contribute | #contribute | .md | 1_2 |
<!--⚠️ 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/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/ | .md | 2_0 | |
Before you start, you will need to setup your environment by installing the appropriate packages.
`huggingface_hub` is tested on **Python 3.8+**. | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#installation | #installation | .md | 2_1 |
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 envi... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#install-with-pip | #install-with-pip | .md | 2_2 |
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 depende... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#install-optional-dependencies | #install-optional-dependencies | .md | 2_3 |
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 officia... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#install-from-source | #install-from-source | .md | 2_4 |
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`
... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#editable-install | #editable-install | .md | 2_5 |
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. | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#install-with-conda | #install-with-conda | .md | 2_6 |
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: ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#check-installation | #check-installation | .md | 2_7 |
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 is... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#windows-limitations | #windows-limitations | .md | 2_8 |
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. | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/installation.md | https://huggingface.co/docs/huggingface_hub/en/installation/#next-steps | #next-steps | .md | 2_9 |
<!--⚠️ 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/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/ | .md | 3_0 | |
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). | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/#authentication | #authentication | .md | 3_1 |
```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 notebo... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/#login | #login | .md | 3_2 |
```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... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/#interpreterlogin | #interpreterlogin | .md | 3_3 |
```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... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/#notebooklogin | #notebooklogin | .md | 3_4 |
```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#Val... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/#logout | #logout | .md | 3_5 |
```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`,
t... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/#authswitch | #authswitch | .md | 3_6 |
```python
List all stored access tokens.
``` | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/authentication.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/authentication/#authlist | #authlist | .md | 3_7 |
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 ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#inference-endpoints | #inference-endpoints | .md | 4_0 |
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 Endp... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#methods | #methods | .md | 4_1 |
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 retur... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#inferenceendpoint | #inferenceendpoint | .md | 4_2 |
```python
Contains information about a deployed Inference Endpoint.
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 ([`InferenceEndpo... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#inferenceendpoint | #inferenceendpoint | .md | 4_3 |
>>> endpoint.status
'running'
>>> endpoint.url
'https://my-text-to-image.region.vendor.endpoints.huggingface.cloud' | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#get-status | #get-status | .md | 4_4 |
>>> endpoint.client.text_to_image(...) | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#run-inference | #run-inference | .md | 4_5 |
>>> endpoint.pause() | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#pause-endpoint-to-save- | #pause-endpoint-to-save- | .md | 4_6 |
>>> endpoint.resume()
>>> endpoint.wait()
>>> endpoint.client.text_to_image(...)
```
```
- from_raw
- client
- async_client
- all | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#resume-and-wait-for-deployment | #resume-and-wait-for-deployment | .md | 4_7 |
```python
An enumeration.
``` | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#inferenceendpointstatus | #inferenceendpointstatus | .md | 4_8 |
```python
An enumeration.
``` | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#inferenceendpointtype | #inferenceendpointtype | .md | 4_9 |
```python
Generic exception when dealing with Inference Endpoints.
``` | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/inference_endpoints.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_endpoints/#inferenceendpointerror | #inferenceendpointerror | .md | 4_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/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/ | .md | 5_0 | |
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 mo... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#hfapi-client | #hfapi-client | .md | 5_1 |
```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 r... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#hfapi | #hfapi | .md | 5_2 |
```python
Data structure containing information about a user access request.
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... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapiaccessrequest | #huggingfacehubhfapiaccessrequest | .md | 5_3 |
```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 depr... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapicommitinfo | #huggingfacehubhfapicommitinfo | .md | 5_4 |
```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`]... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapidatasetinfo | #huggingfacehubhfapidatasetinfo | .md | 5_5 |
```python
Contains information about a git reference for a repo on the Hub.
Attributes:
name (`str`):
Name of the reference (e.g. tag name or branch name).
ref (`str`):
Full git ref on the Hub (e.g. `"refs/heads/main"` or `"refs/tags/v1.0"`).
target_commit (`str`):
OID of the target commit for the ref (e.g. `"e7da7f22... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapigitrefinfo | #huggingfacehubhfapigitrefinfo | .md | 5_6 |
```python
Contains information about a git commit for a repo on the Hub. Check out [`list_repo_commits`] for more details.
Attributes:
commit_id (`str`):
OID of the commit (e.g. `"e7da7f221d5bf496a48136c0cd264e630fe9fcc8"`)
authors (`List[str]`):
List of authors of the commit.
created_at (`datetime`):
Datetime when th... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapigitcommitinfo | #huggingfacehubhfapigitcommitinfo | .md | 5_7 |
```python
Contains information about all git references for a repo on the Hub.
Object is returned by [`list_repo_refs`].
Attributes:
branches (`List[GitRefInfo]`):
A list of [`GitRefInfo`] containing information about branches on the repo.
converts (`List[GitRefInfo]`):
A list of [`GitRefInfo`] containing information... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapigitrefs | #huggingfacehubhfapigitrefs | .md | 5_8 |
```python
Contains information about a model 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 models
using [`list_models`] only ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapimodelinfo | #huggingfacehubhfapimodelinfo | .md | 5_9 |
```python
Contains basic information about a repo file inside a repo on the Hub.
<Tip>
All attributes of this class are optional except `rfilename`. This is because only the file names are returned when
listing repositories on the Hub (with [`list_models`], [`list_datasets`] or [`list_spaces`]). If you need more
info... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapireposibling | #huggingfacehubhfapireposibling | .md | 5_10 |
```python
Contains information about a file on the Hub.
Attributes:
path (str):
file path relative to the repo root.
size (`int`):
The file's size, in bytes.
blob_id (`str`):
The file's git OID.
lfs (`BlobLfsInfo`):
The file's LFS metadata.
last_commit (`LastCommitInfo`, *optional*):
The file's last commit metadata. O... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapirepofile | #huggingfacehubhfapirepofile | .md | 5_11 |
```python
Subclass of `str` describing a repo URL on the Hub.
`RepoUrl` is returned by `HfApi.create_repo`. It inherits from `str` for backward
compatibility. At initialization, the URL is parsed to populate properties:
- endpoint (`str`)
- namespace (`Optional[str]`)
- repo_name (`str`)
- repo_id (`str`)
- repo_type ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapirepourl | #huggingfacehubhfapirepourl | .md | 5_12 |
```python
Metadata for a Safetensors repo.
A repo is considered to be a Safetensors repo if it contains either a 'model.safetensors' weight file (non-shared
model) or a 'model.safetensors.index.json' index file (sharded model) at its root.
This class is returned by [`get_safetensors_metadata`].
For more details rega... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubutilssafetensorsrepometadata | #huggingfacehubutilssafetensorsrepometadata | .md | 5_13 |
```python
Metadata for a Safetensors file hosted on the Hub.
This class is returned by [`parse_safetensors_file_metadata`].
For more details regarding the safetensors format, check out https://huggingface.co/docs/safetensors/index#format.
Attributes:
metadata (`Dict`):
The metadata contained in the file.
tensors (`D... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubutilssafetensorsfilemetadata | #huggingfacehubutilssafetensorsfilemetadata | .md | 5_14 |
```python
Contains information about a Space 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 spaces
using [`list_spaces`] only ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapispaceinfo | #huggingfacehubhfapispaceinfo | .md | 5_15 |
```python
Information about a tensor.
For more details regarding the safetensors format, check out https://huggingface.co/docs/safetensors/index#format.
Attributes:
dtype (`str`):
The data type of the tensor ("F64", "F32", "F16", "BF16", "I64", "I32", "I16", "I8", "U8", "BOOL").
shape (`List[int]`):
The shape of the ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubutilstensorinfo | #huggingfacehubutilstensorinfo | .md | 5_16 |
```python
Contains information about a user on the Hub.
Attributes:
username (`str`):
Name of the user on the Hub (unique).
fullname (`str`):
User's full name.
avatar_url (`str`):
URL of the user's avatar.
details (`str`, *optional*):
User's details.
is_following (`bool`, *optional*):
Whether the authenticated user is... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapiuser | #huggingfacehubhfapiuser | .md | 5_17 |
```python
Contains information about a user likes on the Hub.
Attributes:
user (`str`):
Name of the user for which we fetched the likes.
total (`int`):
Total number of likes.
datasets (`List[str]`):
List of datasets liked by the user (as repo_ids).
models (`List[str]`):
List of models liked by the user (as repo_ids).
... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapiuserlikes | #huggingfacehubhfapiuserlikes | .md | 5_18 |
```python
Data structure containing information about a webhook.
Attributes:
id (`str`):
ID of the webhook.
url (`str`):
URL of the webhook.
watched (`List[WebhookWatchedItem]`):
List of items watched by the webhook, see [`WebhookWatchedItem`].
domains (`List[WEBHOOK_DOMAIN_T]`):
List of domains the webhook is watchin... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapiwebhookinfo | #huggingfacehubhfapiwebhookinfo | .md | 5_19 |
```python
Data structure containing information about the items watched by a webhook.
Attributes:
type (`Literal["dataset", "model", "org", "space", "user"]`):
Type of the item to be watched. Can be one of `["dataset", "model", "org", "space", "user"]`.
name (`str`):
Name of the item to be watched. Can be the username... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#huggingfacehubhfapiwebhookwatcheditem | #huggingfacehubhfapiwebhookwatcheditem | .md | 5_20 |
Below are the supported values for [`CommitOperation`]: | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#commitoperation | #commitoperation | .md | 5_21 |
```python
Data structure holding necessary info to upload a file to a repository on the Hub.
Args:
path_in_repo (`str`):
Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"`
path_or_fileobj (`str`, `Path`, `bytes`, or `BinaryIO`):
Either:
- a path to a local file (as `str` or `pathlib.Path`)... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#commitoperationadd | #commitoperationadd | .md | 5_22 |
```python
Data structure holding necessary info to delete a file or a folder from a repository
on the Hub.
Args:
path_in_repo (`str`):
Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"`
for a file or `"checkpoints/1fec34a/"` for a folder.
is_folder (`bool` or `Literal["auto"]`, *optional*)... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#commitoperationdelete | #commitoperationdelete | .md | 5_23 |
```python
Data structure holding necessary info to copy a file in a repository on the Hub.
Limitations:
- Only LFS files can be copied. To copy a regular file, you need to download it locally and re-upload it
- Cross-repository copies are not supported.
Note: you can combine a [`CommitOperationCopy`] and a [`CommitOp... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#commitoperationcopy | #commitoperationcopy | .md | 5_24 |
```python
Scheduler to upload a local folder to the Hub at regular intervals (e.g. push to hub every 5 minutes).
The recommended way to use the scheduler is to use it as a context manager. This ensures that the scheduler is
properly stopped and the last commit is triggered when the script ends. The scheduler can also ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#commitscheduler | #commitscheduler | .md | 5_25 |
>>> csv_path = Path("watched_folder/data.csv")
>>> CommitScheduler(repo_id="test_scheduler", repo_type="dataset", folder_path=csv_path.parent, every=10)
>>> with csv_path.open("a") as f:
... f.write("first line") | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#scheduler-uploads-every-10-minutes | #scheduler-uploads-every-10-minutes | .md | 5_26 |
>>> with csv_path.open("a") as f:
... f.write("second line")
```
Example using a context manager:
```py
>>> from pathlib import Path
>>> from huggingface_hub import CommitScheduler
>>> with CommitScheduler(repo_id="test_scheduler", repo_type="dataset", folder_path="watched_folder", every=10) as scheduler:
... ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#some-time-later- | #some-time-later- | .md | 5_27 |
```
``` | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/hf_api.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/hf_api/#scheduler-is-now-stopped-and-last-commit-have-been-triggered | #scheduler-is-now-stopped-and-last-commit-have-been-triggered | .md | 5_28 |
<!--⚠️ 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/overview.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/overview/ | .md | 6_0 | |
This section contains an exhaustive and technical description of `huggingface_hub` classes and methods. | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/overview.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/overview/#overview | #overview | .md | 6_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/package_reference/collections.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/collections/ | .md | 7_0 | |
Check out the [`HfApi`] documentation page for the reference of methods to manage your Space on the Hub.
- Get collection content: [`get_collection`]
- Create new collection: [`create_collection`]
- Update a collection: [`update_collection_metadata`]
- Delete a collection: [`delete_collection`]
- Add an item to a col... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/collections.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/collections/#managing-collections | #managing-collections | .md | 7_1 |
```python
Contains information about a Collection on the Hub.
Attributes:
slug (`str`):
Slug of the collection. E.g. `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`.
title (`str`):
Title of the collection. E.g. `"Recent models"`.
owner (`str`):
Owner of the collection. E.g. `"TheBloke"`.
items (`List[CollectionIte... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/collections.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/collections/#collection | #collection | .md | 7_2 |
```python
Contains information about an item of a Collection (model, dataset, Space or paper).
Attributes:
item_object_id (`str`):
Unique ID of the item in the collection.
item_id (`str`):
ID of the underlying object on the Hub. Can be either a repo_id or a paper id
e.g. `"jbilcke-hf/ai-comic-factory"`, `"2307.09288"`... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/collections.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/collections/#collectionitem | #collectionitem | .md | 7_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/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/ | .md | 8_0 | |
Check the [`HfApi`] documentation page for the reference of methods enabling
interaction with Pull Requests and Discussions on the Hub.
- [`get_repo_discussions`]
- [`get_discussion_details`]
- [`create_discussion`]
- [`create_pull_request`]
- [`rename_discussion`]
- [`comment_discussion`]
- [`edit_discussion_comment... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#interacting-with-discussions-and-pull-requests | #interacting-with-discussions-and-pull-requests | .md | 8_1 |
```python
A Discussion or Pull Request on the Hub.
This dataclass is not intended to be instantiated directly.
Attributes:
title (`str`):
The title of the Discussion / Pull Request
status (`str`):
The status of the Discussion / Pull Request.
It must be one of:
* `"open"`
* `"closed"`
* `"merged"` (only for Pull Reque... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#discussion | #discussion | .md | 8_2 |
```python
Subclass of [`Discussion`].
Attributes:
title (`str`):
The title of the Discussion / Pull Request
status (`str`):
The status of the Discussion / Pull Request.
It can be one of:
* `"open"`
* `"closed"`
* `"merged"` (only for Pull Requests )
* `"draft"` (only for Pull Requests )
num (`int`):
The number of the ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#discussionwithdetails | #discussionwithdetails | .md | 8_3 |
```python
An event in a Discussion or Pull Request.
Use concrete classes:
* [`DiscussionComment`]
* [`DiscussionStatusChange`]
* [`DiscussionCommit`]
* [`DiscussionTitleChange`]
Attributes:
id (`str`):
The ID of the event. An hexadecimal string.
type (`str`):
The type of the event.
created_at (`datetime`):
A [`dateti... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#discussionevent | #discussionevent | .md | 8_4 |
```python
A comment in a Discussion / Pull Request.
Subclass of [`DiscussionEvent`].
Attributes:
id (`str`):
The ID of the event. An hexadecimal string.
type (`str`):
The type of the event.
created_at (`datetime`):
A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime)
o... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#discussioncomment | #discussioncomment | .md | 8_5 |
```python
A change of status in a Discussion / Pull Request.
Subclass of [`DiscussionEvent`].
Attributes:
id (`str`):
The ID of the event. An hexadecimal string.
type (`str`):
The type of the event.
created_at (`datetime`):
A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.dat... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#discussionstatuschange | #discussionstatuschange | .md | 8_6 |
```python
A commit in a Pull Request.
Subclass of [`DiscussionEvent`].
Attributes:
id (`str`):
The ID of the event. An hexadecimal string.
type (`str`):
The type of the event.
created_at (`datetime`):
A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetime)
object holding t... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#discussioncommit | #discussioncommit | .md | 8_7 |
```python
A rename event in a Discussion / Pull Request.
Subclass of [`DiscussionEvent`].
Attributes:
id (`str`):
The ID of the event. An hexadecimal string.
type (`str`):
The type of the event.
created_at (`datetime`):
A [`datetime`](https://docs.python.org/3/library/datetime.html?highlight=datetime#datetime.datetim... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/community.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/community/#discussiontitlechange | #discussiontitlechange | .md | 8_8 |
<!--⚠️ 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/file_download.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/file_download/ | .md | 9_0 | |
```python
Download a given file if it's not already present in the local cache.
The new cache file layout looks like this:
- The cache directory contains one subfolder per repo_id (namespaced by repo type)
- inside each repo folder:
- refs is a list of the latest known revision => commit_hash pairs
- blobs contains th... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/file_download.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/file_download/#huggingfacehubhfhubdownload | #huggingfacehubhfhubdownload | .md | 9_1 |
```python
Construct the URL of a file from the given information.
The resolved address can either be a huggingface.co-hosted url, or a link to
Cloudfront (a Content Delivery Network, or CDN) for large files which are
more than a few MBs.
Args:
repo_id (`str`):
A namespace (user or an organization) name and a repo nam... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/file_download.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/file_download/#huggingfacehubhfhuburl | #huggingfacehubhfhuburl | .md | 9_2 |
```python
Download repo files.
Download a whole snapshot of a repo's files at the specified revision. This is useful when you want all files from
a repo, because you don't know which ones you will need a priori. All files are nested inside a folder in order
to keep their actual filename relative to that folder. You ca... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/file_download.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/file_download/#huggingfacehubsnapshotdownload | #huggingfacehubsnapshotdownload | .md | 9_3 |
```python
Fetch metadata of a file versioned on the Hub for a given url.
Args:
url (`str`):
File url, for example returned by [`hf_hub_url`].
token (`str` or `bool`, *optional*):
A token to be used for the download.
- If `True`, the token is read from the HuggingFace config
folder.
- If `False` or `None`, no token is ... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/file_download.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/file_download/#huggingfacehubgethffilemetadata | #huggingfacehubgethffilemetadata | .md | 9_4 |
```python
Data structure containing information about a file versioned on the Hub.
Returned by [`get_hf_file_metadata`] based on a URL.
Args:
commit_hash (`str`, *optional*):
The commit_hash related to the file.
etag (`str`, *optional*):
Etag of the file on the server.
location (`str`):
Location where to download the... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/file_download.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/file_download/#huggingfacehubhffilemetadata | #huggingfacehubhffilemetadata | .md | 9_5 |
The methods displayed above are designed to work with a caching system that prevents
re-downloading files. The caching system was updated in v0.8.0 to become the central
cache-system shared across libraries that depend on the Hub.
Read the [cache-system guide](../guides/manage-cache) for a detailed presentation of ca... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/file_download.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/file_download/#caching | #caching | .md | 9_6 |
<!--⚠️ 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/serialization.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/serialization/ | .md | 10_0 | |
`huggingface_hub` provides helpers to save and load ML model weights in a standardized way. This part of the library is still under development and will be improved in future releases. The goal is to harmonize how weights are saved and loaded across the Hub, both to remove code duplication across libraries and to estab... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/serialization.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/serialization/#serialization | #serialization | .md | 10_1 |
DDUF is a file format designed for diffusion models. It allows saving all the information to run a model in a single file. This work is inspired by the [GGUF](https://github.com/ggerganov/ggml/blob/master/docs/gguf.md) format. `huggingface_hub` provides helpers to save and load DDUF files, ensuring the file format is r... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/serialization.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/serialization/#dduf-file-format | #dduf-file-format | .md | 10_2 |
Here is how to export a folder containing different parts of a diffusion model using [`export_folder_as_dduf`]:
```python
# Export a folder as a DDUF file
>>> from huggingface_hub import export_folder_as_dduf
>>> export_folder_as_dduf("FLUX.1-dev.dduf", folder_path="path/to/FLUX.1-dev")
```
For more flexibility, yo... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/serialization.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/serialization/#how-to-write-a-dduf-file | #how-to-write-a-dduf-file | .md | 10_3 |
```python
>>> import json
>>> import safetensors.torch
>>> from huggingface_hub import read_dduf_file
# Read DDUF metadata
>>> dduf_entries = read_dduf_file("FLUX.1-dev.dduf")
# Returns a mapping filename <> DDUFEntry
>>> dduf_entries["model_index.json"]
DDUFEntry(filename='model_index.json', offset=66, length=587)
... | /Users/nielsrogge/Documents/python_projecten/huggingface_hub/docs/source/en/package_reference/serialization.md | https://huggingface.co/docs/huggingface_hub/en/package_reference/serialization/#how-to-read-a-dduf-file | #how-to-read-a-dduf-file | .md | 10_4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.