huggingface-hub 0.29.0rc2__py3-none-any.whl → 1.1.3__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.
- huggingface_hub/__init__.py +160 -46
- huggingface_hub/_commit_api.py +277 -71
- huggingface_hub/_commit_scheduler.py +15 -15
- huggingface_hub/_inference_endpoints.py +33 -22
- huggingface_hub/_jobs_api.py +301 -0
- huggingface_hub/_local_folder.py +18 -3
- huggingface_hub/_login.py +31 -63
- huggingface_hub/_oauth.py +460 -0
- huggingface_hub/_snapshot_download.py +241 -81
- huggingface_hub/_space_api.py +18 -10
- huggingface_hub/_tensorboard_logger.py +15 -19
- huggingface_hub/_upload_large_folder.py +196 -76
- huggingface_hub/_webhooks_payload.py +3 -3
- huggingface_hub/_webhooks_server.py +15 -25
- huggingface_hub/{commands → cli}/__init__.py +1 -15
- huggingface_hub/cli/_cli_utils.py +173 -0
- huggingface_hub/cli/auth.py +147 -0
- huggingface_hub/cli/cache.py +841 -0
- huggingface_hub/cli/download.py +189 -0
- huggingface_hub/cli/hf.py +60 -0
- huggingface_hub/cli/inference_endpoints.py +377 -0
- huggingface_hub/cli/jobs.py +772 -0
- huggingface_hub/cli/lfs.py +175 -0
- huggingface_hub/cli/repo.py +315 -0
- huggingface_hub/cli/repo_files.py +94 -0
- huggingface_hub/{commands/env.py → cli/system.py} +10 -13
- huggingface_hub/cli/upload.py +294 -0
- huggingface_hub/cli/upload_large_folder.py +117 -0
- huggingface_hub/community.py +20 -12
- huggingface_hub/constants.py +83 -59
- huggingface_hub/dataclasses.py +609 -0
- huggingface_hub/errors.py +99 -30
- huggingface_hub/fastai_utils.py +30 -41
- huggingface_hub/file_download.py +606 -346
- huggingface_hub/hf_api.py +2445 -1132
- huggingface_hub/hf_file_system.py +269 -152
- huggingface_hub/hub_mixin.py +61 -66
- huggingface_hub/inference/_client.py +501 -630
- huggingface_hub/inference/_common.py +133 -121
- huggingface_hub/inference/_generated/_async_client.py +536 -722
- huggingface_hub/inference/_generated/types/__init__.py +6 -1
- huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +5 -6
- huggingface_hub/inference/_generated/types/base.py +10 -7
- huggingface_hub/inference/_generated/types/chat_completion.py +77 -31
- 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/image_to_image.py +8 -2
- huggingface_hub/inference/_generated/types/image_to_text.py +2 -3
- huggingface_hub/inference/_generated/types/image_to_video.py +60 -0
- 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 +5 -5
- huggingface_hub/inference/_generated/types/text2text_generation.py +2 -2
- huggingface_hub/inference/_generated/types/text_generation.py +11 -11
- huggingface_hub/inference/_generated/types/text_to_audio.py +1 -2
- huggingface_hub/inference/_generated/types/text_to_speech.py +1 -2
- 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/__init__.py +0 -0
- huggingface_hub/inference/_mcp/_cli_hacks.py +88 -0
- huggingface_hub/inference/_mcp/agent.py +100 -0
- huggingface_hub/inference/_mcp/cli.py +247 -0
- huggingface_hub/inference/_mcp/constants.py +81 -0
- huggingface_hub/inference/_mcp/mcp_client.py +395 -0
- huggingface_hub/inference/_mcp/types.py +45 -0
- huggingface_hub/inference/_mcp/utils.py +128 -0
- huggingface_hub/inference/_providers/__init__.py +149 -20
- huggingface_hub/inference/_providers/_common.py +160 -37
- huggingface_hub/inference/_providers/black_forest_labs.py +12 -9
- huggingface_hub/inference/_providers/cerebras.py +6 -0
- huggingface_hub/inference/_providers/clarifai.py +13 -0
- huggingface_hub/inference/_providers/cohere.py +32 -0
- huggingface_hub/inference/_providers/fal_ai.py +231 -22
- huggingface_hub/inference/_providers/featherless_ai.py +38 -0
- huggingface_hub/inference/_providers/fireworks_ai.py +22 -1
- huggingface_hub/inference/_providers/groq.py +9 -0
- huggingface_hub/inference/_providers/hf_inference.py +143 -33
- huggingface_hub/inference/_providers/hyperbolic.py +9 -5
- huggingface_hub/inference/_providers/nebius.py +47 -5
- huggingface_hub/inference/_providers/novita.py +48 -5
- huggingface_hub/inference/_providers/nscale.py +44 -0
- huggingface_hub/inference/_providers/openai.py +25 -0
- huggingface_hub/inference/_providers/publicai.py +6 -0
- huggingface_hub/inference/_providers/replicate.py +46 -9
- huggingface_hub/inference/_providers/sambanova.py +37 -1
- huggingface_hub/inference/_providers/scaleway.py +28 -0
- huggingface_hub/inference/_providers/together.py +34 -5
- huggingface_hub/inference/_providers/wavespeed.py +138 -0
- huggingface_hub/inference/_providers/zai_org.py +17 -0
- huggingface_hub/lfs.py +33 -100
- huggingface_hub/repocard.py +34 -38
- huggingface_hub/repocard_data.py +79 -59
- huggingface_hub/serialization/__init__.py +0 -1
- huggingface_hub/serialization/_base.py +12 -15
- huggingface_hub/serialization/_dduf.py +8 -8
- huggingface_hub/serialization/_torch.py +69 -69
- huggingface_hub/utils/__init__.py +27 -8
- huggingface_hub/utils/_auth.py +7 -7
- huggingface_hub/utils/_cache_manager.py +92 -147
- huggingface_hub/utils/_chunk_utils.py +2 -3
- huggingface_hub/utils/_deprecation.py +1 -1
- huggingface_hub/utils/_dotenv.py +55 -0
- huggingface_hub/utils/_experimental.py +7 -5
- huggingface_hub/utils/_fixes.py +0 -10
- huggingface_hub/utils/_git_credential.py +5 -5
- huggingface_hub/utils/_headers.py +8 -30
- huggingface_hub/utils/_http.py +399 -237
- huggingface_hub/utils/_pagination.py +6 -6
- huggingface_hub/utils/_parsing.py +98 -0
- huggingface_hub/utils/_paths.py +5 -5
- huggingface_hub/utils/_runtime.py +74 -22
- huggingface_hub/utils/_safetensors.py +21 -21
- huggingface_hub/utils/_subprocess.py +13 -11
- huggingface_hub/utils/_telemetry.py +4 -4
- huggingface_hub/{commands/_cli_utils.py → utils/_terminal.py} +4 -4
- huggingface_hub/utils/_typing.py +25 -5
- huggingface_hub/utils/_validators.py +55 -74
- huggingface_hub/utils/_verification.py +167 -0
- huggingface_hub/utils/_xet.py +235 -0
- huggingface_hub/utils/_xet_progress_reporting.py +162 -0
- huggingface_hub/utils/insecure_hashlib.py +3 -5
- huggingface_hub/utils/logging.py +8 -11
- huggingface_hub/utils/tqdm.py +33 -4
- {huggingface_hub-0.29.0rc2.dist-info → huggingface_hub-1.1.3.dist-info}/METADATA +94 -82
- huggingface_hub-1.1.3.dist-info/RECORD +155 -0
- {huggingface_hub-0.29.0rc2.dist-info → huggingface_hub-1.1.3.dist-info}/WHEEL +1 -1
- huggingface_hub-1.1.3.dist-info/entry_points.txt +6 -0
- huggingface_hub/commands/delete_cache.py +0 -428
- huggingface_hub/commands/download.py +0 -200
- huggingface_hub/commands/huggingface_cli.py +0 -61
- huggingface_hub/commands/lfs.py +0 -200
- huggingface_hub/commands/repo_files.py +0 -128
- huggingface_hub/commands/scan_cache.py +0 -181
- huggingface_hub/commands/tag.py +0 -159
- huggingface_hub/commands/upload.py +0 -299
- huggingface_hub/commands/upload_large_folder.py +0 -129
- huggingface_hub/commands/user.py +0 -304
- huggingface_hub/commands/version.py +0 -37
- huggingface_hub/inference_api.py +0 -217
- huggingface_hub/keras_mixin.py +0 -500
- huggingface_hub/repository.py +0 -1477
- huggingface_hub/serialization/_tensorflow.py +0 -95
- huggingface_hub/utils/_hf_folder.py +0 -68
- huggingface_hub-0.29.0rc2.dist-info/RECORD +0 -131
- huggingface_hub-0.29.0rc2.dist-info/entry_points.txt +0 -6
- {huggingface_hub-0.29.0rc2.dist-info → huggingface_hub-1.1.3.dist-info/licenses}/LICENSE +0 -0
- {huggingface_hub-0.29.0rc2.dist-info → huggingface_hub-1.1.3.dist-info}/top_level.txt +0 -0
|
@@ -14,43 +14,30 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
"""Contains utilities to handle headers to send in calls to Huggingface Hub."""
|
|
16
16
|
|
|
17
|
-
from typing import
|
|
17
|
+
from typing import Optional, Union
|
|
18
18
|
|
|
19
19
|
from huggingface_hub.errors import LocalTokenNotFoundError
|
|
20
20
|
|
|
21
21
|
from .. import constants
|
|
22
22
|
from ._auth import get_token
|
|
23
|
-
from ._deprecation import _deprecate_arguments
|
|
24
23
|
from ._runtime import (
|
|
25
|
-
get_fastai_version,
|
|
26
|
-
get_fastcore_version,
|
|
27
24
|
get_hf_hub_version,
|
|
28
25
|
get_python_version,
|
|
29
|
-
get_tf_version,
|
|
30
26
|
get_torch_version,
|
|
31
|
-
is_fastai_available,
|
|
32
|
-
is_fastcore_available,
|
|
33
|
-
is_tf_available,
|
|
34
27
|
is_torch_available,
|
|
35
28
|
)
|
|
36
29
|
from ._validators import validate_hf_hub_args
|
|
37
30
|
|
|
38
31
|
|
|
39
|
-
@_deprecate_arguments(
|
|
40
|
-
version="1.0",
|
|
41
|
-
deprecated_args="is_write_action",
|
|
42
|
-
custom_message="This argument is ignored and we let the server handle the permission error instead (if any).",
|
|
43
|
-
)
|
|
44
32
|
@validate_hf_hub_args
|
|
45
33
|
def build_hf_headers(
|
|
46
34
|
*,
|
|
47
35
|
token: Optional[Union[bool, str]] = None,
|
|
48
36
|
library_name: Optional[str] = None,
|
|
49
37
|
library_version: Optional[str] = None,
|
|
50
|
-
user_agent: Union[
|
|
51
|
-
headers: Optional[
|
|
52
|
-
|
|
53
|
-
) -> Dict[str, str]:
|
|
38
|
+
user_agent: Union[dict, str, None] = None,
|
|
39
|
+
headers: Optional[dict[str, str]] = None,
|
|
40
|
+
) -> dict[str, str]:
|
|
54
41
|
"""
|
|
55
42
|
Build headers dictionary to send in a HF Hub call.
|
|
56
43
|
|
|
@@ -63,8 +50,7 @@ def build_hf_headers(
|
|
|
63
50
|
`None` or token is an organization token (starting with `"api_org***"`).
|
|
64
51
|
|
|
65
52
|
In addition to the auth header, a user-agent is added to provide information about
|
|
66
|
-
the installed packages (versions of python, huggingface_hub, torch
|
|
67
|
-
fastai and fastcore).
|
|
53
|
+
the installed packages (versions of python, huggingface_hub, torch).
|
|
68
54
|
|
|
69
55
|
Args:
|
|
70
56
|
token (`str`, `bool`, *optional*):
|
|
@@ -86,11 +72,9 @@ def build_hf_headers(
|
|
|
86
72
|
headers (`dict`, *optional*):
|
|
87
73
|
Additional headers to include in the request. Those headers take precedence
|
|
88
74
|
over the ones generated by this function.
|
|
89
|
-
is_write_action (`bool`):
|
|
90
|
-
Ignored and deprecated argument.
|
|
91
75
|
|
|
92
76
|
Returns:
|
|
93
|
-
A `
|
|
77
|
+
A `dict` of headers to pass in your API call.
|
|
94
78
|
|
|
95
79
|
Example:
|
|
96
80
|
```py
|
|
@@ -159,7 +143,7 @@ def get_token_to_send(token: Optional[Union[bool, str]]) -> Optional[str]:
|
|
|
159
143
|
raise LocalTokenNotFoundError(
|
|
160
144
|
"Token is required (`token=True`), but no token found. You"
|
|
161
145
|
" need to provide a token or be logged in to Hugging Face with"
|
|
162
|
-
" `
|
|
146
|
+
" `hf auth login` or `huggingface_hub.login`. See"
|
|
163
147
|
" https://huggingface.co/settings/tokens."
|
|
164
148
|
)
|
|
165
149
|
return cached_token
|
|
@@ -176,7 +160,7 @@ def _http_user_agent(
|
|
|
176
160
|
*,
|
|
177
161
|
library_name: Optional[str] = None,
|
|
178
162
|
library_version: Optional[str] = None,
|
|
179
|
-
user_agent: Union[
|
|
163
|
+
user_agent: Union[dict, str, None] = None,
|
|
180
164
|
) -> str:
|
|
181
165
|
"""Format a user-agent string containing information about the installed packages.
|
|
182
166
|
|
|
@@ -201,12 +185,6 @@ def _http_user_agent(
|
|
|
201
185
|
if not constants.HF_HUB_DISABLE_TELEMETRY:
|
|
202
186
|
if is_torch_available():
|
|
203
187
|
ua += f"; torch/{get_torch_version()}"
|
|
204
|
-
if is_tf_available():
|
|
205
|
-
ua += f"; tensorflow/{get_tf_version()}"
|
|
206
|
-
if is_fastai_available():
|
|
207
|
-
ua += f"; fastai/{get_fastai_version()}"
|
|
208
|
-
if is_fastcore_available():
|
|
209
|
-
ua += f"; fastcore/{get_fastcore_version()}"
|
|
210
188
|
|
|
211
189
|
if isinstance(user_agent, dict):
|
|
212
190
|
ua += "; " + "; ".join(f"{k}/{v}" for k, v in user_agent.items())
|