huggingface-hub 0.26.5__py3-none-any.whl → 0.27.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.

Files changed (61) hide show
  1. huggingface_hub/__init__.py +49 -23
  2. huggingface_hub/_commit_scheduler.py +30 -4
  3. huggingface_hub/_local_folder.py +0 -4
  4. huggingface_hub/_login.py +38 -54
  5. huggingface_hub/_snapshot_download.py +6 -3
  6. huggingface_hub/_tensorboard_logger.py +2 -3
  7. huggingface_hub/_upload_large_folder.py +1 -1
  8. huggingface_hub/errors.py +19 -0
  9. huggingface_hub/fastai_utils.py +3 -2
  10. huggingface_hub/file_download.py +10 -12
  11. huggingface_hub/hf_api.py +102 -498
  12. huggingface_hub/hf_file_system.py +274 -35
  13. huggingface_hub/hub_mixin.py +5 -25
  14. huggingface_hub/inference/_client.py +185 -136
  15. huggingface_hub/inference/_common.py +2 -2
  16. huggingface_hub/inference/_generated/_async_client.py +186 -137
  17. huggingface_hub/inference/_generated/types/__init__.py +31 -10
  18. huggingface_hub/inference/_generated/types/audio_classification.py +3 -5
  19. huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +6 -9
  20. huggingface_hub/inference/_generated/types/chat_completion.py +8 -5
  21. huggingface_hub/inference/_generated/types/depth_estimation.py +1 -1
  22. huggingface_hub/inference/_generated/types/document_question_answering.py +2 -6
  23. huggingface_hub/inference/_generated/types/feature_extraction.py +1 -1
  24. huggingface_hub/inference/_generated/types/fill_mask.py +2 -4
  25. huggingface_hub/inference/_generated/types/image_classification.py +3 -5
  26. huggingface_hub/inference/_generated/types/image_segmentation.py +2 -4
  27. huggingface_hub/inference/_generated/types/image_to_image.py +2 -4
  28. huggingface_hub/inference/_generated/types/image_to_text.py +6 -9
  29. huggingface_hub/inference/_generated/types/object_detection.py +2 -4
  30. huggingface_hub/inference/_generated/types/question_answering.py +2 -4
  31. huggingface_hub/inference/_generated/types/sentence_similarity.py +1 -1
  32. huggingface_hub/inference/_generated/types/summarization.py +2 -4
  33. huggingface_hub/inference/_generated/types/table_question_answering.py +21 -3
  34. huggingface_hub/inference/_generated/types/text2text_generation.py +2 -4
  35. huggingface_hub/inference/_generated/types/text_classification.py +4 -10
  36. huggingface_hub/inference/_generated/types/text_to_audio.py +7 -10
  37. huggingface_hub/inference/_generated/types/text_to_image.py +2 -4
  38. huggingface_hub/inference/_generated/types/text_to_speech.py +7 -10
  39. huggingface_hub/inference/_generated/types/token_classification.py +11 -12
  40. huggingface_hub/inference/_generated/types/translation.py +2 -4
  41. huggingface_hub/inference/_generated/types/video_classification.py +3 -4
  42. huggingface_hub/inference/_generated/types/visual_question_answering.py +2 -5
  43. huggingface_hub/inference/_generated/types/zero_shot_classification.py +8 -18
  44. huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +9 -19
  45. huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +7 -9
  46. huggingface_hub/keras_mixin.py +3 -2
  47. huggingface_hub/lfs.py +2 -5
  48. huggingface_hub/repocard_data.py +4 -4
  49. huggingface_hub/serialization/__init__.py +2 -0
  50. huggingface_hub/serialization/_dduf.py +387 -0
  51. huggingface_hub/serialization/_torch.py +372 -14
  52. huggingface_hub/utils/_cache_manager.py +1 -1
  53. huggingface_hub/utils/_headers.py +9 -25
  54. huggingface_hub/utils/tqdm.py +15 -0
  55. {huggingface_hub-0.26.5.dist-info → huggingface_hub-0.27.0.dist-info}/METADATA +8 -3
  56. {huggingface_hub-0.26.5.dist-info → huggingface_hub-0.27.0.dist-info}/RECORD +60 -60
  57. huggingface_hub/_multi_commits.py +0 -306
  58. {huggingface_hub-0.26.5.dist-info → huggingface_hub-0.27.0.dist-info}/LICENSE +0 -0
  59. {huggingface_hub-0.26.5.dist-info → huggingface_hub-0.27.0.dist-info}/WHEEL +0 -0
  60. {huggingface_hub-0.26.5.dist-info → huggingface_hub-0.27.0.dist-info}/entry_points.txt +0 -0
  61. {huggingface_hub-0.26.5.dist-info → huggingface_hub-0.27.0.dist-info}/top_level.txt +0 -0
@@ -345,7 +345,7 @@ def push_to_hub_fastai(
345
345
  *,
346
346
  repo_id: str,
347
347
  commit_message: str = "Push FastAI model using huggingface_hub.",
348
- private: bool = False,
348
+ private: Optional[bool] = None,
349
349
  token: Optional[str] = None,
350
350
  config: Optional[dict] = None,
351
351
  branch: Optional[str] = None,
@@ -369,8 +369,9 @@ def push_to_hub_fastai(
369
369
  The repository id for your model in Hub in the format of "namespace/repo_name". The namespace can be your individual account or an organization to which you have write access (for example, 'stanfordnlp/stanza-de').
370
370
  commit_message (`str`, *optional*):
371
371
  Message to commit while pushing. Will default to :obj:`"add model"`.
372
- private (`bool`, *optional*, defaults to `False`):
372
+ private (`bool`, *optional*):
373
373
  Whether or not the repository created should be private.
374
+ If `None` (default), will default to been public except if the organization's default is private.
374
375
  token (`str`, *optional*):
375
376
  The Hugging Face account token to use as HTTP bearer authorization for remote files. If :obj:`None`, the token will be asked by a prompt.
376
377
  config (`dict`, *optional*):
@@ -62,6 +62,7 @@ from .utils import (
62
62
  from .utils._runtime import _PY_VERSION # noqa: F401 # for backward compatibility
63
63
  from .utils._typing import HTTP_METHOD_T
64
64
  from .utils.sha import sha_fileobj
65
+ from .utils.tqdm import is_tqdm_disabled
65
66
 
66
67
 
67
68
  logger = logging.get_logger(__name__)
@@ -390,9 +391,8 @@ def http_get(
390
391
 
391
392
  consistency_error_message = (
392
393
  f"Consistency check failed: file should be of size {expected_size} but has size"
393
- f" {{actual_size}} ({displayed_filename}).\nWe are sorry for the inconvenience. Please retry"
394
- " with `force_download=True`.\nIf the issue persists, please let us know by opening an issue "
395
- "on https://github.com/huggingface/huggingface_hub."
394
+ f" {{actual_size}} ({displayed_filename}).\nThis is usually due to network issues while downloading the file."
395
+ " Please retry with `force_download=True`."
396
396
  )
397
397
 
398
398
  # Stream file to buffer
@@ -403,9 +403,7 @@ def http_get(
403
403
  total=total,
404
404
  initial=resume_size,
405
405
  desc=displayed_filename,
406
- disable=True if (logger.getEffectiveLevel() == logging.NOTSET) else None,
407
- # ^ set `disable=None` rather than `disable=False` by default to disable progress bar when no TTY attached
408
- # see https://github.com/huggingface/huggingface_hub/pull/2000
406
+ disable=is_tqdm_disabled(logger.getEffectiveLevel()),
409
407
  name="huggingface_hub.http_get",
410
408
  )
411
409
  if _tqdm_bar is None
@@ -821,7 +819,7 @@ def hf_hub_download(
821
819
  if repo_type not in constants.REPO_TYPES:
822
820
  raise ValueError(f"Invalid repo type: {repo_type}. Accepted repo types are: {str(constants.REPO_TYPES)}")
823
821
 
824
- headers = build_hf_headers(
822
+ hf_headers = build_hf_headers(
825
823
  token=token,
826
824
  library_name=library_name,
827
825
  library_version=library_version,
@@ -850,7 +848,7 @@ def hf_hub_download(
850
848
  # HTTP info
851
849
  endpoint=endpoint,
852
850
  etag_timeout=etag_timeout,
853
- headers=headers,
851
+ headers=hf_headers,
854
852
  proxies=proxies,
855
853
  token=token,
856
854
  # Additional options
@@ -870,7 +868,7 @@ def hf_hub_download(
870
868
  # HTTP info
871
869
  endpoint=endpoint,
872
870
  etag_timeout=etag_timeout,
873
- headers=headers,
871
+ headers=hf_headers,
874
872
  proxies=proxies,
875
873
  token=token,
876
874
  # Additional options
@@ -1283,20 +1281,20 @@ def get_hf_file_metadata(
1283
1281
  A [`HfFileMetadata`] object containing metadata such as location, etag, size and
1284
1282
  commit_hash.
1285
1283
  """
1286
- headers = build_hf_headers(
1284
+ hf_headers = build_hf_headers(
1287
1285
  token=token,
1288
1286
  library_name=library_name,
1289
1287
  library_version=library_version,
1290
1288
  user_agent=user_agent,
1291
1289
  headers=headers,
1292
1290
  )
1293
- headers["Accept-Encoding"] = "identity" # prevent any compression => we want to know the real size of the file
1291
+ hf_headers["Accept-Encoding"] = "identity" # prevent any compression => we want to know the real size of the file
1294
1292
 
1295
1293
  # Retrieve metadata
1296
1294
  r = _request_wrapper(
1297
1295
  method="HEAD",
1298
1296
  url=url,
1299
- headers=headers,
1297
+ headers=hf_headers,
1300
1298
  allow_redirects=False,
1301
1299
  follow_relative_redirects=True,
1302
1300
  proxies=proxies,