huggingface-hub 0.36.0rc0__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of huggingface-hub might be problematic. Click here for more details.
- huggingface_hub/__init__.py +33 -45
- huggingface_hub/_commit_api.py +39 -43
- huggingface_hub/_commit_scheduler.py +11 -8
- huggingface_hub/_inference_endpoints.py +8 -8
- huggingface_hub/_jobs_api.py +20 -20
- huggingface_hub/_login.py +17 -43
- huggingface_hub/_oauth.py +8 -8
- huggingface_hub/_snapshot_download.py +135 -50
- huggingface_hub/_space_api.py +4 -4
- huggingface_hub/_tensorboard_logger.py +5 -5
- huggingface_hub/_upload_large_folder.py +18 -32
- huggingface_hub/_webhooks_payload.py +3 -3
- huggingface_hub/_webhooks_server.py +2 -2
- huggingface_hub/cli/__init__.py +0 -14
- huggingface_hub/cli/_cli_utils.py +143 -39
- huggingface_hub/cli/auth.py +105 -171
- huggingface_hub/cli/cache.py +594 -361
- huggingface_hub/cli/download.py +120 -112
- huggingface_hub/cli/hf.py +38 -41
- huggingface_hub/cli/jobs.py +689 -1017
- huggingface_hub/cli/lfs.py +120 -143
- huggingface_hub/cli/repo.py +282 -216
- huggingface_hub/cli/repo_files.py +50 -84
- huggingface_hub/cli/system.py +6 -25
- huggingface_hub/cli/upload.py +198 -220
- huggingface_hub/cli/upload_large_folder.py +91 -106
- huggingface_hub/community.py +5 -5
- huggingface_hub/constants.py +17 -52
- huggingface_hub/dataclasses.py +135 -21
- huggingface_hub/errors.py +47 -30
- huggingface_hub/fastai_utils.py +8 -9
- huggingface_hub/file_download.py +351 -303
- huggingface_hub/hf_api.py +398 -570
- huggingface_hub/hf_file_system.py +101 -66
- huggingface_hub/hub_mixin.py +32 -54
- huggingface_hub/inference/_client.py +177 -162
- huggingface_hub/inference/_common.py +38 -54
- huggingface_hub/inference/_generated/_async_client.py +218 -258
- huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +3 -3
- huggingface_hub/inference/_generated/types/base.py +10 -7
- huggingface_hub/inference/_generated/types/chat_completion.py +16 -16
- huggingface_hub/inference/_generated/types/depth_estimation.py +2 -2
- huggingface_hub/inference/_generated/types/document_question_answering.py +2 -2
- huggingface_hub/inference/_generated/types/feature_extraction.py +2 -2
- huggingface_hub/inference/_generated/types/fill_mask.py +2 -2
- huggingface_hub/inference/_generated/types/sentence_similarity.py +3 -3
- huggingface_hub/inference/_generated/types/summarization.py +2 -2
- huggingface_hub/inference/_generated/types/table_question_answering.py +4 -4
- huggingface_hub/inference/_generated/types/text2text_generation.py +2 -2
- huggingface_hub/inference/_generated/types/text_generation.py +10 -10
- huggingface_hub/inference/_generated/types/text_to_video.py +2 -2
- huggingface_hub/inference/_generated/types/token_classification.py +2 -2
- huggingface_hub/inference/_generated/types/translation.py +2 -2
- huggingface_hub/inference/_generated/types/zero_shot_classification.py +2 -2
- huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +2 -2
- huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +1 -3
- huggingface_hub/inference/_mcp/agent.py +3 -3
- huggingface_hub/inference/_mcp/constants.py +1 -2
- huggingface_hub/inference/_mcp/mcp_client.py +33 -22
- huggingface_hub/inference/_mcp/types.py +10 -10
- huggingface_hub/inference/_mcp/utils.py +4 -4
- huggingface_hub/inference/_providers/__init__.py +12 -4
- huggingface_hub/inference/_providers/_common.py +62 -24
- huggingface_hub/inference/_providers/black_forest_labs.py +6 -6
- huggingface_hub/inference/_providers/cohere.py +3 -3
- huggingface_hub/inference/_providers/fal_ai.py +25 -25
- huggingface_hub/inference/_providers/featherless_ai.py +4 -4
- huggingface_hub/inference/_providers/fireworks_ai.py +3 -3
- huggingface_hub/inference/_providers/hf_inference.py +13 -13
- huggingface_hub/inference/_providers/hyperbolic.py +4 -4
- huggingface_hub/inference/_providers/nebius.py +10 -10
- huggingface_hub/inference/_providers/novita.py +5 -5
- huggingface_hub/inference/_providers/nscale.py +4 -4
- huggingface_hub/inference/_providers/replicate.py +15 -15
- huggingface_hub/inference/_providers/sambanova.py +6 -6
- huggingface_hub/inference/_providers/together.py +7 -7
- huggingface_hub/lfs.py +21 -94
- huggingface_hub/repocard.py +15 -16
- huggingface_hub/repocard_data.py +57 -57
- huggingface_hub/serialization/__init__.py +0 -1
- huggingface_hub/serialization/_base.py +9 -9
- huggingface_hub/serialization/_dduf.py +7 -7
- huggingface_hub/serialization/_torch.py +28 -28
- huggingface_hub/utils/__init__.py +11 -6
- huggingface_hub/utils/_auth.py +5 -5
- huggingface_hub/utils/_cache_manager.py +49 -74
- huggingface_hub/utils/_deprecation.py +1 -1
- huggingface_hub/utils/_dotenv.py +3 -3
- huggingface_hub/utils/_fixes.py +0 -10
- huggingface_hub/utils/_git_credential.py +3 -3
- huggingface_hub/utils/_headers.py +7 -29
- huggingface_hub/utils/_http.py +371 -208
- huggingface_hub/utils/_pagination.py +4 -4
- huggingface_hub/utils/_parsing.py +98 -0
- huggingface_hub/utils/_paths.py +5 -5
- huggingface_hub/utils/_runtime.py +59 -23
- huggingface_hub/utils/_safetensors.py +21 -21
- huggingface_hub/utils/_subprocess.py +9 -9
- huggingface_hub/utils/_telemetry.py +3 -3
- huggingface_hub/{commands/_cli_utils.py → utils/_terminal.py} +4 -9
- huggingface_hub/utils/_typing.py +3 -3
- huggingface_hub/utils/_validators.py +53 -72
- huggingface_hub/utils/_xet.py +16 -16
- huggingface_hub/utils/_xet_progress_reporting.py +1 -1
- huggingface_hub/utils/insecure_hashlib.py +3 -9
- huggingface_hub/utils/tqdm.py +3 -3
- {huggingface_hub-0.36.0rc0.dist-info → huggingface_hub-1.0.0.dist-info}/METADATA +16 -35
- huggingface_hub-1.0.0.dist-info/RECORD +152 -0
- {huggingface_hub-0.36.0rc0.dist-info → huggingface_hub-1.0.0.dist-info}/entry_points.txt +0 -1
- huggingface_hub/commands/__init__.py +0 -27
- huggingface_hub/commands/delete_cache.py +0 -476
- huggingface_hub/commands/download.py +0 -204
- huggingface_hub/commands/env.py +0 -39
- huggingface_hub/commands/huggingface_cli.py +0 -65
- huggingface_hub/commands/lfs.py +0 -200
- huggingface_hub/commands/repo.py +0 -151
- huggingface_hub/commands/repo_files.py +0 -132
- huggingface_hub/commands/scan_cache.py +0 -183
- huggingface_hub/commands/tag.py +0 -161
- huggingface_hub/commands/upload.py +0 -318
- huggingface_hub/commands/upload_large_folder.py +0 -131
- huggingface_hub/commands/user.py +0 -208
- huggingface_hub/commands/version.py +0 -40
- huggingface_hub/inference_api.py +0 -217
- huggingface_hub/keras_mixin.py +0 -497
- huggingface_hub/repository.py +0 -1471
- huggingface_hub/serialization/_tensorflow.py +0 -92
- huggingface_hub/utils/_hf_folder.py +0 -68
- huggingface_hub-0.36.0rc0.dist-info/RECORD +0 -170
- {huggingface_hub-0.36.0rc0.dist-info → huggingface_hub-1.0.0.dist-info}/LICENSE +0 -0
- {huggingface_hub-0.36.0rc0.dist-info → huggingface_hub-1.0.0.dist-info}/WHEEL +0 -0
- {huggingface_hub-0.36.0rc0.dist-info → huggingface_hub-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -19,7 +19,7 @@ import re
|
|
|
19
19
|
import warnings
|
|
20
20
|
from functools import wraps
|
|
21
21
|
from itertools import chain
|
|
22
|
-
from typing import Any
|
|
22
|
+
from typing import Any
|
|
23
23
|
|
|
24
24
|
from huggingface_hub.errors import HFValidationError
|
|
25
25
|
|
|
@@ -48,9 +48,7 @@ def validate_hf_hub_args(fn: CallableT) -> CallableT:
|
|
|
48
48
|
Validators:
|
|
49
49
|
- [`~utils.validate_repo_id`]: `repo_id` must be `"repo_name"`
|
|
50
50
|
or `"namespace/repo_name"`. Namespace is a username or an organization.
|
|
51
|
-
- [`~utils.
|
|
52
|
-
`use_auth_token` (only if `use_auth_token` is not expected by the decorated
|
|
53
|
-
function - in practice, always the case in `huggingface_hub`).
|
|
51
|
+
- [`~utils.smoothly_deprecate_legacy_arguments`]: Ignore `proxies` when downloading files (should be set globally).
|
|
54
52
|
|
|
55
53
|
Example:
|
|
56
54
|
```py
|
|
@@ -68,20 +66,6 @@ def validate_hf_hub_args(fn: CallableT) -> CallableT:
|
|
|
68
66
|
|
|
69
67
|
>>> my_cool_method(repo_id="other..repo..id")
|
|
70
68
|
huggingface_hub.utils._validators.HFValidationError: Cannot have -- or .. in repo_id: 'other..repo..id'.
|
|
71
|
-
|
|
72
|
-
>>> @validate_hf_hub_args
|
|
73
|
-
... def my_cool_auth_method(token: str):
|
|
74
|
-
... print(token)
|
|
75
|
-
|
|
76
|
-
>>> my_cool_auth_method(token="a token")
|
|
77
|
-
"a token"
|
|
78
|
-
|
|
79
|
-
>>> my_cool_auth_method(use_auth_token="a use_auth_token")
|
|
80
|
-
"a use_auth_token"
|
|
81
|
-
|
|
82
|
-
>>> my_cool_auth_method(token="a token", use_auth_token="a use_auth_token")
|
|
83
|
-
UserWarning: Both `token` and `use_auth_token` are passed (...)
|
|
84
|
-
"a token"
|
|
85
69
|
```
|
|
86
70
|
|
|
87
71
|
Raises:
|
|
@@ -91,13 +75,8 @@ def validate_hf_hub_args(fn: CallableT) -> CallableT:
|
|
|
91
75
|
# TODO: add an argument to opt-out validation for specific argument?
|
|
92
76
|
signature = inspect.signature(fn)
|
|
93
77
|
|
|
94
|
-
# Should the validator switch `use_auth_token` values to `token`? In practice, always
|
|
95
|
-
# True in `huggingface_hub`. Might not be the case in a downstream library.
|
|
96
|
-
check_use_auth_token = "use_auth_token" not in signature.parameters and "token" in signature.parameters
|
|
97
|
-
|
|
98
78
|
@wraps(fn)
|
|
99
79
|
def _inner_fn(*args, **kwargs):
|
|
100
|
-
has_token = False
|
|
101
80
|
for arg_name, arg_value in chain(
|
|
102
81
|
zip(signature.parameters, args), # Args values
|
|
103
82
|
kwargs.items(), # Kwargs values
|
|
@@ -105,11 +84,7 @@ def validate_hf_hub_args(fn: CallableT) -> CallableT:
|
|
|
105
84
|
if arg_name in ["repo_id", "from_id", "to_id"]:
|
|
106
85
|
validate_repo_id(arg_value)
|
|
107
86
|
|
|
108
|
-
|
|
109
|
-
has_token = True
|
|
110
|
-
|
|
111
|
-
if check_use_auth_token:
|
|
112
|
-
kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
|
|
87
|
+
kwargs = smoothly_deprecate_legacy_arguments(fn_name=fn.__name__, kwargs=kwargs)
|
|
113
88
|
|
|
114
89
|
return fn(*args, **kwargs)
|
|
115
90
|
|
|
@@ -170,57 +145,63 @@ def validate_repo_id(repo_id: str) -> None:
|
|
|
170
145
|
raise HFValidationError(f"Repo_id cannot end by '.git': '{repo_id}'.")
|
|
171
146
|
|
|
172
147
|
|
|
173
|
-
def
|
|
174
|
-
"""Smoothly deprecate
|
|
175
|
-
|
|
176
|
-
The long-term goal is to remove any mention of `use_auth_token` in the codebase in
|
|
177
|
-
favor of a unique and less verbose `token` argument. This will be done a few steps:
|
|
148
|
+
def smoothly_deprecate_legacy_arguments(fn_name: str, kwargs: dict[str, Any]) -> dict[str, Any]:
|
|
149
|
+
"""Smoothly deprecate legacy arguments in the `huggingface_hub` codebase.
|
|
178
150
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
argument (`str`, `None`). This implicit rule exists to be able to not send the
|
|
182
|
-
token when not necessary (`use_auth_token=False`) even if logged in.
|
|
151
|
+
This function ignores some deprecated arguments from the kwargs and warns the user they are ignored.
|
|
152
|
+
The goal is to avoid breaking existing code while guiding the user to the new way of doing things.
|
|
183
153
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
a. Corner case: if both `use_auth_token` and `token` values are passed, a warning
|
|
189
|
-
is thrown and the `use_auth_token` value is ignored.
|
|
154
|
+
List of deprecated arguments:
|
|
155
|
+
- `proxies`:
|
|
156
|
+
To set up proxies, user must either use the HTTP_PROXY environment variable or configure the `httpx.Client`
|
|
157
|
+
manually using the [`set_client_factory`] function.
|
|
190
158
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
159
|
+
In huggingface_hub 0.x, `proxies` was a dictionary directly passed to `requests.request`.
|
|
160
|
+
In huggingface_hub 1.x, we migrated to `httpx` which does not support `proxies` the same way.
|
|
161
|
+
In particular, it is not possible to configure proxies on a per-request basis. The solution is to configure
|
|
162
|
+
it globally using the [`set_client_factory`] function or using the HTTP_PROXY environment variable.
|
|
194
163
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
In addition, unit tests in `huggingface_hub` must be adapted to expect warnings
|
|
199
|
-
to be thrown (but still use `use_auth_token` as before).
|
|
164
|
+
More more details, see:
|
|
165
|
+
- https://www.python-httpx.org/advanced/proxies/
|
|
166
|
+
- https://www.python-httpx.org/compatibility/#proxy-keys.
|
|
200
167
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
This has been discussed in:
|
|
206
|
-
- https://github.com/huggingface/huggingface_hub/issues/1094.
|
|
207
|
-
- https://github.com/huggingface/huggingface_hub/pull/928
|
|
208
|
-
- (related) https://github.com/huggingface/huggingface_hub/pull/1064
|
|
168
|
+
- `resume_download`: deprecated without replacement. `huggingface_hub` always resumes downloads whenever possible.
|
|
169
|
+
- `force_filename`: deprecated without replacement. Filename is always the same as on the Hub.
|
|
170
|
+
- `local_dir_use_symlinks`: deprecated without replacement. Downloading to a local directory does not use symlinks anymore.
|
|
209
171
|
"""
|
|
210
172
|
new_kwargs = kwargs.copy() # do not mutate input !
|
|
211
173
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
174
|
+
# proxies
|
|
175
|
+
proxies = new_kwargs.pop("proxies", None) # remove from kwargs
|
|
176
|
+
if proxies is not None:
|
|
177
|
+
warnings.warn(
|
|
178
|
+
f"The `proxies` argument is ignored in `{fn_name}`. To set up proxies, use the HTTP_PROXY / HTTPS_PROXY"
|
|
179
|
+
" environment variables or configure the `httpx.Client` manually using `huggingface_hub.set_client_factory`."
|
|
180
|
+
" See https://www.python-httpx.org/advanced/proxies/ for more details."
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
# resume_download
|
|
184
|
+
resume_download = new_kwargs.pop("resume_download", None) # remove from kwargs
|
|
185
|
+
if resume_download is not None:
|
|
186
|
+
warnings.warn(
|
|
187
|
+
f"The `resume_download` argument is deprecated and ignored in `{fn_name}`. Downloads always resume"
|
|
188
|
+
" whenever possible."
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# force_filename
|
|
192
|
+
force_filename = new_kwargs.pop("force_filename", None) # remove from kwargs
|
|
193
|
+
if force_filename is not None:
|
|
194
|
+
warnings.warn(
|
|
195
|
+
f"The `force_filename` argument is deprecated and ignored in `{fn_name}`. Filename is always the same "
|
|
196
|
+
"as on the Hub."
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
# local_dir_use_symlinks
|
|
200
|
+
local_dir_use_symlinks = new_kwargs.pop("local_dir_use_symlinks", None) # remove from kwargs
|
|
201
|
+
if local_dir_use_symlinks is not None:
|
|
202
|
+
warnings.warn(
|
|
203
|
+
f"The `local_dir_use_symlinks` argument is deprecated and ignored in `{fn_name}`. Downloading to a local"
|
|
204
|
+
" directory does not use symlinks anymore."
|
|
205
|
+
)
|
|
225
206
|
|
|
226
207
|
return new_kwargs
|
huggingface_hub/utils/_xet.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from enum import Enum
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Optional
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import httpx
|
|
6
6
|
|
|
7
7
|
from .. import constants
|
|
8
8
|
from . import get_session, hf_raise_for_status, validate_hf_hub_args
|
|
@@ -27,7 +27,7 @@ class XetConnectionInfo:
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def parse_xet_file_data_from_response(
|
|
30
|
-
response:
|
|
30
|
+
response: httpx.Response, endpoint: Optional[str] = None
|
|
31
31
|
) -> Optional[XetFileData]:
|
|
32
32
|
"""
|
|
33
33
|
Parse XET file metadata from an HTTP response.
|
|
@@ -36,7 +36,7 @@ def parse_xet_file_data_from_response(
|
|
|
36
36
|
of a given response object. If the required metadata is not found, it returns `None`.
|
|
37
37
|
|
|
38
38
|
Args:
|
|
39
|
-
response (`
|
|
39
|
+
response (`httpx.Response`):
|
|
40
40
|
The HTTP response object containing headers dict and links dict to extract the XET metadata from.
|
|
41
41
|
Returns:
|
|
42
42
|
`Optional[XetFileData]`:
|
|
@@ -63,11 +63,11 @@ def parse_xet_file_data_from_response(
|
|
|
63
63
|
)
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
def parse_xet_connection_info_from_headers(headers:
|
|
66
|
+
def parse_xet_connection_info_from_headers(headers: dict[str, str]) -> Optional[XetConnectionInfo]:
|
|
67
67
|
"""
|
|
68
68
|
Parse XET connection info from the HTTP headers or return None if not found.
|
|
69
69
|
Args:
|
|
70
|
-
headers (`
|
|
70
|
+
headers (`dict`):
|
|
71
71
|
HTTP headers to extract the XET metadata from.
|
|
72
72
|
Returns:
|
|
73
73
|
`XetConnectionInfo` or `None`:
|
|
@@ -92,7 +92,7 @@ def parse_xet_connection_info_from_headers(headers: Dict[str, str]) -> Optional[
|
|
|
92
92
|
def refresh_xet_connection_info(
|
|
93
93
|
*,
|
|
94
94
|
file_data: XetFileData,
|
|
95
|
-
headers:
|
|
95
|
+
headers: dict[str, str],
|
|
96
96
|
) -> XetConnectionInfo:
|
|
97
97
|
"""
|
|
98
98
|
Utilizes the information in the parsed metadata to request the Hub xet connection information.
|
|
@@ -100,7 +100,7 @@ def refresh_xet_connection_info(
|
|
|
100
100
|
Args:
|
|
101
101
|
file_data: (`XetFileData`):
|
|
102
102
|
The file data needed to refresh the xet connection information.
|
|
103
|
-
headers (`
|
|
103
|
+
headers (`dict[str, str]`):
|
|
104
104
|
Headers to use for the request, including authorization headers and user agent.
|
|
105
105
|
Returns:
|
|
106
106
|
`XetConnectionInfo`:
|
|
@@ -123,9 +123,9 @@ def fetch_xet_connection_info_from_repo_info(
|
|
|
123
123
|
repo_id: str,
|
|
124
124
|
repo_type: str,
|
|
125
125
|
revision: Optional[str] = None,
|
|
126
|
-
headers:
|
|
126
|
+
headers: dict[str, str],
|
|
127
127
|
endpoint: Optional[str] = None,
|
|
128
|
-
params: Optional[
|
|
128
|
+
params: Optional[dict[str, str]] = None,
|
|
129
129
|
) -> XetConnectionInfo:
|
|
130
130
|
"""
|
|
131
131
|
Uses the repo info to request a xet access token from Hub.
|
|
@@ -138,11 +138,11 @@ def fetch_xet_connection_info_from_repo_info(
|
|
|
138
138
|
Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
|
|
139
139
|
revision (`str`, `optional`):
|
|
140
140
|
The revision of the repo to get the token for.
|
|
141
|
-
headers (`
|
|
141
|
+
headers (`dict[str, str]`):
|
|
142
142
|
Headers to use for the request, including authorization headers and user agent.
|
|
143
143
|
endpoint (`str`, `optional`):
|
|
144
144
|
The endpoint to use for the request. Defaults to the Hub endpoint.
|
|
145
|
-
params (`
|
|
145
|
+
params (`dict[str, str]`, `optional`):
|
|
146
146
|
Additional parameters to pass with the request.
|
|
147
147
|
Returns:
|
|
148
148
|
`XetConnectionInfo`:
|
|
@@ -161,8 +161,8 @@ def fetch_xet_connection_info_from_repo_info(
|
|
|
161
161
|
@validate_hf_hub_args
|
|
162
162
|
def _fetch_xet_connection_info_with_url(
|
|
163
163
|
url: str,
|
|
164
|
-
headers:
|
|
165
|
-
params: Optional[
|
|
164
|
+
headers: dict[str, str],
|
|
165
|
+
params: Optional[dict[str, str]] = None,
|
|
166
166
|
) -> XetConnectionInfo:
|
|
167
167
|
"""
|
|
168
168
|
Requests the xet connection info from the supplied URL. This includes the
|
|
@@ -170,9 +170,9 @@ def _fetch_xet_connection_info_with_url(
|
|
|
170
170
|
Args:
|
|
171
171
|
url: (`str`):
|
|
172
172
|
The access token endpoint URL.
|
|
173
|
-
headers (`
|
|
173
|
+
headers (`dict[str, str]`):
|
|
174
174
|
Headers to use for the request, including authorization headers and user agent.
|
|
175
|
-
params (`
|
|
175
|
+
params (`dict[str, str]`, `optional`):
|
|
176
176
|
Additional parameters to pass with the request.
|
|
177
177
|
Returns:
|
|
178
178
|
`XetConnectionInfo`:
|
|
@@ -64,7 +64,7 @@ class XetProgressReporter:
|
|
|
64
64
|
|
|
65
65
|
return f"{padding}{name.ljust(width)}"
|
|
66
66
|
|
|
67
|
-
def update_progress(self, total_update: PyTotalProgressUpdate, item_updates:
|
|
67
|
+
def update_progress(self, total_update: PyTotalProgressUpdate, item_updates: list[PyItemProgressUpdate]):
|
|
68
68
|
# Update all the per-item values.
|
|
69
69
|
for item in item_updates:
|
|
70
70
|
item_name = item.item_name
|
|
@@ -25,14 +25,8 @@
|
|
|
25
25
|
# ```
|
|
26
26
|
import functools
|
|
27
27
|
import hashlib
|
|
28
|
-
import sys
|
|
29
28
|
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
sha256 = functools.partial(hashlib.sha256, usedforsecurity=False)
|
|
35
|
-
else:
|
|
36
|
-
md5 = hashlib.md5
|
|
37
|
-
sha1 = hashlib.sha1
|
|
38
|
-
sha256 = hashlib.sha256
|
|
30
|
+
md5 = functools.partial(hashlib.md5, usedforsecurity=False)
|
|
31
|
+
sha1 = functools.partial(hashlib.sha1, usedforsecurity=False)
|
|
32
|
+
sha256 = functools.partial(hashlib.sha256, usedforsecurity=False)
|
huggingface_hub/utils/tqdm.py
CHANGED
|
@@ -86,7 +86,7 @@ import os
|
|
|
86
86
|
import warnings
|
|
87
87
|
from contextlib import contextmanager, nullcontext
|
|
88
88
|
from pathlib import Path
|
|
89
|
-
from typing import ContextManager,
|
|
89
|
+
from typing import ContextManager, Iterator, Optional, Union
|
|
90
90
|
|
|
91
91
|
from tqdm.auto import tqdm as old_tqdm
|
|
92
92
|
|
|
@@ -102,7 +102,7 @@ from ..constants import HF_HUB_DISABLE_PROGRESS_BARS
|
|
|
102
102
|
# progress bar visibility through code. By default, progress bars are turned on.
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
progress_bar_states:
|
|
105
|
+
progress_bar_states: dict[str, bool] = {}
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
def disable_progress_bars(name: Optional[str] = None) -> None:
|
|
@@ -248,7 +248,7 @@ def tqdm_stream_file(path: Union[Path, str]) -> Iterator[io.BufferedReader]:
|
|
|
248
248
|
Example:
|
|
249
249
|
```py
|
|
250
250
|
>>> with tqdm_stream_file("config.json") as f:
|
|
251
|
-
>>>
|
|
251
|
+
>>> httpx.put(url, data=f)
|
|
252
252
|
config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s]
|
|
253
253
|
```
|
|
254
254
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: huggingface-hub
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
|
|
5
5
|
Home-page: https://github.com/huggingface/huggingface_hub
|
|
6
6
|
Author: Hugging Face, Inc.
|
|
@@ -15,26 +15,26 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
24
23
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.9.0
|
|
26
25
|
Description-Content-Type: text/markdown
|
|
27
26
|
License-File: LICENSE
|
|
28
27
|
Requires-Dist: filelock
|
|
29
28
|
Requires-Dist: fsspec>=2023.5.0
|
|
29
|
+
Requires-Dist: httpx<1,>=0.23.0
|
|
30
30
|
Requires-Dist: packaging>=20.9
|
|
31
31
|
Requires-Dist: pyyaml>=5.1
|
|
32
|
-
Requires-Dist:
|
|
32
|
+
Requires-Dist: shellingham
|
|
33
33
|
Requires-Dist: tqdm>=4.42.1
|
|
34
|
+
Requires-Dist: typer-slim
|
|
34
35
|
Requires-Dist: typing-extensions>=3.7.4.3
|
|
35
|
-
Requires-Dist: hf-xet<2.0.0,>=1.
|
|
36
|
+
Requires-Dist: hf-xet<2.0.0,>=1.2.0; platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "arm64" or platform_machine == "aarch64"
|
|
36
37
|
Provides-Extra: all
|
|
37
|
-
Requires-Dist: InquirerPy==0.3.4; extra == "all"
|
|
38
38
|
Requires-Dist: aiohttp; extra == "all"
|
|
39
39
|
Requires-Dist: authlib>=1.3.2; extra == "all"
|
|
40
40
|
Requires-Dist: fastapi; extra == "all"
|
|
@@ -42,7 +42,7 @@ Requires-Dist: httpx; extra == "all"
|
|
|
42
42
|
Requires-Dist: itsdangerous; extra == "all"
|
|
43
43
|
Requires-Dist: jedi; extra == "all"
|
|
44
44
|
Requires-Dist: Jinja2; extra == "all"
|
|
45
|
-
Requires-Dist: pytest
|
|
45
|
+
Requires-Dist: pytest>=8.4.2; extra == "all"
|
|
46
46
|
Requires-Dist: pytest-cov; extra == "all"
|
|
47
47
|
Requires-Dist: pytest-env; extra == "all"
|
|
48
48
|
Requires-Dist: pytest-xdist; extra == "all"
|
|
@@ -53,24 +53,19 @@ Requires-Dist: pytest-mock; extra == "all"
|
|
|
53
53
|
Requires-Dist: urllib3<2.0; extra == "all"
|
|
54
54
|
Requires-Dist: soundfile; extra == "all"
|
|
55
55
|
Requires-Dist: Pillow; extra == "all"
|
|
56
|
-
Requires-Dist:
|
|
56
|
+
Requires-Dist: requests; extra == "all"
|
|
57
57
|
Requires-Dist: numpy; extra == "all"
|
|
58
58
|
Requires-Dist: ruff>=0.9.0; extra == "all"
|
|
59
|
+
Requires-Dist: mypy==1.15.0; extra == "all"
|
|
59
60
|
Requires-Dist: libcst>=1.4.0; extra == "all"
|
|
60
61
|
Requires-Dist: ty; extra == "all"
|
|
61
62
|
Requires-Dist: typing-extensions>=4.8.0; extra == "all"
|
|
62
63
|
Requires-Dist: types-PyYAML; extra == "all"
|
|
63
|
-
Requires-Dist: types-requests; extra == "all"
|
|
64
64
|
Requires-Dist: types-simplejson; extra == "all"
|
|
65
65
|
Requires-Dist: types-toml; extra == "all"
|
|
66
66
|
Requires-Dist: types-tqdm; extra == "all"
|
|
67
67
|
Requires-Dist: types-urllib3; extra == "all"
|
|
68
|
-
Requires-Dist: mypy<1.15.0,>=1.14.1; python_version == "3.8" and extra == "all"
|
|
69
|
-
Requires-Dist: mypy==1.15.0; python_version >= "3.9" and extra == "all"
|
|
70
|
-
Provides-Extra: cli
|
|
71
|
-
Requires-Dist: InquirerPy==0.3.4; extra == "cli"
|
|
72
68
|
Provides-Extra: dev
|
|
73
|
-
Requires-Dist: InquirerPy==0.3.4; extra == "dev"
|
|
74
69
|
Requires-Dist: aiohttp; extra == "dev"
|
|
75
70
|
Requires-Dist: authlib>=1.3.2; extra == "dev"
|
|
76
71
|
Requires-Dist: fastapi; extra == "dev"
|
|
@@ -78,7 +73,7 @@ Requires-Dist: httpx; extra == "dev"
|
|
|
78
73
|
Requires-Dist: itsdangerous; extra == "dev"
|
|
79
74
|
Requires-Dist: jedi; extra == "dev"
|
|
80
75
|
Requires-Dist: Jinja2; extra == "dev"
|
|
81
|
-
Requires-Dist: pytest
|
|
76
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
82
77
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
83
78
|
Requires-Dist: pytest-env; extra == "dev"
|
|
84
79
|
Requires-Dist: pytest-xdist; extra == "dev"
|
|
@@ -89,28 +84,24 @@ Requires-Dist: pytest-mock; extra == "dev"
|
|
|
89
84
|
Requires-Dist: urllib3<2.0; extra == "dev"
|
|
90
85
|
Requires-Dist: soundfile; extra == "dev"
|
|
91
86
|
Requires-Dist: Pillow; extra == "dev"
|
|
92
|
-
Requires-Dist:
|
|
87
|
+
Requires-Dist: requests; extra == "dev"
|
|
93
88
|
Requires-Dist: numpy; extra == "dev"
|
|
94
89
|
Requires-Dist: ruff>=0.9.0; extra == "dev"
|
|
90
|
+
Requires-Dist: mypy==1.15.0; extra == "dev"
|
|
95
91
|
Requires-Dist: libcst>=1.4.0; extra == "dev"
|
|
96
92
|
Requires-Dist: ty; extra == "dev"
|
|
97
93
|
Requires-Dist: typing-extensions>=4.8.0; extra == "dev"
|
|
98
94
|
Requires-Dist: types-PyYAML; extra == "dev"
|
|
99
|
-
Requires-Dist: types-requests; extra == "dev"
|
|
100
95
|
Requires-Dist: types-simplejson; extra == "dev"
|
|
101
96
|
Requires-Dist: types-toml; extra == "dev"
|
|
102
97
|
Requires-Dist: types-tqdm; extra == "dev"
|
|
103
98
|
Requires-Dist: types-urllib3; extra == "dev"
|
|
104
|
-
Requires-Dist: mypy<1.15.0,>=1.14.1; python_version == "3.8" and extra == "dev"
|
|
105
|
-
Requires-Dist: mypy==1.15.0; python_version >= "3.9" and extra == "dev"
|
|
106
99
|
Provides-Extra: fastai
|
|
107
100
|
Requires-Dist: toml; extra == "fastai"
|
|
108
101
|
Requires-Dist: fastai>=2.4; extra == "fastai"
|
|
109
102
|
Requires-Dist: fastcore>=1.3.27; extra == "fastai"
|
|
110
|
-
Provides-Extra: hf_transfer
|
|
111
|
-
Requires-Dist: hf-transfer>=0.1.4; extra == "hf-transfer"
|
|
112
103
|
Provides-Extra: hf_xet
|
|
113
|
-
Requires-Dist: hf-xet<2.0.0,>=1.1.
|
|
104
|
+
Requires-Dist: hf-xet<2.0.0,>=1.1.3; extra == "hf-xet"
|
|
114
105
|
Provides-Extra: inference
|
|
115
106
|
Requires-Dist: aiohttp; extra == "inference"
|
|
116
107
|
Provides-Extra: mcp
|
|
@@ -124,19 +115,10 @@ Requires-Dist: httpx; extra == "oauth"
|
|
|
124
115
|
Requires-Dist: itsdangerous; extra == "oauth"
|
|
125
116
|
Provides-Extra: quality
|
|
126
117
|
Requires-Dist: ruff>=0.9.0; extra == "quality"
|
|
118
|
+
Requires-Dist: mypy==1.15.0; extra == "quality"
|
|
127
119
|
Requires-Dist: libcst>=1.4.0; extra == "quality"
|
|
128
120
|
Requires-Dist: ty; extra == "quality"
|
|
129
|
-
Requires-Dist: mypy<1.15.0,>=1.14.1; python_version == "3.8" and extra == "quality"
|
|
130
|
-
Requires-Dist: mypy==1.15.0; python_version >= "3.9" and extra == "quality"
|
|
131
|
-
Provides-Extra: tensorflow
|
|
132
|
-
Requires-Dist: tensorflow; extra == "tensorflow"
|
|
133
|
-
Requires-Dist: pydot; extra == "tensorflow"
|
|
134
|
-
Requires-Dist: graphviz; extra == "tensorflow"
|
|
135
|
-
Provides-Extra: tensorflow-testing
|
|
136
|
-
Requires-Dist: tensorflow; extra == "tensorflow-testing"
|
|
137
|
-
Requires-Dist: keras<3.0; extra == "tensorflow-testing"
|
|
138
121
|
Provides-Extra: testing
|
|
139
|
-
Requires-Dist: InquirerPy==0.3.4; extra == "testing"
|
|
140
122
|
Requires-Dist: aiohttp; extra == "testing"
|
|
141
123
|
Requires-Dist: authlib>=1.3.2; extra == "testing"
|
|
142
124
|
Requires-Dist: fastapi; extra == "testing"
|
|
@@ -144,7 +126,7 @@ Requires-Dist: httpx; extra == "testing"
|
|
|
144
126
|
Requires-Dist: itsdangerous; extra == "testing"
|
|
145
127
|
Requires-Dist: jedi; extra == "testing"
|
|
146
128
|
Requires-Dist: Jinja2; extra == "testing"
|
|
147
|
-
Requires-Dist: pytest
|
|
129
|
+
Requires-Dist: pytest>=8.4.2; extra == "testing"
|
|
148
130
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
149
131
|
Requires-Dist: pytest-env; extra == "testing"
|
|
150
132
|
Requires-Dist: pytest-xdist; extra == "testing"
|
|
@@ -155,7 +137,7 @@ Requires-Dist: pytest-mock; extra == "testing"
|
|
|
155
137
|
Requires-Dist: urllib3<2.0; extra == "testing"
|
|
156
138
|
Requires-Dist: soundfile; extra == "testing"
|
|
157
139
|
Requires-Dist: Pillow; extra == "testing"
|
|
158
|
-
Requires-Dist:
|
|
140
|
+
Requires-Dist: requests; extra == "testing"
|
|
159
141
|
Requires-Dist: numpy; extra == "testing"
|
|
160
142
|
Provides-Extra: torch
|
|
161
143
|
Requires-Dist: torch; extra == "torch"
|
|
@@ -163,7 +145,6 @@ Requires-Dist: safetensors[torch]; extra == "torch"
|
|
|
163
145
|
Provides-Extra: typing
|
|
164
146
|
Requires-Dist: typing-extensions>=4.8.0; extra == "typing"
|
|
165
147
|
Requires-Dist: types-PyYAML; extra == "typing"
|
|
166
|
-
Requires-Dist: types-requests; extra == "typing"
|
|
167
148
|
Requires-Dist: types-simplejson; extra == "typing"
|
|
168
149
|
Requires-Dist: types-toml; extra == "typing"
|
|
169
150
|
Requires-Dist: types-tqdm; extra == "typing"
|