huggingface-hub 1.0.0rc3__py3-none-any.whl → 1.0.0rc5__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 +1 -1
- huggingface_hub/_login.py +1 -1
- huggingface_hub/cli/_cli_utils.py +76 -55
- huggingface_hub/cli/auth.py +2 -2
- huggingface_hub/cli/cache.py +2 -2
- huggingface_hub/cli/download.py +2 -2
- huggingface_hub/cli/hf.py +2 -1
- huggingface_hub/cli/repo.py +1 -2
- huggingface_hub/cli/system.py +1 -1
- huggingface_hub/cli/upload_large_folder.py +2 -2
- huggingface_hub/constants.py +4 -0
- huggingface_hub/dataclasses.py +2 -2
- huggingface_hub/utils/__init__.py +2 -0
- huggingface_hub/utils/_cache_manager.py +1 -1
- huggingface_hub/utils/_http.py +10 -3
- huggingface_hub/utils/_runtime.py +48 -1
- huggingface_hub/utils/_terminal.py +69 -0
- {huggingface_hub-1.0.0rc3.dist-info → huggingface_hub-1.0.0rc5.dist-info}/METADATA +1 -1
- {huggingface_hub-1.0.0rc3.dist-info → huggingface_hub-1.0.0rc5.dist-info}/RECORD +23 -22
- {huggingface_hub-1.0.0rc3.dist-info → huggingface_hub-1.0.0rc5.dist-info}/LICENSE +0 -0
- {huggingface_hub-1.0.0rc3.dist-info → huggingface_hub-1.0.0rc5.dist-info}/WHEEL +0 -0
- {huggingface_hub-1.0.0rc3.dist-info → huggingface_hub-1.0.0rc5.dist-info}/entry_points.txt +0 -0
- {huggingface_hub-1.0.0rc3.dist-info → huggingface_hub-1.0.0rc5.dist-info}/top_level.txt +0 -0
huggingface_hub/__init__.py
CHANGED
huggingface_hub/_login.py
CHANGED
|
@@ -13,14 +13,21 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
"""Contains CLI utilities (styling, helpers)."""
|
|
15
15
|
|
|
16
|
+
import importlib.metadata
|
|
16
17
|
import os
|
|
18
|
+
import time
|
|
17
19
|
from enum import Enum
|
|
18
|
-
from
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import TYPE_CHECKING, Annotated, Optional
|
|
19
22
|
|
|
20
23
|
import click
|
|
21
24
|
import typer
|
|
22
25
|
|
|
23
|
-
from huggingface_hub import __version__
|
|
26
|
+
from huggingface_hub import __version__, constants
|
|
27
|
+
from huggingface_hub.utils import ANSI, get_session, hf_raise_for_status, installation_method, logging
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
logger = logging.get_logger()
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
if TYPE_CHECKING:
|
|
@@ -34,58 +41,6 @@ def get_hf_api(token: Optional[str] = None) -> "HfApi":
|
|
|
34
41
|
return HfApi(token=token, library_name="hf", library_version=__version__)
|
|
35
42
|
|
|
36
43
|
|
|
37
|
-
class ANSI:
|
|
38
|
-
"""
|
|
39
|
-
Helper for en.wikipedia.org/wiki/ANSI_escape_code
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
_bold = "\u001b[1m"
|
|
43
|
-
_gray = "\u001b[90m"
|
|
44
|
-
_red = "\u001b[31m"
|
|
45
|
-
_reset = "\u001b[0m"
|
|
46
|
-
_yellow = "\u001b[33m"
|
|
47
|
-
|
|
48
|
-
@classmethod
|
|
49
|
-
def bold(cls, s: str) -> str:
|
|
50
|
-
return cls._format(s, cls._bold)
|
|
51
|
-
|
|
52
|
-
@classmethod
|
|
53
|
-
def gray(cls, s: str) -> str:
|
|
54
|
-
return cls._format(s, cls._gray)
|
|
55
|
-
|
|
56
|
-
@classmethod
|
|
57
|
-
def red(cls, s: str) -> str:
|
|
58
|
-
return cls._format(s, cls._bold + cls._red)
|
|
59
|
-
|
|
60
|
-
@classmethod
|
|
61
|
-
def yellow(cls, s: str) -> str:
|
|
62
|
-
return cls._format(s, cls._yellow)
|
|
63
|
-
|
|
64
|
-
@classmethod
|
|
65
|
-
def _format(cls, s: str, code: str) -> str:
|
|
66
|
-
if os.environ.get("NO_COLOR"):
|
|
67
|
-
# See https://no-color.org/
|
|
68
|
-
return s
|
|
69
|
-
return f"{code}{s}{cls._reset}"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def tabulate(rows: list[list[Union[str, int]]], headers: list[str]) -> str:
|
|
73
|
-
"""
|
|
74
|
-
Inspired by:
|
|
75
|
-
|
|
76
|
-
- stackoverflow.com/a/8356620/593036
|
|
77
|
-
- stackoverflow.com/questions/9535954/printing-lists-as-tabular-data
|
|
78
|
-
"""
|
|
79
|
-
col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)]
|
|
80
|
-
row_format = ("{{:{}}} " * len(headers)).format(*col_widths)
|
|
81
|
-
lines = []
|
|
82
|
-
lines.append(row_format.format(*headers))
|
|
83
|
-
lines.append(row_format.format(*["-" * w for w in col_widths]))
|
|
84
|
-
for row in rows:
|
|
85
|
-
lines.append(row_format.format(*row))
|
|
86
|
-
return "\n".join(lines)
|
|
87
|
-
|
|
88
|
-
|
|
89
44
|
#### TYPER UTILS
|
|
90
45
|
|
|
91
46
|
|
|
@@ -103,9 +58,12 @@ def typer_factory(help: str) -> typer.Typer:
|
|
|
103
58
|
return typer.Typer(
|
|
104
59
|
help=help,
|
|
105
60
|
add_completion=True,
|
|
106
|
-
rich_markup_mode=None,
|
|
107
61
|
no_args_is_help=True,
|
|
108
62
|
cls=AlphabeticalMixedGroup,
|
|
63
|
+
# Disable rich completely for consistent experience
|
|
64
|
+
rich_markup_mode=None,
|
|
65
|
+
rich_help_panel=None,
|
|
66
|
+
pretty_exceptions_enable=False,
|
|
109
67
|
)
|
|
110
68
|
|
|
111
69
|
|
|
@@ -150,3 +108,66 @@ RevisionOpt = Annotated[
|
|
|
150
108
|
help="Git revision id which can be a branch name, a tag, or a commit hash.",
|
|
151
109
|
),
|
|
152
110
|
]
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### PyPI VERSION CHECKER
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def check_cli_update() -> None:
|
|
117
|
+
"""
|
|
118
|
+
Check whether a newer version of `huggingface_hub` is available on PyPI.
|
|
119
|
+
|
|
120
|
+
If a newer version is found, notify the user and suggest updating.
|
|
121
|
+
If current version is a pre-release (e.g. `1.0.0.rc1`), or a dev version (e.g. `1.0.0.dev1`), no check is performed.
|
|
122
|
+
|
|
123
|
+
This function is called at the entry point of the CLI. It only performs the check once every 24 hours, and any error
|
|
124
|
+
during the check is caught and logged, to avoid breaking the CLI.
|
|
125
|
+
"""
|
|
126
|
+
try:
|
|
127
|
+
_check_cli_update()
|
|
128
|
+
except Exception:
|
|
129
|
+
# We don't want the CLI to fail on version checks, no matter the reason.
|
|
130
|
+
logger.debug("Error while checking for CLI update.", exc_info=True)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _check_cli_update() -> None:
|
|
134
|
+
current_version = importlib.metadata.version("huggingface_hub")
|
|
135
|
+
|
|
136
|
+
# Skip if current version is a pre-release or dev version
|
|
137
|
+
if any(tag in current_version for tag in ["rc", "dev"]):
|
|
138
|
+
return
|
|
139
|
+
|
|
140
|
+
# Skip if already checked in the last 24 hours
|
|
141
|
+
if os.path.exists(constants.CHECK_FOR_UPDATE_DONE_PATH):
|
|
142
|
+
mtime = os.path.getmtime(constants.CHECK_FOR_UPDATE_DONE_PATH)
|
|
143
|
+
if (time.time() - mtime) < 24 * 3600:
|
|
144
|
+
return
|
|
145
|
+
|
|
146
|
+
# Touch the file to mark that we did the check now
|
|
147
|
+
Path(constants.CHECK_FOR_UPDATE_DONE_PATH).touch()
|
|
148
|
+
|
|
149
|
+
# Check latest version from PyPI
|
|
150
|
+
response = get_session().get("https://pypi.org/pypi/huggingface_hub/json", timeout=2)
|
|
151
|
+
hf_raise_for_status(response)
|
|
152
|
+
data = response.json()
|
|
153
|
+
latest_version = data["info"]["version"]
|
|
154
|
+
|
|
155
|
+
# If latest version is different from current, notify user
|
|
156
|
+
if current_version != latest_version:
|
|
157
|
+
method = installation_method()
|
|
158
|
+
if method == "brew":
|
|
159
|
+
update_command = "brew upgrade huggingface-cli"
|
|
160
|
+
elif method == "hf_installer" and os.name == "nt":
|
|
161
|
+
update_command = 'powershell -NoProfile -Command "iwr -useb https://hf.co/cli/install.ps1 | iex"'
|
|
162
|
+
elif method == "hf_installer":
|
|
163
|
+
update_command = "curl -LsSf https://hf.co/cli/install.sh | sh -"
|
|
164
|
+
else: # unknown => likely pip
|
|
165
|
+
update_command = "pip install -U huggingface_hub"
|
|
166
|
+
|
|
167
|
+
click.echo(
|
|
168
|
+
ANSI.yellow(
|
|
169
|
+
f"A new version of huggingface_hub ({latest_version}) is available! "
|
|
170
|
+
f"You are using version {current_version}.\n"
|
|
171
|
+
f"To update, run: {ANSI.bold(update_command)}\n",
|
|
172
|
+
)
|
|
173
|
+
)
|
huggingface_hub/cli/auth.py
CHANGED
|
@@ -39,8 +39,8 @@ from huggingface_hub.errors import HfHubHTTPError
|
|
|
39
39
|
from huggingface_hub.hf_api import whoami
|
|
40
40
|
|
|
41
41
|
from .._login import auth_list, auth_switch, login, logout
|
|
42
|
-
from ..utils import get_stored_tokens, get_token, logging
|
|
43
|
-
from ._cli_utils import
|
|
42
|
+
from ..utils import ANSI, get_stored_tokens, get_token, logging
|
|
43
|
+
from ._cli_utils import TokenOpt, typer_factory
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
logger = logging.get_logger(__name__)
|
huggingface_hub/cli/cache.py
CHANGED
|
@@ -23,8 +23,8 @@ from typing import Annotated, Any, Callable, Iterable, Optional, Union
|
|
|
23
23
|
|
|
24
24
|
import typer
|
|
25
25
|
|
|
26
|
-
from ..utils import CachedRepoInfo, CachedRevisionInfo, CacheNotFound, HFCacheInfo, scan_cache_dir
|
|
27
|
-
from ._cli_utils import
|
|
26
|
+
from ..utils import ANSI, CachedRepoInfo, CachedRevisionInfo, CacheNotFound, HFCacheInfo, scan_cache_dir, tabulate
|
|
27
|
+
from ._cli_utils import typer_factory
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
# --- DELETE helpers (from delete_cache.py) ---
|
huggingface_hub/cli/download.py
CHANGED
|
@@ -44,9 +44,9 @@ import typer
|
|
|
44
44
|
from huggingface_hub import logging
|
|
45
45
|
from huggingface_hub._snapshot_download import snapshot_download
|
|
46
46
|
from huggingface_hub.file_download import DryRunFileInfo, hf_hub_download
|
|
47
|
-
from huggingface_hub.utils import _format_size, disable_progress_bars, enable_progress_bars
|
|
47
|
+
from huggingface_hub.utils import _format_size, disable_progress_bars, enable_progress_bars, tabulate
|
|
48
48
|
|
|
49
|
-
from ._cli_utils import RepoIdArg, RepoTypeOpt, RevisionOpt, TokenOpt
|
|
49
|
+
from ._cli_utils import RepoIdArg, RepoTypeOpt, RevisionOpt, TokenOpt
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
logger = logging.get_logger(__name__)
|
huggingface_hub/cli/hf.py
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
from huggingface_hub.cli._cli_utils import typer_factory
|
|
16
|
+
from huggingface_hub.cli._cli_utils import check_cli_update, typer_factory
|
|
17
17
|
from huggingface_hub.cli.auth import auth_cli
|
|
18
18
|
from huggingface_hub.cli.cache import cache_cli
|
|
19
19
|
from huggingface_hub.cli.download import download
|
|
@@ -52,6 +52,7 @@ app.add_typer(jobs_cli, name="jobs")
|
|
|
52
52
|
|
|
53
53
|
def main():
|
|
54
54
|
logging.set_verbosity_info()
|
|
55
|
+
check_cli_update()
|
|
55
56
|
app()
|
|
56
57
|
|
|
57
58
|
|
huggingface_hub/cli/repo.py
CHANGED
|
@@ -27,10 +27,9 @@ from typing import Annotated, Optional
|
|
|
27
27
|
import typer
|
|
28
28
|
|
|
29
29
|
from huggingface_hub.errors import HfHubHTTPError, RepositoryNotFoundError, RevisionNotFoundError
|
|
30
|
-
from huggingface_hub.utils import logging
|
|
30
|
+
from huggingface_hub.utils import ANSI, logging
|
|
31
31
|
|
|
32
32
|
from ._cli_utils import (
|
|
33
|
-
ANSI,
|
|
34
33
|
PrivateOpt,
|
|
35
34
|
RepoIdArg,
|
|
36
35
|
RepoType,
|
huggingface_hub/cli/system.py
CHANGED
|
@@ -20,9 +20,9 @@ from typing import Annotated, Optional
|
|
|
20
20
|
import typer
|
|
21
21
|
|
|
22
22
|
from huggingface_hub import logging
|
|
23
|
-
from huggingface_hub.utils import disable_progress_bars
|
|
23
|
+
from huggingface_hub.utils import ANSI, disable_progress_bars
|
|
24
24
|
|
|
25
|
-
from ._cli_utils import
|
|
25
|
+
from ._cli_utils import PrivateOpt, RepoIdArg, RepoType, RepoTypeOpt, RevisionOpt, TokenOpt, get_hf_api
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
logger = logging.get_logger(__name__)
|
huggingface_hub/constants.py
CHANGED
|
@@ -163,6 +163,10 @@ HF_ASSETS_CACHE = os.path.expandvars(
|
|
|
163
163
|
|
|
164
164
|
HF_HUB_OFFLINE = _is_true(os.environ.get("HF_HUB_OFFLINE") or os.environ.get("TRANSFORMERS_OFFLINE"))
|
|
165
165
|
|
|
166
|
+
# File created to mark that the version check has been done.
|
|
167
|
+
# Check is performed once per 24 hours at most.
|
|
168
|
+
CHECK_FOR_UPDATE_DONE_PATH = os.path.join(HF_HOME, ".check_for_update_done")
|
|
169
|
+
|
|
166
170
|
# If set, log level will be set to DEBUG and all requests made to the Hub will be logged
|
|
167
171
|
# as curl commands for reproducibility.
|
|
168
172
|
HF_DEBUG = _is_true(os.environ.get("HF_DEBUG"))
|
huggingface_hub/dataclasses.py
CHANGED
|
@@ -431,11 +431,11 @@ def type_validator(name: str, value: Any, expected_type: Any) -> None:
|
|
|
431
431
|
elif origin is Required:
|
|
432
432
|
if value is _TYPED_DICT_DEFAULT_VALUE:
|
|
433
433
|
raise TypeError(f"Field '{name}' is required but missing.")
|
|
434
|
-
|
|
434
|
+
type_validator(name, value, args[0])
|
|
435
435
|
elif origin is NotRequired:
|
|
436
436
|
if value is _TYPED_DICT_DEFAULT_VALUE:
|
|
437
437
|
return
|
|
438
|
-
|
|
438
|
+
type_validator(name, value, args[0])
|
|
439
439
|
else:
|
|
440
440
|
raise TypeError(f"Unsupported type for field '{name}': {expected_type}")
|
|
441
441
|
|
|
@@ -85,6 +85,7 @@ from ._runtime import (
|
|
|
85
85
|
get_tensorboard_version,
|
|
86
86
|
get_tf_version,
|
|
87
87
|
get_torch_version,
|
|
88
|
+
installation_method,
|
|
88
89
|
is_aiohttp_available,
|
|
89
90
|
is_colab_enterprise,
|
|
90
91
|
is_fastai_available,
|
|
@@ -109,6 +110,7 @@ from ._runtime import (
|
|
|
109
110
|
from ._safetensors import SafetensorsFileMetadata, SafetensorsRepoMetadata, TensorInfo
|
|
110
111
|
from ._subprocess import capture_output, run_interactive_subprocess, run_subprocess
|
|
111
112
|
from ._telemetry import send_telemetry
|
|
113
|
+
from ._terminal import ANSI, tabulate
|
|
112
114
|
from ._typing import is_jsonable, is_simple_optional_type, unwrap_simple_optional_type
|
|
113
115
|
from ._validators import validate_hf_hub_args, validate_repo_id
|
|
114
116
|
from ._xet import (
|
|
@@ -24,9 +24,9 @@ from typing import Literal, Optional, Union
|
|
|
24
24
|
|
|
25
25
|
from huggingface_hub.errors import CacheNotFound, CorruptedCacheException
|
|
26
26
|
|
|
27
|
-
from ..cli._cli_utils import tabulate
|
|
28
27
|
from ..constants import HF_HUB_CACHE
|
|
29
28
|
from . import logging
|
|
29
|
+
from ._terminal import tabulate
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
logger = logging.get_logger(__name__)
|
huggingface_hub/utils/_http.py
CHANGED
|
@@ -102,6 +102,13 @@ def hf_request_event_hook(request: httpx.Request) -> None:
|
|
|
102
102
|
return request_id
|
|
103
103
|
|
|
104
104
|
|
|
105
|
+
async def async_hf_request_event_hook(request: httpx.Request) -> None:
|
|
106
|
+
"""
|
|
107
|
+
Async version of `hf_request_event_hook`.
|
|
108
|
+
"""
|
|
109
|
+
return hf_request_event_hook(request)
|
|
110
|
+
|
|
111
|
+
|
|
105
112
|
def default_client_factory() -> httpx.Client:
|
|
106
113
|
"""
|
|
107
114
|
Factory function to create a `httpx.Client` with the default transport.
|
|
@@ -118,7 +125,7 @@ def default_async_client_factory() -> httpx.AsyncClient:
|
|
|
118
125
|
Factory function to create a `httpx.AsyncClient` with the default transport.
|
|
119
126
|
"""
|
|
120
127
|
return httpx.AsyncClient(
|
|
121
|
-
event_hooks={"request": [
|
|
128
|
+
event_hooks={"request": [async_hf_request_event_hook]},
|
|
122
129
|
follow_redirects=True,
|
|
123
130
|
timeout=httpx.Timeout(constants.DEFAULT_REQUEST_TIMEOUT, write=60.0),
|
|
124
131
|
)
|
|
@@ -716,9 +723,9 @@ def _curlify(request: httpx.Request) -> str:
|
|
|
716
723
|
flat_parts = []
|
|
717
724
|
for k, v in parts:
|
|
718
725
|
if k:
|
|
719
|
-
flat_parts.append(quote(k))
|
|
726
|
+
flat_parts.append(quote(str(k)))
|
|
720
727
|
if v:
|
|
721
|
-
flat_parts.append(quote(v))
|
|
728
|
+
flat_parts.append(quote(str(v)))
|
|
722
729
|
|
|
723
730
|
return " ".join(flat_parts)
|
|
724
731
|
|
|
@@ -19,7 +19,8 @@ import os
|
|
|
19
19
|
import platform
|
|
20
20
|
import sys
|
|
21
21
|
import warnings
|
|
22
|
-
from
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from typing import Any, Literal
|
|
23
24
|
|
|
24
25
|
from .. import __version__, constants
|
|
25
26
|
|
|
@@ -322,6 +323,49 @@ def is_colab_enterprise() -> bool:
|
|
|
322
323
|
return os.environ.get("VERTEX_PRODUCT") == "COLAB_ENTERPRISE"
|
|
323
324
|
|
|
324
325
|
|
|
326
|
+
# Check how huggingface_hub has been installed
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def installation_method() -> Literal["brew", "hf_installer", "unknown"]:
|
|
330
|
+
"""Return the installation method of the current environment.
|
|
331
|
+
|
|
332
|
+
- "hf_installer" if installed via the official installer script
|
|
333
|
+
- "brew" if installed via Homebrew
|
|
334
|
+
- "unknown" otherwise
|
|
335
|
+
"""
|
|
336
|
+
if _is_brew_installation():
|
|
337
|
+
return "brew"
|
|
338
|
+
elif _is_hf_installer_installation():
|
|
339
|
+
return "hf_installer"
|
|
340
|
+
else:
|
|
341
|
+
return "unknown"
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def _is_brew_installation() -> bool:
|
|
345
|
+
"""Check if running from a Homebrew installation.
|
|
346
|
+
|
|
347
|
+
Note: AI-generated by Claude.
|
|
348
|
+
"""
|
|
349
|
+
exe_path = Path(sys.executable).resolve()
|
|
350
|
+
exe_str = str(exe_path)
|
|
351
|
+
|
|
352
|
+
# Check common Homebrew paths
|
|
353
|
+
# /opt/homebrew (Apple Silicon), /usr/local (Intel)
|
|
354
|
+
return "/Cellar/" in exe_str or "/opt/homebrew/" in exe_str or exe_str.startswith("/usr/local/Cellar/")
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def _is_hf_installer_installation() -> bool:
|
|
358
|
+
"""Return `True` if the current environment was set up via the official hf installer script.
|
|
359
|
+
|
|
360
|
+
i.e. using one of
|
|
361
|
+
curl -LsSf https://hf.co/cli/install.sh | sh
|
|
362
|
+
powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"
|
|
363
|
+
"""
|
|
364
|
+
venv = sys.prefix # points to venv root if active
|
|
365
|
+
marker = Path(venv) / ".hf_installer_marker"
|
|
366
|
+
return marker.exists()
|
|
367
|
+
|
|
368
|
+
|
|
325
369
|
def dump_environment_info() -> dict[str, Any]:
|
|
326
370
|
"""Dump information about the machine to help debugging issues.
|
|
327
371
|
|
|
@@ -366,6 +410,9 @@ def dump_environment_info() -> dict[str, Any]:
|
|
|
366
410
|
except Exception:
|
|
367
411
|
pass
|
|
368
412
|
|
|
413
|
+
# How huggingface_hub has been installed?
|
|
414
|
+
info["Installation method"] = installation_method()
|
|
415
|
+
|
|
369
416
|
# Installed dependencies
|
|
370
417
|
info["Torch"] = get_torch_version()
|
|
371
418
|
info["httpx"] = get_httpx_version()
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Copyright 2025 The HuggingFace Team. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
"""Contains utilities to print stuff to the terminal (styling, helpers)."""
|
|
15
|
+
|
|
16
|
+
import os
|
|
17
|
+
from typing import Union
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ANSI:
|
|
21
|
+
"""
|
|
22
|
+
Helper for en.wikipedia.org/wiki/ANSI_escape_code
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
_bold = "\u001b[1m"
|
|
26
|
+
_gray = "\u001b[90m"
|
|
27
|
+
_red = "\u001b[31m"
|
|
28
|
+
_reset = "\u001b[0m"
|
|
29
|
+
_yellow = "\u001b[33m"
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def bold(cls, s: str) -> str:
|
|
33
|
+
return cls._format(s, cls._bold)
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def gray(cls, s: str) -> str:
|
|
37
|
+
return cls._format(s, cls._gray)
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def red(cls, s: str) -> str:
|
|
41
|
+
return cls._format(s, cls._bold + cls._red)
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def yellow(cls, s: str) -> str:
|
|
45
|
+
return cls._format(s, cls._yellow)
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def _format(cls, s: str, code: str) -> str:
|
|
49
|
+
if os.environ.get("NO_COLOR"):
|
|
50
|
+
# See https://no-color.org/
|
|
51
|
+
return s
|
|
52
|
+
return f"{code}{s}{cls._reset}"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def tabulate(rows: list[list[Union[str, int]]], headers: list[str]) -> str:
|
|
56
|
+
"""
|
|
57
|
+
Inspired by:
|
|
58
|
+
|
|
59
|
+
- stackoverflow.com/a/8356620/593036
|
|
60
|
+
- stackoverflow.com/questions/9535954/printing-lists-as-tabular-data
|
|
61
|
+
"""
|
|
62
|
+
col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)]
|
|
63
|
+
row_format = ("{{:{}}} " * len(headers)).format(*col_widths)
|
|
64
|
+
lines = []
|
|
65
|
+
lines.append(row_format.format(*headers))
|
|
66
|
+
lines.append(row_format.format(*["-" * w for w in col_widths]))
|
|
67
|
+
for row in rows:
|
|
68
|
+
lines.append(row_format.format(*row))
|
|
69
|
+
return "\n".join(lines)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: huggingface-hub
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0rc5
|
|
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.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
huggingface_hub/__init__.py,sha256=
|
|
1
|
+
huggingface_hub/__init__.py,sha256=kHPKEu5MN6v18fYf3kfgy_wzN5JDHLfXVtRH59Hx2WE,51906
|
|
2
2
|
huggingface_hub/_commit_api.py,sha256=4iFe5TQpS8jTRW7sDWut6HUU1eOkw80G5nJooaDKiOM,40890
|
|
3
3
|
huggingface_hub/_commit_scheduler.py,sha256=tqcdWVGJRIxGQtkFHs_AgBdN9ztUjOQSuAhfMAr1ieM,14751
|
|
4
4
|
huggingface_hub/_inference_endpoints.py,sha256=cGiZg244nIOi2OLTqm4V8-ZUY3O0Rr7NlOmoLeHUIbY,17592
|
|
5
5
|
huggingface_hub/_jobs_api.py,sha256=SqybFSxQygyp8Ywem2a4WIL0kcq_hB1Dv5xV8kJFmv8,10791
|
|
6
6
|
huggingface_hub/_local_folder.py,sha256=2iHXNgIT3UdSt2PvCovd0NzgVxTRypKb-rvAFLK-gZU,17305
|
|
7
|
-
huggingface_hub/_login.py,sha256=
|
|
7
|
+
huggingface_hub/_login.py,sha256=x6kW2YUO_ylR6ld8-_3EruE0kMyL0Ud_fI5l-lVbxtc,19028
|
|
8
8
|
huggingface_hub/_oauth.py,sha256=91zR_H235vxi-fg2YXzDgmA09j4BR3dim9VVzf6srps,18695
|
|
9
9
|
huggingface_hub/_snapshot_download.py,sha256=mT2fyCAstt2ZifuY-12FUuXs0x1TVD7_IQUe_NnQkxo,19375
|
|
10
10
|
huggingface_hub/_space_api.py,sha256=aOowzC3LUytfgFrZprn9vKTQHXLpDWJKjl9X4qq_ZxQ,5464
|
|
@@ -13,8 +13,8 @@ huggingface_hub/_upload_large_folder.py,sha256=pDWpXcG5EgOEb0qS96NgtUiJjMMDEdLgA
|
|
|
13
13
|
huggingface_hub/_webhooks_payload.py,sha256=qCZjBa5dhssg_O0yzgzxPyMpwAxLG96I4qen_HIk0Qc,3611
|
|
14
14
|
huggingface_hub/_webhooks_server.py,sha256=CSfQpgs5mJJjQEbJ9WPATdn4it2-Ii0eXVdqx9JeBCg,15685
|
|
15
15
|
huggingface_hub/community.py,sha256=RbW37Fh8IPsTOiE6ukTdG9mjkjECdKsvcWg6wBV55mg,12192
|
|
16
|
-
huggingface_hub/constants.py,sha256=
|
|
17
|
-
huggingface_hub/dataclasses.py,sha256=
|
|
16
|
+
huggingface_hub/constants.py,sha256=adSL6q3hR_5DnxAT_kvlo68vIQsrRAjqYUsalqS70mg,9503
|
|
17
|
+
huggingface_hub/dataclasses.py,sha256=b1lo5BI881Drd7UM_pUrK8zdJdhXOGj4-pHxFS_P4M4,21962
|
|
18
18
|
huggingface_hub/errors.py,sha256=lnXNYKsoJwm_G3377u7aDJGnGwKqCyaiZ1DfjtlzMR8,11411
|
|
19
19
|
huggingface_hub/fastai_utils.py,sha256=0joRPBUccjFALLCfhQLyD_K8qxGvQiLThKJClwej_JQ,16657
|
|
20
20
|
huggingface_hub/file_download.py,sha256=V1FNjTCCd-EqIwvU1wN0Hx0UlAVBYRzEGB3fih6bAW4,81181
|
|
@@ -26,18 +26,18 @@ huggingface_hub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
26
26
|
huggingface_hub/repocard.py,sha256=-wss1XDYjr88OjwK4Gzi8c-gQwPIHM8qRgxXYgeilUM,34978
|
|
27
27
|
huggingface_hub/repocard_data.py,sha256=DLdOKlnQCHOOpU-e_skx0YaHxoqN9ZKIOmmMjHUqb1w,34063
|
|
28
28
|
huggingface_hub/cli/__init__.py,sha256=A4zmzuHD2OHjQ5zmdfcnsj0JeCzHVPtpzh-wCjInugA,606
|
|
29
|
-
huggingface_hub/cli/_cli_utils.py,sha256=
|
|
30
|
-
huggingface_hub/cli/auth.py,sha256=
|
|
31
|
-
huggingface_hub/cli/cache.py,sha256=
|
|
32
|
-
huggingface_hub/cli/download.py,sha256=
|
|
33
|
-
huggingface_hub/cli/hf.py,sha256=
|
|
29
|
+
huggingface_hub/cli/_cli_utils.py,sha256=CzSGUAu3bOiYy_n6r_QT9iJcMtbRRMoWwsM96pltK8c,5389
|
|
30
|
+
huggingface_hub/cli/auth.py,sha256=VUA830kel4EGwJjHllz2THW94wzcoWssBKrChMl3A8Q,5177
|
|
31
|
+
huggingface_hub/cli/cache.py,sha256=b8NN3QS0GgWJqh051848MN7mjER9AUMAqgg6jijHWmQ,13999
|
|
32
|
+
huggingface_hub/cli/download.py,sha256=bOzXXIDBldg513MTuUTk09GlcbeUmHGwY7Udnlw8J7U,6506
|
|
33
|
+
huggingface_hub/cli/hf.py,sha256=q8J-SPVe56Qse1b2WT_vKxB4quKpTE_4HSywNA-7ns0,2356
|
|
34
34
|
huggingface_hub/cli/jobs.py,sha256=HgxxxDRaCHH62eBpihzf1SakevM3OWewPiIzWjFkYLw,23871
|
|
35
35
|
huggingface_hub/cli/lfs.py,sha256=UJI5nBbrt_a-lm5uU88gxD6hVu8xyQav-zBxLTv3Wzo,5895
|
|
36
|
-
huggingface_hub/cli/repo.py,sha256=
|
|
36
|
+
huggingface_hub/cli/repo.py,sha256=DaRwZ-h66wpRLhqjnuxzCOEt0lh0ZbRigsIt9-oQ7iI,9920
|
|
37
37
|
huggingface_hub/cli/repo_files.py,sha256=6d5GsLsCjqSKTSbJqCHnrRxB9kXj-yLRAtcVbQkQNMo,2799
|
|
38
|
-
huggingface_hub/cli/system.py,sha256=
|
|
38
|
+
huggingface_hub/cli/system.py,sha256=bEIXmK3qz4qIej1lv1LMCxnXEN9zZnwdl42g4mV_1nQ,982
|
|
39
39
|
huggingface_hub/cli/upload.py,sha256=4OiGfKW12gPQJBSOqcoeWyTrBUSKeVrJ43cOQ2wgtrA,11823
|
|
40
|
-
huggingface_hub/cli/upload_large_folder.py,sha256=
|
|
40
|
+
huggingface_hub/cli/upload_large_folder.py,sha256=xQuloimQT0PQH6r5urRpLv8M9I99yAWSGM-sbkG2pu8,4470
|
|
41
41
|
huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
42
|
huggingface_hub/inference/_client.py,sha256=Tx4rfJ24GCKF7umxNqSpaKMse8w1LZm7c5b0Y2SH8Yw,157946
|
|
43
43
|
huggingface_hub/inference/_common.py,sha256=qS3i2R8Dz_VCb6sWt1ZqnmOt8jxPU6uSxlyq-0_9ytg,15350
|
|
@@ -112,10 +112,10 @@ huggingface_hub/serialization/_dduf.py,sha256=eyUREtvL7od9SSYKrGcCayF29w3xcP1qXT
|
|
|
112
112
|
huggingface_hub/serialization/_torch.py,sha256=VSxdgQ8NuluWY2vs0ZXr6dJFDNNvL1FDW38adLag6nE,45082
|
|
113
113
|
huggingface_hub/templates/datasetcard_template.md,sha256=W-EMqR6wndbrnZorkVv56URWPG49l7MATGeI015kTvs,5503
|
|
114
114
|
huggingface_hub/templates/modelcard_template.md,sha256=4AqArS3cqdtbit5Bo-DhjcnDFR-pza5hErLLTPM4Yuc,6870
|
|
115
|
-
huggingface_hub/utils/__init__.py,sha256=
|
|
115
|
+
huggingface_hub/utils/__init__.py,sha256=N8zE7qnSa8B9E8sl4vRvhlTaBymiHXkkmYSeSA3b5HM,3858
|
|
116
116
|
huggingface_hub/utils/_auth.py,sha256=TAz8pjk1lP7gseit8Trl2LygKun9unMEBWg_36EeDkA,8280
|
|
117
117
|
huggingface_hub/utils/_cache_assets.py,sha256=kai77HPQMfYpROouMBQCr_gdBCaeTm996Sqj0dExbNg,5728
|
|
118
|
-
huggingface_hub/utils/_cache_manager.py,sha256=
|
|
118
|
+
huggingface_hub/utils/_cache_manager.py,sha256=sHP0m4jnjAdT52sxkaDcH4pFAUidDo0NItjPcs8Un4M,34325
|
|
119
119
|
huggingface_hub/utils/_chunk_utils.py,sha256=MH7-6FwCDZ8noV6dGRytCOJGSfcZmDBvsvVotdI8TvQ,2109
|
|
120
120
|
huggingface_hub/utils/_datetime.py,sha256=kCS5jaKV25kOncX1xujbXsz5iDLcjLcLw85semGNzxQ,2770
|
|
121
121
|
huggingface_hub/utils/_deprecation.py,sha256=4tWi3vBSdvnhA0z_Op-tkAQ0xrJ4TUb0HbPhMiXUnOs,4872
|
|
@@ -124,14 +124,15 @@ huggingface_hub/utils/_experimental.py,sha256=3-c8irbn9sJr2CwWbzhGkIrdXKg8_x7Bif
|
|
|
124
124
|
huggingface_hub/utils/_fixes.py,sha256=xQZzfwLqZV8-gNcw9mrZ-M1acA6NZHszI_-cSZIWN-U,3978
|
|
125
125
|
huggingface_hub/utils/_git_credential.py,sha256=4B77QzeiPxCwK6BWZgUc1avzRKpna3wYlhVg7AuSCzA,4613
|
|
126
126
|
huggingface_hub/utils/_headers.py,sha256=k_ApvA8fJGHc0yNp2IFY8wySM9MQ5UZEpjr1g-fpRJ4,8060
|
|
127
|
-
huggingface_hub/utils/_http.py,sha256=
|
|
127
|
+
huggingface_hub/utils/_http.py,sha256=gjlfl33a2a4qrrh4Uf4KZDk6vOcyi8TXayhAKLskv7w,30252
|
|
128
128
|
huggingface_hub/utils/_lfs.py,sha256=EC0Oz6Wiwl8foRNkUOzrETXzAWlbgpnpxo5a410ovFY,3957
|
|
129
129
|
huggingface_hub/utils/_pagination.py,sha256=wEHEWhCu9vN5pv51t7ixSGe13g63kS6AJM4P53eY9M4,1894
|
|
130
130
|
huggingface_hub/utils/_paths.py,sha256=WCR2WbqDJLdNlU4XZNXXNmGct3OiDwPesGYrq41T2wE,5036
|
|
131
|
-
huggingface_hub/utils/_runtime.py,sha256=
|
|
131
|
+
huggingface_hub/utils/_runtime.py,sha256=WLArfJYYHHGn4eqU4C1FmTJTD8AhxhDUk4eqkJE9-S0,12953
|
|
132
132
|
huggingface_hub/utils/_safetensors.py,sha256=2_xbCsDPsCwR1tyBjJ5MoOHsX4ksocjzc4jS7oGe7_s,4439
|
|
133
133
|
huggingface_hub/utils/_subprocess.py,sha256=9qDWT1a2QF2TmXOQJDlPK6LwzYl9XjXeRadQPn15U14,4612
|
|
134
134
|
huggingface_hub/utils/_telemetry.py,sha256=a7t0jaOUPVNxbDWi4KQgVf8vSpZv0I-tK2HwlAowvEE,4884
|
|
135
|
+
huggingface_hub/utils/_terminal.py,sha256=ai6nDaW8wqVMxf4gDy6wN9fyszYzKiCUrYu6lzWdR9M,2115
|
|
135
136
|
huggingface_hub/utils/_typing.py,sha256=cC9p6E8hG2LId8sFWJ9H-cpQozv3asuoww_XiA1-XWI,3617
|
|
136
137
|
huggingface_hub/utils/_validators.py,sha256=p9ScwDqjTfrEQx5dmJJKCovExTUqwGA7TNIx511jBxE,8347
|
|
137
138
|
huggingface_hub/utils/_xet.py,sha256=P9b4lc4bJfOSZ7OVO-fg26_ayN0ESb_f1nQ7Bx9ZLfg,7297
|
|
@@ -141,9 +142,9 @@ huggingface_hub/utils/insecure_hashlib.py,sha256=z3dVUFvdBZ8kQI_8Vzvvlr3ims-EBiY
|
|
|
141
142
|
huggingface_hub/utils/logging.py,sha256=N6NXaCcbPbZSF-Oe-TY3ZnmkpmdFVyTOV8ASo-yVXLE,4916
|
|
142
143
|
huggingface_hub/utils/sha.py,sha256=OFnNGCba0sNcT2gUwaVCJnldxlltrHHe0DS_PCpV3C4,2134
|
|
143
144
|
huggingface_hub/utils/tqdm.py,sha256=-9gfgNA8bg5v5YBToSuB6noClI3a6YaGeFZP61IWmeY,10662
|
|
144
|
-
huggingface_hub-1.0.
|
|
145
|
-
huggingface_hub-1.0.
|
|
146
|
-
huggingface_hub-1.0.
|
|
147
|
-
huggingface_hub-1.0.
|
|
148
|
-
huggingface_hub-1.0.
|
|
149
|
-
huggingface_hub-1.0.
|
|
145
|
+
huggingface_hub-1.0.0rc5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
146
|
+
huggingface_hub-1.0.0rc5.dist-info/METADATA,sha256=qqE6ak6OJOMZBsrVWNKcSAY0aEumDU_XmkcV6ANsz4s,14164
|
|
147
|
+
huggingface_hub-1.0.0rc5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
148
|
+
huggingface_hub-1.0.0rc5.dist-info/entry_points.txt,sha256=8Dw-X6nV_toOLZqujrhQMj2uTLs4wzV8EIF1y3FlzVs,153
|
|
149
|
+
huggingface_hub-1.0.0rc5.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
|
|
150
|
+
huggingface_hub-1.0.0rc5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|