# Utilitas

## Konfigurasi pencatatan log[[huggingface_hub.utils.logging.get_verbosity]]

Paket `huggingface_hub` menyediakan utilitas `logging` untuk mengatur level logging dari paket itu sendiri. Anda dapat mengimpornya seperti ini:

```py
from huggingface_hub import logging
```

Lalu, Anda dapat mendefinisikan tingkat detail untuk memperbarui jumlah log yang akan Anda lihat:

```python
from huggingface_hub import logging

logging.set_verbosity_error()
logging.set_verbosity_warning()
logging.set_verbosity_info()
logging.set_verbosity_debug()

logging.set_verbosity(...)
```

Tingkat-tingkat tersebut harus dipahami sebagai berikut:

- `error`: hanya tampilkan log kritis tentang penggunaan yang dapat menyebabkan error atau perilaku yang tidak terduga.
- `warning`: menampilkan log yang tidak kritis tetapi penggunaannya dapat menyebabkan perilaku yang tidak diinginkan. Selain itu, log informatif penting juga dapat ditampilkan.
- `info`: menampilkan sebagian besar log, termasuk beberapa log detail mengenai apa yang terjadi di balik layar. Jika ada sesuatu yang berperilaku tidak terduga, kami merekomendasikan untuk mengubah tingkat detail ke level ini guna mendapatkan lebih banyak informasi.
- `debug`: menampilkan semua log, termasuk beberapa log internal yang mungkin digunakan untuk melacak apa yang sebenarnya terjadi di balik layar.

#### huggingface_hub.utils.logging.get_verbosity[[huggingface_hub.utils.logging.get_verbosity]]

```python
huggingface_hub.utils.logging.get_verbosity()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L103)

**Mengembalikan:**

Tingkat log, misalnya, `huggingface_hub.logging.DEBUG` dan `huggingface_hub.logging.INFO`.

Kembalikan level saat ini untuk logger root HuggingFace Hub.

> [!TIP]
> HuggingFace Hub memiliki tingkat log berikut:
>
> - `huggingface_hub.logging.CRITICAL`, `huggingface_hub.logging.FATAL` - `huggingface_hub.logging.ERROR` - `huggingface_hub.logging.WARNING`, `huggingface_hub.logging.WARN` - `huggingface_hub.logging.INFO` - `huggingface_hub.logging.DEBUG`

#### huggingface_hub.utils.logging.set_verbosity[[huggingface_hub.utils.logging.set_verbosity]]

```python
huggingface_hub.utils.logging.set_verbosity(verbosity: int)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L122)

**Parameter:**

verbosity (`int`) : Tingkat log, misalnya `huggingface_hub.logging.DEBUG` dan `huggingface_hub.logging.INFO`.

Menetapkan level untuk logger root HuggingFace Hub.

#### huggingface_hub.utils.logging.set_verbosity_info[[huggingface_hub.utils.logging.set_verbosity_info]]

```python
huggingface_hub.utils.logging.set_verbosity_info()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L134)

Mengatur tingkat detail ke `logging.INFO`.

#### huggingface_hub.utils.logging.set_verbosity_debug[[huggingface_hub.utils.logging.set_verbosity_debug]]

```python
huggingface_hub.utils.logging.set_verbosity_debug()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L148)

Mengatur tingkat detail ke `logging.DEBUG`.

#### huggingface_hub.utils.logging.set_verbosity_warning[[huggingface_hub.utils.logging.set_verbosity_warning]]

```python
huggingface_hub.utils.logging.set_verbosity_warning()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L141)

Mengatur tingkat detail ke `logging.WARNING`.

#### huggingface_hub.utils.logging.set_verbosity_error[[huggingface_hub.utils.logging.set_verbosity_error]]

```python
huggingface_hub.utils.logging.set_verbosity_error()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L155)

Mengatur tingkat detail ke `logging.ERROR`.

#### huggingface_hub.utils.logging.disable_propagation[[huggingface_hub.utils.logging.disable_propagation]]

```python
huggingface_hub.utils.logging.disable_propagation()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L162)

Nonaktifkan propagasi output log pustaka. Perhatikan bahwa propagasi log dinonaktifkan secara default.

#### huggingface_hub.utils.logging.enable_propagation[[huggingface_hub.utils.logging.enable_propagation]]

```python
huggingface_hub.utils.logging.enable_propagation()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L170)

Aktifkan propagasi output log pustaka. Silakan nonaktifkan handler default HuggingFace Hub untuk mencegah pencatatan log ganda jika logger root telah dikonfigurasi.

### Metode helper khusus repo[[huggingface_hub.utils.logging.get_logger]]

Metode yang diuraikan di bawah ini relevan saat memodifikasi modul dari pustaka `huggingface_hub` itu sendiri. Penggunaan metode ini seharusnya tidak diperlukan jika Anda menggunakan `huggingface_hub` dan tidak memodifikasinya.

#### huggingface_hub.utils.logging.get_logger[[huggingface_hub.utils.logging.get_logger]]

```python
huggingface_hub.utils.logging.get_logger(name: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/logging.py#L78)

**Parameter:**

name (`str`, *opsional*) : Nama logger yang akan diambil, biasanya nama file

Mengembalikan logger dengan nama yang ditentukan. Fungsi ini tidak dimaksudkan untuk diakses secara langsung oleh pengguna pustaka.

Contoh:

```python
>>> from huggingface_hub import logging

>>> logger = logging.get_logger(__name__)
>>> logging.set_verbosity_info()
```

## Konfigurasi bilah kemajuan

Bar progres adalah alat yang berguna untuk menampilkan informasi kepada pengguna saat tugas berdurasi panjang sedang dieksekusi (misalnya saat mengunduh atau mengunggah file). `huggingface_hub` menyediakan wrapper `tqdm` untuk menampilkan bar progres secara konsisten di seluruh pustaka.

Secara default, progress bar diaktifkan. Anda dapat menonaktifkannya secara global dengan mengatur variabel lingkungan `HF_HUB_DISABLE_PROGRESS_BARS`. Anda juga dapat mengaktifkan/menonaktifkannya menggunakan [enable_progress_bars()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.utils.enable_progress_bars) dan [disable_progress_bars](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.utils.disable_progress_bars). Jika diset, variabel lingkungan memiliki prioritas di atas helper.

```py
>>> from huggingface_hub import snapshot_download
>>> from huggingface_hub.utils import are_progress_bars_disabled, disable_progress_bars, enable_progress_bars

>>> # Disable progress bars globally
>>> disable_progress_bars()

>>> # Progress bar will not be shown !
>>> snapshot_download("gpt2")

>>> are_progress_bars_disabled()
True

>>> # Re-enable progress bars globally
>>> enable_progress_bars()
```

### Kontrol bar progres spesifik grup

Anda juga dapat mengaktifkan atau menonaktifkan bilah progres untuk grup tertentu. Hal ini memungkinkan Anda mengelola visibilitas bilah progres secara lebih granular di berbagai bagian aplikasi atau pustaka Anda. Ketika bilah progres dinonaktifkan untuk sebuah grup, semua subgrup di bawahnya juga terpengaruh kecuali jika ditimpa secara eksplisit.

```py
# Disable progress bars for a specific group
>>> disable_progress_bars("peft.foo")
>>> assert not are_progress_bars_disabled("peft")
>>> assert not are_progress_bars_disabled("peft.something")
>>> assert are_progress_bars_disabled("peft.foo")
>>> assert are_progress_bars_disabled("peft.foo.bar")

# Re-enable progress bars for a subgroup
>>> enable_progress_bars("peft.foo.bar")
>>> assert are_progress_bars_disabled("peft.foo")
>>> assert not are_progress_bars_disabled("peft.foo.bar")

# Use groups with tqdm
# No progress bar for `name="peft.foo"`
>>> for _ in tqdm(range(5), name="peft.foo"):
...     pass

# Progress bar will be shown for `name="peft.foo.bar"`
>>> for _ in tqdm(range(5), name="peft.foo.bar"):
...     pass
100%|███████████████████████████████████████| 5/5 [00:00<00:00, 117817.53it/s]
```

### are_progress_bars_disabled[[huggingface_hub.utils.are_progress_bars_disabled]]

#### huggingface_hub.utils.are_progress_bars_disabled[[huggingface_hub.utils.are_progress_bars_disabled]]

```python
huggingface_hub.utils.are_progress_bars_disabled(name: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/tqdm.py#L191)

**Parameter:**

name (`str`, *opsional*) : Nama grup yang akan diperiksa; jika None, memeriksa pengaturan global.

**Mengembalikan:** `bool`

True jika bilah progres dinonaktifkan, False jika tidak.

Periksa apakah bilah progres dinonaktifkan secara global atau untuk grup tertentu.

Fungsi ini mengembalikan apakah bilah progres dinonaktifkan untuk grup tertentu atau secara global. Fungsi ini memeriksa variabel lingkungan `HF_HUB_DISABLE_PROGRESS_BARS` terlebih dahulu, lalu pengaturan programatik.

### disable_progress_bars[[huggingface_hub.utils.disable_progress_bars]]

#### huggingface_hub.utils.disable_progress_bars[[huggingface_hub.utils.disable_progress_bars]]

```python
huggingface_hub.utils.disable_progress_bars(name: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/tqdm.py#L109)

**Parameter:**

name (`str`, *opsional*) : Nama grup yang akan dinonaktifkan progress bar-nya. Jika None, progress bar dinonaktifkan secara global.

**Mengangkat:** ``Warning``

- ``Warning`` -- Jika variabel lingkungan mencegah perubahan.

Nonaktifkan bilah progres secara global atau untuk grup tertentu.

Fungsi ini memperbarui status bilah progres berdasarkan nama grup. Jika nama grup tidak diberikan, semua bilah progres dinonaktifkan. Operasi ini menghormati pengaturan variabel lingkungan `HF_HUB_DISABLE_PROGRESS_BARS`.

Berfungsi sebagai panggilan biasa maupun sebagai context manager: disable_progress_bars()           # menonaktifkan hingga enable_progress_bars()
with disable_progress_bars():     # menonaktifkan untuk blok, mengaktifkan kembali saat keluar
...

### enable_progress_bars[[huggingface_hub.utils.enable_progress_bars]]

#### huggingface_hub.utils.enable_progress_bars[[huggingface_hub.utils.enable_progress_bars]]

```python
huggingface_hub.utils.enable_progress_bars(name: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/tqdm.py#L159)

**Parameter:**

name (`str`, *opsional*) : Nama grup yang akan diaktifkan progress bar-nya. Jika None, progress bar diaktifkan secara global.

**Mengangkat:** ``Warning``

- ``Warning`` -- Jika variabel lingkungan mencegah perubahan.

Aktifkan bilah progres secara global atau untuk grup tertentu.

Fungsi ini mengatur bilah progres menjadi aktif untuk grup yang ditentukan atau secara global jika tidak ada grup yang ditentukan. Operasi ini tunduk pada pengaturan lingkungan `HF_HUB_DISABLE_PROGRESS_BARS`.

## Mengonfigurasi Backend HTTP[[huggingface_hub.set_client_factory]]

> [!TIP]
> Pada `huggingface_hub` v0.x, permintaan HTTP ditangani dengan `requests`, dan konfigurasi dilakukan melalui `configure_http_backend`. Karena sekarang kami menggunakan `httpx2`, cara kerjanya berbeda: Anda harus menyediakan fungsi pabrik yang tidak mengambil argumen dan mengembalikan `httpx2.Client`. Anda dapat meninjau [implementasi default di sini](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/utils/_http.py) untuk melihat parameter apa yang digunakan secara default.

Pada beberapa konfigurasi, Anda mungkin perlu mengontrol bagaimana permintaan HTTP dibuat, misalnya saat bekerja di balik proxy. Perpustakaan `huggingface_hub` memungkinkan Anda mengatur ini secara global dengan [set_client_factory()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.set_client_factory). Setelah konfigurasi, semua permintaan ke Hub akan menggunakan pengaturan kustom Anda. Karena `huggingface_hub` bergantung pada `httpx2.Client` di baliknya, Anda dapat memeriksa [dokumentasi `httpx2`](https://httpx2.pydantic.dev/advanced/clients/) untuk detail tentang parameter yang tersedia.

Jika Anda sedang membangun pustaka pihak ketiga dan perlu membuat permintaan langsung ke Hub, gunakan [get_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_session) untuk mendapatkan klien `httpx2` yang dikonfigurasi dengan benar. Ganti semua panggilan langsung `httpx2.get(...)` dengan `get_session().get(...)` untuk memastikan perilaku yang tepat.

#### huggingface_hub.set_client_factory[[huggingface_hub.set_client_factory]]

```python
huggingface_hub.set_client_factory(client_factory: Callable)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_http.py#L372)

Atur pabrik klien HTTP yang akan digunakan oleh `huggingface_hub`.

Client factory adalah metode yang mengembalikan objek `httpx2.Client`. Pada pemanggilan pertama [get_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_session), client factory akan digunakan untuk membuat objek `httpx2.Client` baru yang akan dibagikan di antara semua pemanggilan yang dilakukan oleh `huggingface_hub`.

Hal ini dapat berguna jika Anda menjalankan skrip dalam lingkungan tertentu yang memerlukan konfigurasi khusus (misalnya, proxy atau sertifikat kustom).

Gunakan [get_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_session) untuk mendapatkan `httpx2.Client` yang dikonfigurasi dengan benar.

#### huggingface_hub.get_session[[huggingface_hub.get_session]]

```python
huggingface_hub.get_session()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_http.py#L405)

Dapatkan objek `httpx2.Client`, menggunakan pabrik transport dari pengguna.

Klien ini dibagikan di antara semua panggilan yang dibuat oleh `huggingface_hub`. Oleh karena itu, Anda tidak harus menutupnya secara manual.

Gunakan [set_client_factory()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.set_client_factory) untuk menyesuaikan `httpx2.Client`.

Dalam kasus yang jarang terjadi, Anda mungkin ingin menutup sesi secara manual (misalnya, setelah `SSLError` sementara). Anda dapat melakukannya dengan [close_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.close_session). Sesi baru akan dibuat secara otomatis pada pemanggilan berikutnya ke [get_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_session).

Sesi selalu ditutup secara otomatis ketika proses berakhir.

#### huggingface_hub.close_session[[huggingface_hub.close_session]]

```python
huggingface_hub.close_session()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_http.py#L434)

Tutup `httpx2.Client` global yang digunakan oleh `huggingface_hub`.

Jika Client ditutup, ia akan dibuat ulang pada panggilan berikutnya ke [get_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_session).

Berguna, misalnya, jika sertifikat SSL telah diperbarui.

Untuk kode asinkron, gunakan [set_async_client_factory()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.set_async_client_factory) untuk mengonfigurasi `httpx2.AsyncClient` dan [get_async_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_async_session) untuk mengambilnya.

#### huggingface_hub.set_async_client_factory[[huggingface_hub.set_async_client_factory]]

```python
huggingface_hub.set_async_client_factory(async_client_factory: Callable)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_http.py#L389)

Atur pabrik klien HTTP asinkron yang akan digunakan oleh `huggingface_hub`.

Pabrik klien asinkron adalah metode yang mengembalikan objek `httpx2.AsyncClient`. Hal ini dapat berguna jika Anda menjalankan skrip dalam lingkungan tertentu yang memerlukan konfigurasi khusus (misalnya proxy atau sertifikat kustom). Gunakan [get_async_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_async_session) untuk mendapatkan `httpx2.AsyncClient` yang dikonfigurasi dengan benar.

> [!WARNING]
> Berbeda dengan `httpx2.Client` yang dibagikan di antara semua panggilan yang dibuat oleh `huggingface_hub`, `httpx2.AsyncClient` tidak dibagikan. Disarankan untuk menggunakan async context manager untuk memastikan klien ditutup dengan benar saat konteks berakhir.

#### huggingface_hub.get_async_session[[huggingface_hub.get_async_session]]

```python
huggingface_hub.get_async_session()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_http.py#L421)

Kembalikan objek `httpx2.AsyncClient`, menggunakan pabrik transport dari pengguna.

Gunakan [set_async_client_factory()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.set_async_client_factory) untuk menyesuaikan `httpx2.AsyncClient`.

> [!WARNING]
> Berbeda dengan `httpx2.Client` yang dibagikan di antara semua panggilan yang dibuat oleh `huggingface_hub`, `httpx2.AsyncClient` tidak dibagikan. Disarankan untuk menggunakan async context manager untuk memastikan klien ditutup dengan benar saat konteks berakhir.

> [!TIP]
> Berbeda dengan klien sinkron, siklus hidup klien asinkron tidak dikelola secara otomatis. Gunakan manajer konteks asinkron untuk mengelolanya dengan benar.

### Modul `httpx`

`huggingface_hub` mengekspor ulang pustaka HTTP yang digunakan di baliknya sebagai `huggingface_hub.utils.httpx`:

```py
from huggingface_hub.utils import httpx

try:
    ...
except httpx.HTTPError:
    ...
```

Ini terutama berguna untuk pustaka pihak ketiga yang dibangun di atas `huggingface_hub`. `huggingface_hub` v1.x dibangun di atas [`httpx`](https://www.python-httpx.org/), sedangkan v2.x dibangun di atas [`httpx2`](https://httpx2.pydantic.dev/) (penerusnya, didistribusikan sebagai paket terpisah). Mengimpor modul dari `huggingface_hub.utils` alih-alih mengimpor `httpx` secara langsung berarti Anda selalu mendapatkan versi yang benar-benar digunakan oleh `huggingface_hub`, dan pustaka Anda tetap kompatibel dengan kedua versi mayor. Lihat [isu ini](https://github.com/huggingface/huggingface_hub/issues/4802) untuk detail lebih lanjut tentang rencana migrasi.

> [!WARNING]
> Gunakan ini hanya jika Anda memerlukan tipe atau pengecualian `httpx` (misalnya untuk menangkap error). Untuk membuat permintaan ke Hub, gunakan [get_session()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.get_session) seperti yang dijelaskan di atas.

## Menangani kesalahan HTTP

`huggingface_hub` mendefinisikan error HTTP-nya sendiri untuk memperhalus `HTTPError` yang dilempar oleh `httpx2` dengan informasi tambahan yang dikirim kembali oleh server.

### Angkat untuk status[[huggingface_hub.hf_raise_for_status]]

[hf_raise_for_status()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.hf_raise_for_status) dimaksudkan sebagai metode pusat untuk "raise for status" dari permintaan apa pun yang dibuat ke Hub. Metode ini membungkus `httpx2.Response.raise_for_status` untuk menyediakan informasi tambahan. Setiap `HTTPError` yang dilempar akan dikonversi menjadi `HfHubHTTPError`.

```py
from huggingface_hub.utils import get_session, hf_raise_for_status, HfHubHTTPError

response = get_session().post(...)
try:
    hf_raise_for_status(response)
except HfHubHTTPError as e:
    print(str(e)) # formatted message
    e.request_id, e.server_message # details returned by server

    # Complete the error message with additional information once it's raised
    e.append_to_message("\n`create_commit` expects the repository to exist.")
    raise
```

#### huggingface_hub.hf_raise_for_status[[huggingface_hub.hf_raise_for_status]]

```python
huggingface_hub.hf_raise_for_status(response: Response, endpoint_name: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_http.py#L826)

**Parameter:**

response (`Response`) : Respons dari server.

endpoint_name (`str`, *opsional*) : Nama endpoint yang dipanggil. Jika disediakan, pesan error akan lebih lengkap.

Versi internal dari `response.raise_for_status()` yang akan memperhalus potensi HTTPError. Pengecualian yang dilemparkan akan menjadi instance dari [HfHubHTTPError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.HfHubHTTPError).

Helper ini dimaksudkan sebagai metode unik untuk raise_for_status saat melakukan panggilan ke Hugging Face Hub.

> [!WARNING]
> Membuat pengecualian ketika permintaan gagal:
>
> - [RepositoryNotFoundError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.RepositoryNotFoundError) Jika repositori yang akan diunduh tidak dapat ditemukan. Hal ini mungkin karena repositori tidak ada, karena `repo_type` tidak diatur dengan benar, atau karena repositori bersifat `private` dan Anda tidak memiliki akses. - [GatedRepoError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.GatedRepoError) Jika repositori ada tetapi bersifat gated dan pengguna tidak ada dalam daftar yang diotorisasi. - [RevisionNotFoundError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.RevisionNotFoundError) Jika repositori ada tetapi revisi tidak dapat ditemukan. - [EntryNotFoundError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.EntryNotFoundError) Jika repositori ada tetapi entri (misalnya file yang diminta) tidak dapat ditemukan. - [BadRequestError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.BadRequestError) Jika permintaan gagal dengan error HTTP 400 BadRequest. - [HfHubHTTPError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.HfHubHTTPError) Jika permintaan gagal karena alasan yang tidak tercantum di atas.

### Periksa mode offline[[huggingface_hub.is_offline_mode]]

Anda dapat memeriksa secara programatik apakah mode offline diaktifkan menggunakan `is_offline_mode`. Mode offline diaktifkan dengan mengatur `HF_HUB_OFFLINE=1` sebagai variabel lingkungan.

#### huggingface_hub.is_offline_mode[[huggingface_hub.is_offline_mode]]

```python
huggingface_hub.is_offline_mode()
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/constants.py#L197)

Mengembalikan apakah kita berada dalam mode offline untuk Hub.

Saat mode offline diaktifkan, semua permintaan HTTP yang dibuat dengan `get_session` akan memicu pengecualian `OfflineModeIsEnabled`.

Contoh:
```py
from huggingface_hub import is_offline_mode

def list_files(repo_id: str):
    if is_offline_mode():
        ... # list files from local cache (degraded experience but still functional)
    else:
        ... # list files from Hub (complete experience)
```

### Kesalahan HTTP

Berikut adalah daftar error HTTP yang dilempar di `huggingface_hub`.

#### HfHubHTTPError[[huggingface_hub.errors.HfHubHTTPError]]

`HfHubHTTPError` adalah kelas induk untuk semua error HTTP HF Hub. Kelas ini menangani parsing respons server dan memformat pesan error untuk memberikan informasi sebanyak mungkin kepada pengguna.

#### huggingface_hub.errors.HfHubHTTPError[[huggingface_hub.errors.HfHubHTTPError]]

```python
huggingface_hub.errors.HfHubHTTPError(message: str, response: Response, server_message: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L90)

HTTPError untuk diwarisi oleh setiap HTTP Error kustom yang dilempar di HF Hub.

Setiap HTTPError dikonversi setidaknya menjadi `HfHubHTTPError`. Jika server mengirimkan kembali beberapa informasi, informasi tersebut akan ditambahkan ke pesan kesalahan.

Detail yang ditambahkan:
- Request ID diambil dari header dengan urutan prioritas: "X-Request-Id", "X-Amzn-Trace-Id", "X-Amz-Cf-Id".
- Pesan kesalahan server dari header "X-Error-Message".
- Pesan kesalahan server jika kami dapat menemukannya di badan respons.

Contoh:
```py
    import httpx2
    from huggingface_hub.utils import get_session, hf_raise_for_status, HfHubHTTPError

    response = get_session().post(...)
    try:
        hf_raise_for_status(response)
    except HfHubHTTPError as e:
        print(str(e)) # formatted message
        e.request_id, e.server_message # details returned by server

        # Complete the error message with additional information once it's raised
        e.append_to_message("
ate_commit` expects the repository to exist.")
        raise
```

#### append_to_message[[huggingface_hub.errors.HfHubHTTPError.append_to_message]]

```python
append_to_message(additional_message: str)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L137)

Lampirkan informasi tambahan ke pesan awal `HfHubHTTPError`.

#### RepositoryNotFoundError[[huggingface_hub.errors.RepositoryNotFoundError]]

#### huggingface_hub.errors.RepositoryNotFoundError[[huggingface_hub.errors.RepositoryNotFoundError]]

```python
huggingface_hub.errors.RepositoryNotFoundError(message: str, response: Response, server_message: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L313)

**Parameter:**

repo_id (`str` atau `None`) : id repo yang tidak ditemukan, jika dapat ditentukan dari URL permintaan.

repo_type (`str` atau `None`) : Jenis repo ("model", "dataset", atau "space"), jika dapat ditentukan dari URL permintaan.

Dilempar saat mencoba mengakses URL hf.co dengan nama repositori yang tidak valid, atau dengan nama repositori privat yang tidak dapat diakses oleh pengguna.

Contoh:

```py
>>> from huggingface_hub import model_info
>>> model_info("<non_existent_repository>")
(...)
huggingface_hub.errors.RepositoryNotFoundError: 401 Client Error. (Request ID: PvMw_VjBMjVdMz53WKIzP)

Repository Not Found for url: https://huggingface.co/api/models/%3Cnon_existent_repository%3E.
Please make sure you specified the correct `repo_id` and `repo_type`.
If the repo is private, make sure you are authenticated and your token has the required permissions.
Invalid username or password.
```

#### GatedRepoError[[huggingface_hub.errors.GatedRepoError]]

#### huggingface_hub.errors.GatedRepoError[[huggingface_hub.errors.GatedRepoError]]

```python
huggingface_hub.errors.GatedRepoError(message: str, response: Response, server_message: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L343)

Muncul saat mencoba mengakses repositori bergerbang di mana pengguna tidak ada dalam daftar yang diotorisasi.

Catatan: diturunkan dari `RepositoryNotFoundError` untuk memastikan kompatibilitas mundur.

Contoh:

```py
>>> from huggingface_hub import model_info
>>> model_info("<gated_repository>")
(...)
huggingface_hub.errors.GatedRepoError: 403 Client Error. (Request ID: ViT1Bf7O_026LGSQuVqfa)

Cannot access gated repo for url https://huggingface.co/api/models/ardent-figment/gated-model.
Access to model ardent-figment/gated-model is restricted and you are not in the authorized list.
Visit https://huggingface.co/ardent-figment/gated-model to ask for access.
```

#### RevisionNotFoundError[[huggingface_hub.errors.RevisionNotFoundError]]

#### huggingface_hub.errors.RevisionNotFoundError[[huggingface_hub.errors.RevisionNotFoundError]]

```python
huggingface_hub.errors.RevisionNotFoundError(message: str, response: Response, server_message: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L386)

**Parameter:**

repo_id (`str` atau `None`) : id repo, jika dapat ditentukan dari URL permintaan.

repo_type (`str` atau `None`) : Jenis repo ("model", "dataset", atau "space"), jika dapat ditentukan dari URL permintaan.

Dilempar saat mencoba mengakses URL hf.co dengan repositori yang valid tetapi revisi yang tidak valid.

Contoh:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', 'config.json', revision='<non-existent-revision>')
(...)
huggingface_hub.errors.RevisionNotFoundError: 404 Client Error. (Request ID: Mwhe_c3Kt650GcdKEFomX)

Revision Not Found for url: https://huggingface.co/bert-base-cased/resolve/%3Cnon-existent-revision%3E/config.json.
```

#### RevisionResolutionError[[huggingface_hub.errors.RevisionResolutionError]]

#### huggingface_hub.errors.RevisionResolutionError[[huggingface_hub.errors.RevisionResolutionError]]

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L413)

Dilempar oleh [HfApi.resolve_revision()](/docs/huggingface_hub/v2.4.0/id/package_reference/hf_api#huggingface_hub.HfApi.resolve_revision) ketika sebuah revisi tidak dapat dipecahkan menjadi hash commit: Hub tidak dapat dihubungi (mode offline, error koneksi, timeout, downtime Hub, ...) dan tidak ada entri yang cocok ditemukan di cache lokal.

#### BadRequestError[[huggingface_hub.errors.BadRequestError]]

#### huggingface_hub.errors.BadRequestError[[huggingface_hub.errors.BadRequestError]]

```python
huggingface_hub.errors.BadRequestError(message: str, response: Response, server_message: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L504)

Dilempar oleh `hf_raise_for_status` ketika server mengembalikan error HTTP 400.

Contoh:

```py
>>> resp = httpx2.post("hf.co/api/check", ...)
>>> hf_raise_for_status(resp, endpoint_name="check")
huggingface_hub.errors.BadRequestError: Bad request for check endpoint: {details} (Request ID: XXX)
```

#### EntryNotFoundError[[huggingface_hub.errors.EntryNotFoundError]]

#### huggingface_hub.errors.EntryNotFoundError[[huggingface_hub.errors.EntryNotFoundError]]

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L422)

Dilempar ketika entri tidak ditemukan, baik secara lokal maupun jarak jauh.

Contoh:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', '<non-existent-file>')
(...)
huggingface_hub.errors.RemoteEntryNotFoundError (...)
>>> hf_hub_download('bert-base-cased', '<non-existent-file>', local_files_only=True)
(...)
huggingface_hub.utils.errors.LocalEntryNotFoundError (...)
```

#### RemoteEntryNotFoundError[[huggingface_hub.errors.RemoteEntryNotFoundError]]

#### huggingface_hub.errors.RemoteEntryNotFoundError[[huggingface_hub.errors.RemoteEntryNotFoundError]]

```python
huggingface_hub.errors.RemoteEntryNotFoundError(message: str, response: Response, server_message: str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L440)

**Parameter:**

repo_id (`str` atau `None`) : id repo, jika dapat ditentukan dari URL permintaan.

repo_type (`str` atau `None`) : Jenis repo ("model", "dataset", atau "space"), jika dapat ditentukan dari URL permintaan.

Dilempar saat mencoba mengakses URL hf.co dengan repositori dan revisi yang valid tetapi nama file yang tidak valid.

Contoh:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', '<non-existent-file>')
(...)
huggingface_hub.errors.EntryNotFoundError: 404 Client Error. (Request ID: 53pNl6M0MxsnG5Sw8JA6x)

Entry Not Found for url: https://huggingface.co/bert-base-cased/resolve/main/%3Cnon-existent-file%3E.
```

#### LocalEntryNotFoundError[[huggingface_hub.errors.LocalEntryNotFoundError]]

#### huggingface_hub.errors.LocalEntryNotFoundError[[huggingface_hub.errors.LocalEntryNotFoundError]]

```python
huggingface_hub.errors.LocalEntryNotFoundError(message: str)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L467)

Muncul saat mencoba mengakses file atau snapshot yang tidak ada di disk ketika jaringan dinonaktifkan atau tidak tersedia (masalah koneksi). Entri tersebut mungkin ada di Hub.

Contoh:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', '<non-cached-file>',  local_files_only=True)
(...)
huggingface_hub.errors.LocalEntryNotFoundError: Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable hf.co look-ups and downloads online, set 'local_files_only' to False.
```

#### IncompleteSnapshotError[[huggingface_hub.errors.IncompleteSnapshotError]]

#### huggingface_hub.errors.IncompleteSnapshotError[[huggingface_hub.errors.IncompleteSnapshotError]]

```python
huggingface_hub.errors.IncompleteSnapshotError(message: str, snapshot_path: str)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L486)

Dilempar oleh [snapshot_download()](/docs/huggingface_hub/v2.4.0/id/package_reference/file_download#huggingface_hub.snapshot_download) ketika Hub tidak dapat dijangkau (offline, masalah koneksi, atau `local_files_only=True`) dan snapshot yang di-cache diketahui tidak lengkap: beberapa file yang terdaftar dalam daftar tree yang di-cache dari repositori tidak ada di snapshot lokal.

Ini adalah subkelas dari `LocalEntryNotFoundError` untuk kompatibilitas mundur.

Atribut `snapshot_path` menyimpan jalur ke snapshot lokal yang belum lengkap, sehingga pustaka hilir dapat menemukan file yang di-cache terbaru meskipun diketahui belum lengkap.

#### CachedRepoTreeNotFoundError[[huggingface_hub.errors.CachedRepoTreeNotFoundError]]

#### huggingface_hub.errors.CachedRepoTreeNotFoundError[[huggingface_hub.errors.CachedRepoTreeNotFoundError]]

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L26)

Dilempar oleh [get_cached_repo_tree()](/docs/huggingface_hub/v2.4.0/id/package_reference/file_download#huggingface_hub.get_cached_repo_tree) ketika tidak ada daftar tree yang di-cache untuk revisi yang diminta.

Daftar pohon terisi sebagai efek samping dari [snapshot_download()](/docs/huggingface_hub/v2.4.0/id/package_reference/file_download#huggingface_hub.snapshot_download).

#### OfflineModeIsEnabled[[huggingface_hub.errors.OfflineModeIsEnabled]]

#### huggingface_hub.errors.OfflineModeIsEnabled[[huggingface_hub.errors.OfflineModeIsEnabled]]

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L86)

Dilempar ketika permintaan dibuat tetapi `HF_HUB_OFFLINE=1` diset sebagai variabel lingkungan.

## Telemetri[[huggingface_hub.utils.send_telemetry]]

`huggingface_hub` menyertakan helper untuk mengirim data telemetri. Informasi ini membantu kami men-debug masalah dan memprioritaskan fitur baru. Pengguna dapat menonaktifkan pengumpulan telemetri kapan saja dengan mengatur variabel lingkungan `HF_HUB_DISABLE_TELEMETRY=1`. Telemetri juga dinonaktifkan dalam mode offline (yaitu saat mengatur HF_HUB_OFFLINE=1).

Jika Anda adalah pemelihara pustaka pihak ketiga, mengirim data telemetri sesederhana melakukan panggilan ke `send_telemetry`. Data dikirim di thread terpisah untuk mengurangi dampak bagi pengguna sebanyak mungkin.

#### huggingface_hub.utils.send_telemetry[[huggingface_hub.utils.send_telemetry]]

```python
huggingface_hub.utils.send_telemetry(topic: str, library_name: str | None = None, library_version: str | None = None, user_agent: dict | str | None = None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_telemetry.py#L19)

**Parameter:**

topic (`str`) : Nama topik yang dipantau. Topik ini digunakan secara langsung untuk membangun URL. Jika Anda ingin memantau subtopik, cukup gunakan pemisah "/". Contoh: "gradio", "transformers/examples",...

library_name (`str`, *opsional*) : Nama pustaka yang membuat permintaan HTTP. Akan ditambahkan ke header user-agent.

library_version (`str`, *opsional*) : Versi pustaka yang membuat permintaan HTTP. Akan ditambahkan ke header user-agent.

user_agent (`str`, `dict`, *opsional*) : Informasi user agent dalam bentuk kamus atau satu string. Informasi ini akan dilengkapi dengan data tentang paket yang terinstal.

Mengirim telemetri yang membantu melacak penggunaan berbagai pustaka HF.

Data penggunaan ini membantu kami men-debug masalah dan memprioritaskan fitur baru. Namun, kami memahami bahwa tidak semua orang ingin berbagi informasi tambahan, dan kami menghargai privasi Anda. Anda dapat menonaktifkan pengumpulan telemetri dengan mengatur `HF_HUB_DISABLE_TELEMETRY=1` sebagai variabel lingkungan. Telemetri juga dinonaktifkan dalam mode offline (yaitu saat mengatur `HF_HUB_OFFLINE=1`).

Pengumpulan telemetri dijalankan di thread terpisah untuk meminimalkan dampak bagi pengguna.

Contoh:
```py
>>> from huggingface_hub.utils import send_telemetry

# Send telemetry without library information
>>> send_telemetry("ping")

# Send telemetry to subtopic with library information
>>> send_telemetry("gradio/local_link", library_name="gradio", library_version="3.22.1")

# Send telemetry with additional data
>>> send_telemetry(
...     topic="examples",
...     library_name="transformers",
...     library_version="4.26.0",
...     user_agent={"pipeline": "text_classification", "framework": "flax"},
... )
```

## Validator

`huggingface_hub` menyertakan validator khusus untuk memvalidasi argumen metode secara otomatis. Validasi ini terinspirasi dari pekerjaan yang dilakukan di [Pydantic](https://pydantic-docs.helpmanual.io/) untuk memvalidasi type hint, tetapi dengan fitur yang lebih terbatas.

### Decorator generik

[validate_hf_hub_args()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.utils.validate_hf_hub_args) adalah dekorator generik untuk mengenkapsulasi metode yang memiliki argumen mengikuti penamaan `huggingface_hub`. Secara default, semua argumen yang memiliki validator yang diimplementasikan akan divalidasi.

Jika input tidak valid, [HFValidationError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.HFValidationError) akan dilempar. Hanya nilai pertama yang tidak valid yang akan memicu error dan menghentikan proses validasi.

Penggunaan:

```py
>>> from huggingface_hub.utils import validate_hf_hub_args

>>> @validate_hf_hub_args
... def my_cool_method(repo_id: str):
...     print(repo_id)

>>> my_cool_method(repo_id="valid_repo_id")
valid_repo_id

>>> my_cool_method("other..repo..id")
huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'.

>>> my_cool_method(repo_id="other..repo..id")
huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'.
```

#### validate_hf_hub_args[[huggingface_hub.utils.validate_hf_hub_args]]

#### huggingface_hub.utils.validate_hf_hub_args[[huggingface_hub.utils.validate_hf_hub_args]]

```python
huggingface_hub.utils.validate_hf_hub_args(fn: ~CallableT)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_validators.py#L42)

**Mengangkat:** [HFValidationError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.HFValidationError)

- [HFValidationError](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.errors.HFValidationError) -- Jika input tidak valid.

Validasi nilai yang diterima sebagai argumen untuk metode publik apa pun dari `huggingface_hub`.

Tujuan dari dekorator ini adalah untuk menyelaraskan validasi argumen yang digunakan di mana saja. Secara default, semua validator yang didefinisikan akan diuji.

Validator:
- [validate_repo_id()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.utils.validate_repo_id): `repo_id` harus berupa `"repo_name"` atau `"namespace/repo_name"`. Namespace adalah nama pengguna atau organisasi.
- `~utils.smoothly_deprecate_legacy_arguments`: Abaikan `proxies` saat mengunduh file (seharusnya diatur secara global).

Contoh:
```py
>>> from huggingface_hub.utils import validate_hf_hub_args

>>> @validate_hf_hub_args
... def my_cool_method(repo_id: str):
...     print(repo_id)

>>> my_cool_method(repo_id="valid_repo_id")
valid_repo_id

>>> my_cool_method("other..repo..id")
huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'.

>>> my_cool_method(repo_id="other..repo..id")
huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'.
```

#### HFValidationError[[huggingface_hub.errors.HFValidationError]]

#### huggingface_hub.errors.HFValidationError[[huggingface_hub.errors.HFValidationError]]

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/errors.py#L217)

Pengecualian umum yang dilempar oleh validator `huggingface_hub`.

Mewarisi dari [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError).

### Validator argumen

Validators juga dapat digunakan secara individual. Berikut adalah daftar semua argumen yang dapat divalidasi.

#### repo_id[[huggingface_hub.utils.validate_repo_id]]

#### huggingface_hub.utils.validate_repo_id[[huggingface_hub.utils.validate_repo_id]]

```python
huggingface_hub.utils.validate_repo_id(repo_id: str | None)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_validators.py#L94)

Validasi bahwa `repo_id` valid.

Hal ini tidak dimaksudkan untuk menggantikan validasi yang tepat yang dilakukan di Hub, melainkan untuk menghindari inkonsistensi lokal sepanjang mungkin (contoh: meneruskan `repo_type` di dalam `repo_id` dilarang).

Aturan:
- Antara 1 dan 96 karakter.
- "repo_name" atau "namespace/repo_name"
- [a-zA-Z0-9] atau "-", "_", "."
- "--" dan ".." dilarang

Valid: `"foo"`, `"foo/bar"`, `"123"`, `"Foo-BAR_foo.bar123"`

Tidak valid: `"datasets/foo/bar"`, `".repo_id"`, `"foo--bar"`, `"foo.git"`

Contoh:
```py
>>> from huggingface_hub.utils import validate_repo_id
>>> validate_repo_id(repo_id="valid_repo_id")
>>> validate_repo_id(repo_id="other..repo..id")
huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'.
```

Dibahas di https://github.com/huggingface/huggingface_hub/issues/1008. Di moon-landing (repositori internal):
- https://github.com/huggingface/moon-landing/blob/main/server/lib/Names.ts#L27
- https://github.com/huggingface/moon-landing/blob/main/server/views/components/NewRepoForm/NewRepoForm.svelte#L138

#### smoothly_deprecate_legacy_arguments[[huggingface_hub.utils._validators.smoothly_deprecate_legacy_arguments]]

Bukan persis validator, tetapi tetap berjalan dengan baik.

#### huggingface_hub.utils._validators.smoothly_deprecate_legacy_arguments[[huggingface_hub.utils._validators.smoothly_deprecate_legacy_arguments]]

```python
huggingface_hub.utils._validators.smoothly_deprecate_legacy_arguments(fn_name: str, kwargs: dict)
```

[Sumber](https://github.com/huggingface/huggingface_hub/blob/v2.4.0/src/huggingface_hub/utils/_validators.py#L152)

Nonaktifkan argumen lama secara mulus dalam basis kode `huggingface_hub`.

Fungsi ini mengabaikan beberapa argumen yang sudah tidak didukung lagi dari kwargs dan memberi tahu pengguna bahwa argumen tersebut diabaikan. Tujuannya adalah untuk menghindari kerusakan pada kode yang sudah ada sambil memandu pengguna ke cara baru dalam melakukan hal tersebut.

Daftar argumen yang tidak didukung lagi:
- `proxies`: Untuk mengatur proxy, pengguna harus menggunakan variabel lingkungan HTTP_PROXY atau mengonfigurasi `httpx2.Client` secara manual menggunakan fungsi [set_client_factory()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.set_client_factory).

  Pada huggingface_hub 0.x, `proxies` adalah kamus yang diteruskan langsung ke `requests.request`. Sejak huggingface_hub 1.x, `proxies` per-request tidak lagi didukung. Secara khusus, tidak mungkin lagi mengonfigurasi proxy pada basis per-request. Solusinya adalah mengonfigurasinya secara global menggunakan fungsi [set_client_factory()](/docs/huggingface_hub/v2.4.0/id/package_reference/utilities#huggingface_hub.set_client_factory) atau menggunakan variabel lingkungan HTTP_PROXY.

  Untuk detail lebih lanjut, lihat:
  - https://httpx2.pydantic.dev/advanced/proxies/

- `resume_download`: tidak lagi didukung dan tidak ada pengganti. `huggingface_hub` selalu melanjutkan unduhan setiap kali memungkinkan.
- `force_filename`: tidak didukung lagi tanpa pengganti. Nama file selalu sama dengan di Hub.
- `local_dir_use_symlinks`: tidak didukung lagi tanpa pengganti. Unduhan ke direktori lokal tidak lagi menggunakan symlink.

