huggingface-hub 1.0.0rc6__py3-none-any.whl → 1.0.1__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.

Files changed (38) hide show
  1. huggingface_hub/__init__.py +10 -1
  2. huggingface_hub/_commit_api.py +1 -5
  3. huggingface_hub/_jobs_api.py +1 -1
  4. huggingface_hub/_login.py +3 -3
  5. huggingface_hub/_snapshot_download.py +4 -3
  6. huggingface_hub/_upload_large_folder.py +2 -15
  7. huggingface_hub/_webhooks_server.py +1 -1
  8. huggingface_hub/cli/_cli_utils.py +1 -1
  9. huggingface_hub/cli/auth.py +0 -20
  10. huggingface_hub/cli/cache.py +561 -304
  11. huggingface_hub/cli/download.py +2 -2
  12. huggingface_hub/cli/repo.py +0 -7
  13. huggingface_hub/cli/upload.py +0 -8
  14. huggingface_hub/community.py +16 -8
  15. huggingface_hub/constants.py +10 -11
  16. huggingface_hub/file_download.py +9 -61
  17. huggingface_hub/hf_api.py +201 -132
  18. huggingface_hub/hf_file_system.py +32 -7
  19. huggingface_hub/inference/_client.py +1 -1
  20. huggingface_hub/inference/_common.py +1 -10
  21. huggingface_hub/inference/_generated/_async_client.py +1 -1
  22. huggingface_hub/inference/_providers/__init__.py +15 -2
  23. huggingface_hub/inference/_providers/_common.py +39 -0
  24. huggingface_hub/inference/_providers/clarifai.py +13 -0
  25. huggingface_hub/lfs.py +3 -65
  26. huggingface_hub/repocard_data.py +1 -1
  27. huggingface_hub/serialization/_torch.py +1 -1
  28. huggingface_hub/utils/__init__.py +0 -2
  29. huggingface_hub/utils/_cache_manager.py +17 -42
  30. huggingface_hub/utils/_http.py +25 -3
  31. huggingface_hub/utils/_parsing.py +98 -0
  32. huggingface_hub/utils/_runtime.py +1 -14
  33. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/METADATA +5 -21
  34. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/RECORD +38 -36
  35. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/LICENSE +0 -0
  36. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/WHEEL +0 -0
  37. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/entry_points.txt +0 -0
  38. {huggingface_hub-1.0.0rc6.dist-info → huggingface_hub-1.0.1.dist-info}/top_level.txt +0 -0
@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "1.0.0.rc6"
49
+ __version__ = "1.0.1"
50
50
 
51
51
  # Alphabetical order of definitions is ensured in tests
52
52
  # WARNING: any comment added in this dictionary definition will be lost when
@@ -163,6 +163,7 @@ _SUBMOD_ATTRS = {
163
163
  "GitRefs",
164
164
  "HfApi",
165
165
  "ModelInfo",
166
+ "Organization",
166
167
  "RepoUrl",
167
168
  "SpaceInfo",
168
169
  "User",
@@ -216,6 +217,7 @@ _SUBMOD_ATTRS = {
216
217
  "get_full_repo_name",
217
218
  "get_inference_endpoint",
218
219
  "get_model_tags",
220
+ "get_organization_overview",
219
221
  "get_paths_info",
220
222
  "get_repo_discussions",
221
223
  "get_safetensors_metadata",
@@ -235,6 +237,7 @@ _SUBMOD_ATTRS = {
235
237
  "list_lfs_files",
236
238
  "list_liked_repos",
237
239
  "list_models",
240
+ "list_organization_followers",
238
241
  "list_organization_members",
239
242
  "list_papers",
240
243
  "list_pending_access_requests",
@@ -692,6 +695,7 @@ __all__ = [
692
695
  "ObjectDetectionInput",
693
696
  "ObjectDetectionOutputElement",
694
697
  "ObjectDetectionParameters",
698
+ "Organization",
695
699
  "PYTORCH_WEIGHTS_NAME",
696
700
  "Padding",
697
701
  "PyTorchModelHubMixin",
@@ -862,6 +866,7 @@ __all__ = [
862
866
  "get_hf_file_metadata",
863
867
  "get_inference_endpoint",
864
868
  "get_model_tags",
869
+ "get_organization_overview",
865
870
  "get_paths_info",
866
871
  "get_repo_discussions",
867
872
  "get_safetensors_metadata",
@@ -889,6 +894,7 @@ __all__ = [
889
894
  "list_lfs_files",
890
895
  "list_liked_repos",
891
896
  "list_models",
897
+ "list_organization_followers",
892
898
  "list_organization_members",
893
899
  "list_papers",
894
900
  "list_pending_access_requests",
@@ -1171,6 +1177,7 @@ if TYPE_CHECKING: # pragma: no cover
1171
1177
  GitRefs, # noqa: F401
1172
1178
  HfApi, # noqa: F401
1173
1179
  ModelInfo, # noqa: F401
1180
+ Organization, # noqa: F401
1174
1181
  RepoUrl, # noqa: F401
1175
1182
  SpaceInfo, # noqa: F401
1176
1183
  User, # noqa: F401
@@ -1224,6 +1231,7 @@ if TYPE_CHECKING: # pragma: no cover
1224
1231
  get_full_repo_name, # noqa: F401
1225
1232
  get_inference_endpoint, # noqa: F401
1226
1233
  get_model_tags, # noqa: F401
1234
+ get_organization_overview, # noqa: F401
1227
1235
  get_paths_info, # noqa: F401
1228
1236
  get_repo_discussions, # noqa: F401
1229
1237
  get_safetensors_metadata, # noqa: F401
@@ -1243,6 +1251,7 @@ if TYPE_CHECKING: # pragma: no cover
1243
1251
  list_lfs_files, # noqa: F401
1244
1252
  list_liked_repos, # noqa: F401
1245
1253
  list_models, # noqa: F401
1254
+ list_organization_followers, # noqa: F401
1246
1255
  list_organization_members, # noqa: F401
1247
1256
  list_papers, # noqa: F401
1248
1257
  list_pending_access_requests, # noqa: F401
@@ -503,11 +503,7 @@ def _upload_lfs_files(
503
503
  except Exception as exc:
504
504
  raise RuntimeError(f"Error while uploading '{operation.path_in_repo}' to the Hub.") from exc
505
505
 
506
- if constants.HF_HUB_ENABLE_HF_TRANSFER:
507
- logger.debug(f"Uploading {len(filtered_actions)} LFS files to the Hub using `hf_transfer`.")
508
- for action in hf_tqdm(filtered_actions, name="huggingface_hub.lfs_upload"):
509
- _wrapped_lfs_upload(action)
510
- elif len(filtered_actions) == 1:
506
+ if len(filtered_actions) == 1:
511
507
  logger.debug("Uploading 1 LFS file to the Hub")
512
508
  _wrapped_lfs_upload(filtered_actions[0])
513
509
  else:
@@ -30,7 +30,7 @@ class JobStage(str, Enum):
30
30
  ```py
31
31
  assert JobStage.COMPLETED == "COMPLETED"
32
32
  ```
33
-
33
+ Possible values are: `COMPLETED`, `CANCELED`, `ERROR`, `DELETED`, `RUNNING`.
34
34
  Taken from https://github.com/huggingface/moon-landing/blob/main/server/job_types/JobInfo.ts#L61 (private url).
35
35
  """
36
36
 
huggingface_hub/_login.py CHANGED
@@ -19,6 +19,8 @@ from getpass import getpass
19
19
  from pathlib import Path
20
20
  from typing import Optional
21
21
 
22
+ import typer
23
+
22
24
  from . import constants
23
25
  from .utils import (
24
26
  ANSI,
@@ -244,8 +246,6 @@ def interpreter_login(*, skip_if_logged_in: bool = False) -> None:
244
246
  logger.info("User is already logged in.")
245
247
  return
246
248
 
247
- from .cli.cache import _ask_for_confirmation_no_tui
248
-
249
249
  print(_HF_LOGO_ASCII)
250
250
  if get_token() is not None:
251
251
  logger.info(
@@ -261,7 +261,7 @@ def interpreter_login(*, skip_if_logged_in: bool = False) -> None:
261
261
  if os.name == "nt":
262
262
  logger.info("Token can be pasted using 'Right-Click'.")
263
263
  token = getpass("Enter your token (input will not be visible): ")
264
- add_to_git_credential = _ask_for_confirmation_no_tui("Add token as git credential?")
264
+ add_to_git_credential = typer.confirm("Add token as git credential?")
265
265
 
266
266
  _login(token=token, add_to_git_credential=add_to_git_credential)
267
267
 
@@ -403,9 +403,10 @@ def snapshot_download(
403
403
  )
404
404
  )
405
405
 
406
- if constants.HF_HUB_ENABLE_HF_TRANSFER and not dry_run:
407
- # when using hf_transfer we don't want extra parallelism
408
- # from the one hf_transfer provides
406
+ if constants.HF_XET_HIGH_PERFORMANCE and not dry_run:
407
+ # when using hf_xet high performance we don't want extra parallelism
408
+ # from the one hf_xet provides
409
+ # TODO: revisit this when xet_session is implemented
409
410
  for file in filtered_repo_files:
410
411
  _inner_hf_hub_download(file)
411
412
  else:
@@ -27,7 +27,6 @@ from threading import Lock
27
27
  from typing import TYPE_CHECKING, Any, Optional, Union
28
28
  from urllib.parse import quote
29
29
 
30
- from . import constants
31
30
  from ._commit_api import CommitOperationAdd, UploadInfo, _fetch_upload_modes
32
31
  from ._local_folder import LocalUploadFileMetadata, LocalUploadFilePaths, get_local_upload_paths, read_upload_metadata
33
32
  from .constants import DEFAULT_REVISION, REPO_TYPES
@@ -199,16 +198,7 @@ def upload_large_folder_internal(
199
198
  logger.info(f"Repo created: {repo_url}")
200
199
  repo_id = repo_url.repo_id
201
200
  # 2.1 Check if xet is enabled to set batch file upload size
202
- is_xet_enabled = (
203
- is_xet_available()
204
- and api.repo_info(
205
- repo_id=repo_id,
206
- repo_type=repo_type,
207
- revision=revision,
208
- expand="xetEnabled",
209
- ).xet_enabled
210
- )
211
- upload_batch_size = UPLOAD_BATCH_SIZE_XET if is_xet_enabled else UPLOAD_BATCH_SIZE_LFS
201
+ upload_batch_size = UPLOAD_BATCH_SIZE_XET if is_xet_available() else UPLOAD_BATCH_SIZE_LFS
212
202
 
213
203
  # 3. List files to upload
214
204
  filtered_paths_list = filter_repo_objects(
@@ -559,10 +549,7 @@ def _determine_next_job(status: LargeUploadStatus) -> Optional[tuple[WorkerJob,
559
549
  return (WorkerJob.GET_UPLOAD_MODE, _get_n(status.queue_get_upload_mode, MAX_NB_FILES_FETCH_UPLOAD_MODE))
560
550
 
561
551
  # 7. Preupload LFS file if at least `status.upload_batch_size` files
562
- # Skip if hf_transfer is enabled and there is already a worker preuploading LFS
563
- elif status.queue_preupload_lfs.qsize() >= status.upload_batch_size and (
564
- status.nb_workers_preupload_lfs == 0 or not constants.HF_HUB_ENABLE_HF_TRANSFER
565
- ):
552
+ elif status.queue_preupload_lfs.qsize() >= status.upload_batch_size:
566
553
  status.nb_workers_preupload_lfs += 1
567
554
  logger.debug("Job: preupload LFS")
568
555
  return (WorkerJob.PREUPLOAD_LFS, _get_n(status.queue_preupload_lfs, status.upload_batch_size))
@@ -32,7 +32,7 @@ if is_fastapi_available():
32
32
  from fastapi.responses import JSONResponse
33
33
  else:
34
34
  # Will fail at runtime if FastAPI is not available
35
- FastAPI = Request = JSONResponse = None # type: ignore [misc, assignment]
35
+ FastAPI = Request = JSONResponse = None # type: ignore
36
36
 
37
37
 
38
38
  _global_app: Optional["WebhooksServer"] = None
@@ -38,7 +38,7 @@ def get_hf_api(token: Optional[str] = None) -> "HfApi":
38
38
  # Import here to avoid circular import
39
39
  from huggingface_hub.hf_api import HfApi
40
40
 
41
- return HfApi(token=token, library_name="hf", library_version=__version__)
41
+ return HfApi(token=token, library_name="huggingface-cli", library_version=__version__)
42
42
 
43
43
 
44
44
  #### TYPER UTILS
@@ -45,14 +45,6 @@ from ._cli_utils import TokenOpt, typer_factory
45
45
 
46
46
  logger = logging.get_logger(__name__)
47
47
 
48
- try:
49
- from InquirerPy import inquirer
50
- from InquirerPy.base.control import Choice
51
-
52
- _inquirer_py_available = True
53
- except ImportError:
54
- _inquirer_py_available = False
55
-
56
48
 
57
49
  auth_cli = typer_factory(help="Manage authentication (login, logout, etc.).")
58
50
 
@@ -89,18 +81,6 @@ def _select_token_name() -> Optional[str]:
89
81
  logger.error("No stored tokens found. Please login first.")
90
82
  return None
91
83
 
92
- if _inquirer_py_available:
93
- choices = [Choice(token_name, name=token_name) for token_name in token_names]
94
- try:
95
- return inquirer.select(
96
- message="Select a token to switch to:",
97
- choices=choices,
98
- default=None,
99
- ).execute()
100
- except KeyboardInterrupt:
101
- logger.info("Token selection cancelled.")
102
- return None
103
- # if inquirer is not available, use a simpler terminal UI
104
84
  print("Available stored tokens:")
105
85
  for i, token_name in enumerate(token_names, 1):
106
86
  print(f"{i}. {token_name}")