huggingface-hub 0.27.1__tar.gz → 0.28.0__tar.gz

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 (132) hide show
  1. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/MANIFEST.in +1 -0
  2. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/PKG-INFO +1 -1
  3. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/setup.py +2 -1
  4. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/__init__.py +418 -12
  5. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_commit_api.py +33 -4
  6. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_inference_endpoints.py +8 -2
  7. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_local_folder.py +14 -3
  8. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/scan_cache.py +1 -1
  9. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/upload_large_folder.py +1 -1
  10. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/constants.py +7 -2
  11. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/file_download.py +1 -2
  12. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/hf_api.py +65 -84
  13. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_client.py +706 -450
  14. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_common.py +32 -64
  15. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/_async_client.py +722 -470
  16. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/__init__.py +1 -0
  17. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/image_to_image.py +3 -3
  18. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/text_to_audio.py +1 -2
  19. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/text_to_image.py +3 -3
  20. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/text_to_speech.py +3 -6
  21. huggingface_hub-0.28.0/src/huggingface_hub/inference/_generated/types/text_to_video.py +47 -0
  22. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/visual_question_answering.py +1 -1
  23. huggingface_hub-0.28.0/src/huggingface_hub/inference/_providers/__init__.py +89 -0
  24. huggingface_hub-0.28.0/src/huggingface_hub/inference/_providers/fal_ai.py +159 -0
  25. huggingface_hub-0.28.0/src/huggingface_hub/inference/_providers/hf_inference.py +202 -0
  26. huggingface_hub-0.28.0/src/huggingface_hub/inference/_providers/replicate.py +148 -0
  27. huggingface_hub-0.28.0/src/huggingface_hub/inference/_providers/sambanova.py +89 -0
  28. huggingface_hub-0.28.0/src/huggingface_hub/inference/_providers/together.py +153 -0
  29. huggingface_hub-0.28.0/src/huggingface_hub/py.typed +0 -0
  30. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/repocard.py +1 -1
  31. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/repocard_data.py +2 -1
  32. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/serialization/_base.py +1 -1
  33. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/serialization/_torch.py +1 -1
  34. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_fixes.py +25 -13
  35. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_http.py +3 -3
  36. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/logging.py +1 -1
  37. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub.egg-info/PKG-INFO +1 -1
  38. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub.egg-info/SOURCES.txt +8 -0
  39. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub.egg-info/requires.txt +3 -3
  40. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/LICENSE +0 -0
  41. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/README.md +0 -0
  42. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/pyproject.toml +0 -0
  43. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/setup.cfg +0 -0
  44. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_commit_scheduler.py +0 -0
  45. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_login.py +0 -0
  46. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_snapshot_download.py +0 -0
  47. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_space_api.py +0 -0
  48. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_tensorboard_logger.py +0 -0
  49. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_upload_large_folder.py +0 -0
  50. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_webhooks_payload.py +0 -0
  51. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/_webhooks_server.py +0 -0
  52. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/__init__.py +0 -0
  53. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/_cli_utils.py +0 -0
  54. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/delete_cache.py +0 -0
  55. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/download.py +0 -0
  56. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/env.py +0 -0
  57. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/huggingface_cli.py +0 -0
  58. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/lfs.py +0 -0
  59. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/repo_files.py +0 -0
  60. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/tag.py +0 -0
  61. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/upload.py +0 -0
  62. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/user.py +0 -0
  63. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/commands/version.py +0 -0
  64. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/community.py +0 -0
  65. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/errors.py +0 -0
  66. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/fastai_utils.py +0 -0
  67. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/hf_file_system.py +0 -0
  68. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/hub_mixin.py +0 -0
  69. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/__init__.py +0 -0
  70. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/__init__.py +0 -0
  71. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/audio_classification.py +0 -0
  72. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/audio_to_audio.py +0 -0
  73. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +0 -0
  74. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/base.py +0 -0
  75. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/chat_completion.py +0 -0
  76. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/depth_estimation.py +0 -0
  77. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/document_question_answering.py +0 -0
  78. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/feature_extraction.py +0 -0
  79. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/fill_mask.py +0 -0
  80. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/image_classification.py +0 -0
  81. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/image_segmentation.py +0 -0
  82. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/image_to_text.py +0 -0
  83. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/object_detection.py +0 -0
  84. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/question_answering.py +0 -0
  85. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/sentence_similarity.py +0 -0
  86. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/summarization.py +0 -0
  87. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/table_question_answering.py +0 -0
  88. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/text2text_generation.py +0 -0
  89. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/text_classification.py +0 -0
  90. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/text_generation.py +0 -0
  91. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/token_classification.py +0 -0
  92. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/translation.py +0 -0
  93. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/video_classification.py +0 -0
  94. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/zero_shot_classification.py +0 -0
  95. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +0 -0
  96. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +0 -0
  97. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/inference_api.py +0 -0
  98. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/keras_mixin.py +0 -0
  99. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/lfs.py +0 -0
  100. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/repository.py +0 -0
  101. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/serialization/__init__.py +0 -0
  102. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/serialization/_dduf.py +0 -0
  103. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/serialization/_tensorflow.py +0 -0
  104. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/templates/datasetcard_template.md +0 -0
  105. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/templates/modelcard_template.md +0 -0
  106. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/__init__.py +0 -0
  107. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_auth.py +0 -0
  108. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_cache_assets.py +0 -0
  109. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_cache_manager.py +0 -0
  110. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_chunk_utils.py +0 -0
  111. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_datetime.py +0 -0
  112. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_deprecation.py +0 -0
  113. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_experimental.py +0 -0
  114. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_git_credential.py +0 -0
  115. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_headers.py +0 -0
  116. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_hf_folder.py +0 -0
  117. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_lfs.py +0 -0
  118. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_pagination.py +0 -0
  119. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_paths.py +0 -0
  120. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_runtime.py +0 -0
  121. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_safetensors.py +0 -0
  122. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_subprocess.py +0 -0
  123. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_telemetry.py +0 -0
  124. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_typing.py +0 -0
  125. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/_validators.py +0 -0
  126. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/endpoint_helpers.py +0 -0
  127. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/insecure_hashlib.py +0 -0
  128. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/sha.py +0 -0
  129. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub/utils/tqdm.py +0 -0
  130. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub.egg-info/dependency_links.txt +0 -0
  131. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub.egg-info/entry_points.txt +0 -0
  132. {huggingface_hub-0.27.1 → huggingface_hub-0.28.0}/src/huggingface_hub.egg-info/top_level.txt +0 -0
@@ -1,2 +1,3 @@
1
1
  include src/huggingface_hub/templates/modelcard_template.md
2
2
  include src/huggingface_hub/templates/datasetcard_template.md
3
+ include src/huggingface_hub/py.typed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface_hub
3
- Version: 0.27.1
3
+ Version: 0.28.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.
@@ -92,7 +92,7 @@ extras["typing"] = [
92
92
  ]
93
93
 
94
94
  extras["quality"] = [
95
- "ruff>=0.5.0",
95
+ "ruff>=0.9.0",
96
96
  "mypy==1.5.1",
97
97
  "libcst==1.4.0",
98
98
  ]
@@ -138,4 +138,5 @@ setup(
138
138
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
139
139
  ],
140
140
  include_package_data=True,
141
+ package_data={"huggingface_hub": ["py.typed"]}, # Needed for wheel installation
141
142
  )
@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "0.27.1"
49
+ __version__ = "0.28.0"
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
@@ -202,7 +202,6 @@ _SUBMOD_ATTRS = {
202
202
  "get_user_overview",
203
203
  "get_webhook",
204
204
  "grant_access",
205
- "like",
206
205
  "list_accepted_access_requests",
207
206
  "list_collections",
208
207
  "list_datasets",
@@ -399,6 +398,9 @@ _SUBMOD_ATTRS = {
399
398
  "TextToSpeechInput",
400
399
  "TextToSpeechOutput",
401
400
  "TextToSpeechParameters",
401
+ "TextToVideoInput",
402
+ "TextToVideoOutput",
403
+ "TextToVideoParameters",
402
404
  "TokenClassificationAggregationStrategy",
403
405
  "TokenClassificationInput",
404
406
  "TokenClassificationOutputElement",
@@ -494,6 +496,410 @@ _SUBMOD_ATTRS = {
494
496
  ],
495
497
  }
496
498
 
499
+ # WARNING: __all__ is generated automatically, Any manual edit will be lost when re-generating this file !
500
+ #
501
+ # To update the static imports, please run the following command and commit the changes.
502
+ # ```
503
+ # # Use script
504
+ # python utils/check_all_variable.py --update
505
+ #
506
+ # # Or run style on codebase
507
+ # make style
508
+ # ```
509
+
510
+ __all__ = [
511
+ "AsyncInferenceClient",
512
+ "AudioClassificationInput",
513
+ "AudioClassificationOutputElement",
514
+ "AudioClassificationOutputTransform",
515
+ "AudioClassificationParameters",
516
+ "AudioToAudioInput",
517
+ "AudioToAudioOutputElement",
518
+ "AutomaticSpeechRecognitionEarlyStoppingEnum",
519
+ "AutomaticSpeechRecognitionGenerationParameters",
520
+ "AutomaticSpeechRecognitionInput",
521
+ "AutomaticSpeechRecognitionOutput",
522
+ "AutomaticSpeechRecognitionOutputChunk",
523
+ "AutomaticSpeechRecognitionParameters",
524
+ "CONFIG_NAME",
525
+ "CacheNotFound",
526
+ "CachedFileInfo",
527
+ "CachedRepoInfo",
528
+ "CachedRevisionInfo",
529
+ "CardData",
530
+ "ChatCompletionInput",
531
+ "ChatCompletionInputFunctionDefinition",
532
+ "ChatCompletionInputFunctionName",
533
+ "ChatCompletionInputGrammarType",
534
+ "ChatCompletionInputGrammarTypeType",
535
+ "ChatCompletionInputMessage",
536
+ "ChatCompletionInputMessageChunk",
537
+ "ChatCompletionInputMessageChunkType",
538
+ "ChatCompletionInputStreamOptions",
539
+ "ChatCompletionInputTool",
540
+ "ChatCompletionInputToolChoiceClass",
541
+ "ChatCompletionInputToolChoiceEnum",
542
+ "ChatCompletionInputURL",
543
+ "ChatCompletionOutput",
544
+ "ChatCompletionOutputComplete",
545
+ "ChatCompletionOutputFunctionDefinition",
546
+ "ChatCompletionOutputLogprob",
547
+ "ChatCompletionOutputLogprobs",
548
+ "ChatCompletionOutputMessage",
549
+ "ChatCompletionOutputToolCall",
550
+ "ChatCompletionOutputTopLogprob",
551
+ "ChatCompletionOutputUsage",
552
+ "ChatCompletionStreamOutput",
553
+ "ChatCompletionStreamOutputChoice",
554
+ "ChatCompletionStreamOutputDelta",
555
+ "ChatCompletionStreamOutputDeltaToolCall",
556
+ "ChatCompletionStreamOutputFunction",
557
+ "ChatCompletionStreamOutputLogprob",
558
+ "ChatCompletionStreamOutputLogprobs",
559
+ "ChatCompletionStreamOutputTopLogprob",
560
+ "ChatCompletionStreamOutputUsage",
561
+ "Collection",
562
+ "CollectionItem",
563
+ "CommitInfo",
564
+ "CommitOperation",
565
+ "CommitOperationAdd",
566
+ "CommitOperationCopy",
567
+ "CommitOperationDelete",
568
+ "CommitScheduler",
569
+ "CorruptedCacheException",
570
+ "DDUFEntry",
571
+ "DatasetCard",
572
+ "DatasetCardData",
573
+ "DatasetInfo",
574
+ "DeleteCacheStrategy",
575
+ "DepthEstimationInput",
576
+ "DepthEstimationOutput",
577
+ "Discussion",
578
+ "DiscussionComment",
579
+ "DiscussionCommit",
580
+ "DiscussionEvent",
581
+ "DiscussionStatusChange",
582
+ "DiscussionTitleChange",
583
+ "DiscussionWithDetails",
584
+ "DocumentQuestionAnsweringInput",
585
+ "DocumentQuestionAnsweringInputData",
586
+ "DocumentQuestionAnsweringOutputElement",
587
+ "DocumentQuestionAnsweringParameters",
588
+ "EvalResult",
589
+ "FLAX_WEIGHTS_NAME",
590
+ "FeatureExtractionInput",
591
+ "FeatureExtractionInputTruncationDirection",
592
+ "FillMaskInput",
593
+ "FillMaskOutputElement",
594
+ "FillMaskParameters",
595
+ "GitCommitInfo",
596
+ "GitRefInfo",
597
+ "GitRefs",
598
+ "HFCacheInfo",
599
+ "HFSummaryWriter",
600
+ "HUGGINGFACE_CO_URL_HOME",
601
+ "HUGGINGFACE_CO_URL_TEMPLATE",
602
+ "HfApi",
603
+ "HfFileMetadata",
604
+ "HfFileSystem",
605
+ "HfFileSystemFile",
606
+ "HfFileSystemResolvedPath",
607
+ "HfFileSystemStreamFile",
608
+ "HfFolder",
609
+ "ImageClassificationInput",
610
+ "ImageClassificationOutputElement",
611
+ "ImageClassificationOutputTransform",
612
+ "ImageClassificationParameters",
613
+ "ImageSegmentationInput",
614
+ "ImageSegmentationOutputElement",
615
+ "ImageSegmentationParameters",
616
+ "ImageSegmentationSubtask",
617
+ "ImageToImageInput",
618
+ "ImageToImageOutput",
619
+ "ImageToImageParameters",
620
+ "ImageToImageTargetSize",
621
+ "ImageToTextEarlyStoppingEnum",
622
+ "ImageToTextGenerationParameters",
623
+ "ImageToTextInput",
624
+ "ImageToTextOutput",
625
+ "ImageToTextParameters",
626
+ "InferenceApi",
627
+ "InferenceClient",
628
+ "InferenceEndpoint",
629
+ "InferenceEndpointError",
630
+ "InferenceEndpointStatus",
631
+ "InferenceEndpointTimeoutError",
632
+ "InferenceEndpointType",
633
+ "InferenceTimeoutError",
634
+ "KerasModelHubMixin",
635
+ "ModelCard",
636
+ "ModelCardData",
637
+ "ModelHubMixin",
638
+ "ModelInfo",
639
+ "ObjectDetectionBoundingBox",
640
+ "ObjectDetectionInput",
641
+ "ObjectDetectionOutputElement",
642
+ "ObjectDetectionParameters",
643
+ "PYTORCH_WEIGHTS_NAME",
644
+ "Padding",
645
+ "PyTorchModelHubMixin",
646
+ "QuestionAnsweringInput",
647
+ "QuestionAnsweringInputData",
648
+ "QuestionAnsweringOutputElement",
649
+ "QuestionAnsweringParameters",
650
+ "REPO_TYPE_DATASET",
651
+ "REPO_TYPE_MODEL",
652
+ "REPO_TYPE_SPACE",
653
+ "RepoCard",
654
+ "RepoUrl",
655
+ "Repository",
656
+ "SentenceSimilarityInput",
657
+ "SentenceSimilarityInputData",
658
+ "SpaceCard",
659
+ "SpaceCardData",
660
+ "SpaceHardware",
661
+ "SpaceInfo",
662
+ "SpaceRuntime",
663
+ "SpaceStage",
664
+ "SpaceStorage",
665
+ "SpaceVariable",
666
+ "StateDictSplit",
667
+ "SummarizationInput",
668
+ "SummarizationOutput",
669
+ "SummarizationParameters",
670
+ "SummarizationTruncationStrategy",
671
+ "TF2_WEIGHTS_NAME",
672
+ "TF_WEIGHTS_NAME",
673
+ "TableQuestionAnsweringInput",
674
+ "TableQuestionAnsweringInputData",
675
+ "TableQuestionAnsweringOutputElement",
676
+ "TableQuestionAnsweringParameters",
677
+ "Text2TextGenerationInput",
678
+ "Text2TextGenerationOutput",
679
+ "Text2TextGenerationParameters",
680
+ "Text2TextGenerationTruncationStrategy",
681
+ "TextClassificationInput",
682
+ "TextClassificationOutputElement",
683
+ "TextClassificationOutputTransform",
684
+ "TextClassificationParameters",
685
+ "TextGenerationInput",
686
+ "TextGenerationInputGenerateParameters",
687
+ "TextGenerationInputGrammarType",
688
+ "TextGenerationOutput",
689
+ "TextGenerationOutputBestOfSequence",
690
+ "TextGenerationOutputDetails",
691
+ "TextGenerationOutputFinishReason",
692
+ "TextGenerationOutputPrefillToken",
693
+ "TextGenerationOutputToken",
694
+ "TextGenerationStreamOutput",
695
+ "TextGenerationStreamOutputStreamDetails",
696
+ "TextGenerationStreamOutputToken",
697
+ "TextToAudioEarlyStoppingEnum",
698
+ "TextToAudioGenerationParameters",
699
+ "TextToAudioInput",
700
+ "TextToAudioOutput",
701
+ "TextToAudioParameters",
702
+ "TextToImageInput",
703
+ "TextToImageOutput",
704
+ "TextToImageParameters",
705
+ "TextToImageTargetSize",
706
+ "TextToSpeechEarlyStoppingEnum",
707
+ "TextToSpeechGenerationParameters",
708
+ "TextToSpeechInput",
709
+ "TextToSpeechOutput",
710
+ "TextToSpeechParameters",
711
+ "TextToVideoInput",
712
+ "TextToVideoOutput",
713
+ "TextToVideoParameters",
714
+ "TokenClassificationAggregationStrategy",
715
+ "TokenClassificationInput",
716
+ "TokenClassificationOutputElement",
717
+ "TokenClassificationParameters",
718
+ "TranslationInput",
719
+ "TranslationOutput",
720
+ "TranslationParameters",
721
+ "TranslationTruncationStrategy",
722
+ "TypeEnum",
723
+ "User",
724
+ "UserLikes",
725
+ "VideoClassificationInput",
726
+ "VideoClassificationOutputElement",
727
+ "VideoClassificationOutputTransform",
728
+ "VideoClassificationParameters",
729
+ "VisualQuestionAnsweringInput",
730
+ "VisualQuestionAnsweringInputData",
731
+ "VisualQuestionAnsweringOutputElement",
732
+ "VisualQuestionAnsweringParameters",
733
+ "WebhookInfo",
734
+ "WebhookPayload",
735
+ "WebhookPayloadComment",
736
+ "WebhookPayloadDiscussion",
737
+ "WebhookPayloadDiscussionChanges",
738
+ "WebhookPayloadEvent",
739
+ "WebhookPayloadMovedTo",
740
+ "WebhookPayloadRepo",
741
+ "WebhookPayloadUrl",
742
+ "WebhookPayloadWebhook",
743
+ "WebhookWatchedItem",
744
+ "WebhooksServer",
745
+ "ZeroShotClassificationInput",
746
+ "ZeroShotClassificationOutputElement",
747
+ "ZeroShotClassificationParameters",
748
+ "ZeroShotImageClassificationInput",
749
+ "ZeroShotImageClassificationOutputElement",
750
+ "ZeroShotImageClassificationParameters",
751
+ "ZeroShotObjectDetectionBoundingBox",
752
+ "ZeroShotObjectDetectionInput",
753
+ "ZeroShotObjectDetectionOutputElement",
754
+ "ZeroShotObjectDetectionParameters",
755
+ "_CACHED_NO_EXIST",
756
+ "_save_pretrained_fastai",
757
+ "accept_access_request",
758
+ "add_collection_item",
759
+ "add_space_secret",
760
+ "add_space_variable",
761
+ "auth_check",
762
+ "auth_list",
763
+ "auth_switch",
764
+ "cached_assets_path",
765
+ "cancel_access_request",
766
+ "change_discussion_status",
767
+ "comment_discussion",
768
+ "configure_http_backend",
769
+ "create_branch",
770
+ "create_collection",
771
+ "create_commit",
772
+ "create_discussion",
773
+ "create_inference_endpoint",
774
+ "create_pull_request",
775
+ "create_repo",
776
+ "create_tag",
777
+ "create_webhook",
778
+ "dataset_info",
779
+ "delete_branch",
780
+ "delete_collection",
781
+ "delete_collection_item",
782
+ "delete_file",
783
+ "delete_folder",
784
+ "delete_inference_endpoint",
785
+ "delete_repo",
786
+ "delete_space_secret",
787
+ "delete_space_storage",
788
+ "delete_space_variable",
789
+ "delete_tag",
790
+ "delete_webhook",
791
+ "disable_webhook",
792
+ "dump_environment_info",
793
+ "duplicate_space",
794
+ "edit_discussion_comment",
795
+ "enable_webhook",
796
+ "export_entries_as_dduf",
797
+ "export_folder_as_dduf",
798
+ "file_exists",
799
+ "from_pretrained_fastai",
800
+ "from_pretrained_keras",
801
+ "get_collection",
802
+ "get_dataset_tags",
803
+ "get_discussion_details",
804
+ "get_full_repo_name",
805
+ "get_hf_file_metadata",
806
+ "get_inference_endpoint",
807
+ "get_model_tags",
808
+ "get_paths_info",
809
+ "get_repo_discussions",
810
+ "get_safetensors_metadata",
811
+ "get_session",
812
+ "get_space_runtime",
813
+ "get_space_variables",
814
+ "get_tf_storage_size",
815
+ "get_token",
816
+ "get_token_permission",
817
+ "get_torch_storage_id",
818
+ "get_torch_storage_size",
819
+ "get_user_overview",
820
+ "get_webhook",
821
+ "grant_access",
822
+ "hf_hub_download",
823
+ "hf_hub_url",
824
+ "interpreter_login",
825
+ "list_accepted_access_requests",
826
+ "list_collections",
827
+ "list_datasets",
828
+ "list_inference_endpoints",
829
+ "list_liked_repos",
830
+ "list_models",
831
+ "list_organization_members",
832
+ "list_papers",
833
+ "list_pending_access_requests",
834
+ "list_rejected_access_requests",
835
+ "list_repo_commits",
836
+ "list_repo_files",
837
+ "list_repo_likers",
838
+ "list_repo_refs",
839
+ "list_repo_tree",
840
+ "list_spaces",
841
+ "list_user_followers",
842
+ "list_user_following",
843
+ "list_webhooks",
844
+ "load_state_dict_from_file",
845
+ "load_torch_model",
846
+ "logging",
847
+ "login",
848
+ "logout",
849
+ "merge_pull_request",
850
+ "metadata_eval_result",
851
+ "metadata_load",
852
+ "metadata_save",
853
+ "metadata_update",
854
+ "model_info",
855
+ "move_repo",
856
+ "notebook_login",
857
+ "paper_info",
858
+ "parse_safetensors_file_metadata",
859
+ "pause_inference_endpoint",
860
+ "pause_space",
861
+ "preupload_lfs_files",
862
+ "push_to_hub_fastai",
863
+ "push_to_hub_keras",
864
+ "read_dduf_file",
865
+ "reject_access_request",
866
+ "rename_discussion",
867
+ "repo_exists",
868
+ "repo_info",
869
+ "repo_type_and_id_from_hf_id",
870
+ "request_space_hardware",
871
+ "request_space_storage",
872
+ "restart_space",
873
+ "resume_inference_endpoint",
874
+ "revision_exists",
875
+ "run_as_future",
876
+ "save_pretrained_keras",
877
+ "save_torch_model",
878
+ "save_torch_state_dict",
879
+ "scale_to_zero_inference_endpoint",
880
+ "scan_cache_dir",
881
+ "set_space_sleep_time",
882
+ "snapshot_download",
883
+ "space_info",
884
+ "split_state_dict_into_shards_factory",
885
+ "split_tf_state_dict_into_shards",
886
+ "split_torch_state_dict_into_shards",
887
+ "super_squash_history",
888
+ "try_to_load_from_cache",
889
+ "unlike",
890
+ "update_collection_item",
891
+ "update_collection_metadata",
892
+ "update_inference_endpoint",
893
+ "update_repo_settings",
894
+ "update_repo_visibility",
895
+ "update_webhook",
896
+ "upload_file",
897
+ "upload_folder",
898
+ "upload_large_folder",
899
+ "webhook_endpoint",
900
+ "whoami",
901
+ ]
902
+
497
903
 
498
904
  def _attach(package_name, submodules=None, submod_attrs=None):
499
905
  """Attach lazily loaded submodules, functions, or other attributes.
@@ -507,14 +913,14 @@ def _attach(package_name, submodules=None, submod_attrs=None):
507
913
  from .foo import someattr
508
914
  ```
509
915
 
510
- The idea is to replace a package's `__getattr__`, `__dir__`, and
511
- `__all__`, such that all imports work exactly the way they would
512
- with normal imports, except that the import occurs upon first use.
916
+ The idea is to replace a package's `__getattr__`, `__dir__`, such that all imports
917
+ work exactly the way they would with normal imports, except that the import occurs
918
+ upon first use.
513
919
 
514
920
  The typical way to call this function, replacing the above imports, is:
515
921
 
516
922
  ```python
517
- __getattr__, __dir__, __all__ = lazy.attach(
923
+ __getattr__, __dir__ = lazy.attach(
518
924
  __name__,
519
925
  ['mysubmodule', 'anothersubmodule'],
520
926
  {'foo': ['someattr']}
@@ -545,8 +951,6 @@ def _attach(package_name, submodules=None, submod_attrs=None):
545
951
 
546
952
  attr_to_modules = {attr: mod for mod, attrs in submod_attrs.items() for attr in attrs}
547
953
 
548
- __all__ = list(submodules | attr_to_modules.keys())
549
-
550
954
  def __getattr__(name):
551
955
  if name in submodules:
552
956
  try:
@@ -577,10 +981,10 @@ def _attach(package_name, submodules=None, submod_attrs=None):
577
981
  def __dir__():
578
982
  return __all__
579
983
 
580
- return __getattr__, __dir__, list(__all__)
984
+ return __getattr__, __dir__
581
985
 
582
986
 
583
- __getattr__, __dir__, __all__ = _attach(__name__, submodules=[], submod_attrs=_SUBMOD_ATTRS)
987
+ __getattr__, __dir__ = _attach(__name__, submodules=[], submod_attrs=_SUBMOD_ATTRS)
584
988
 
585
989
  if os.environ.get("EAGER_IMPORT", ""):
586
990
  for attr in __all__:
@@ -592,7 +996,7 @@ if os.environ.get("EAGER_IMPORT", ""):
592
996
  # To update the static imports, please run the following command and commit the changes.
593
997
  # ```
594
998
  # # Use script
595
- # python utils/check_static_imports.py --update-file
999
+ # python utils/check_static_imports.py --update
596
1000
  #
597
1001
  # # Or run style on codebase
598
1002
  # make style
@@ -742,7 +1146,6 @@ if TYPE_CHECKING: # pragma: no cover
742
1146
  get_user_overview, # noqa: F401
743
1147
  get_webhook, # noqa: F401
744
1148
  grant_access, # noqa: F401
745
- like, # noqa: F401
746
1149
  list_accepted_access_requests, # noqa: F401
747
1150
  list_collections, # noqa: F401
748
1151
  list_datasets, # noqa: F401
@@ -937,6 +1340,9 @@ if TYPE_CHECKING: # pragma: no cover
937
1340
  TextToSpeechInput, # noqa: F401
938
1341
  TextToSpeechOutput, # noqa: F401
939
1342
  TextToSpeechParameters, # noqa: F401
1343
+ TextToVideoInput, # noqa: F401
1344
+ TextToVideoOutput, # noqa: F401
1345
+ TextToVideoParameters, # noqa: F401
940
1346
  TokenClassificationAggregationStrategy, # noqa: F401
941
1347
  TokenClassificationInput, # noqa: F401
942
1348
  TokenClassificationOutputElement, # noqa: F401
@@ -103,6 +103,12 @@ class CommitOperationCopy:
103
103
  src_path_in_repo: str
104
104
  path_in_repo: str
105
105
  src_revision: Optional[str] = None
106
+ # set to the OID of the file to be copied if it has already been uploaded
107
+ # useful to determine if a commit will be empty or not.
108
+ _src_oid: Optional[str] = None
109
+ # set to the OID of the file to copy to if it has already been uploaded
110
+ # useful to determine if a commit will be empty or not.
111
+ _dest_oid: Optional[str] = None
106
112
 
107
113
  def __post_init__(self):
108
114
  self.src_path_in_repo = _validate_path_in_repo(self.src_path_in_repo)
@@ -400,7 +406,7 @@ def _upload_lfs_files(
400
406
  if batch_errors_chunk:
401
407
  message = "\n".join(
402
408
  [
403
- f'Encountered error for file with OID {err.get("oid")}: `{err.get("error", {}).get("message")}'
409
+ f"Encountered error for file with OID {err.get('oid')}: `{err.get('error', {}).get('message')}"
404
410
  for err in batch_errors_chunk
405
411
  ]
406
412
  )
@@ -595,19 +601,38 @@ def _fetch_files_to_copy(
595
601
 
596
602
  hf_api = HfApi(endpoint=endpoint, headers=headers)
597
603
  files_to_copy: Dict[Tuple[str, Optional[str]], Union["RepoFile", bytes]] = {}
604
+ # Store (path, revision) -> oid mapping
605
+ oid_info: Dict[Tuple[str, Optional[str]], Optional[str]] = {}
606
+ # 1. Fetch OIDs for destination paths in batches.
607
+ dest_paths = [op.path_in_repo for op in copies]
608
+ for offset in range(0, len(dest_paths), FETCH_LFS_BATCH_SIZE):
609
+ dest_repo_files = hf_api.get_paths_info(
610
+ repo_id=repo_id,
611
+ paths=dest_paths[offset : offset + FETCH_LFS_BATCH_SIZE],
612
+ revision=revision,
613
+ repo_type=repo_type,
614
+ )
615
+ for file in dest_repo_files:
616
+ if not isinstance(file, RepoFolder):
617
+ oid_info[(file.path, revision)] = file.blob_id
618
+
619
+ # 2. Group by source revision and fetch source file info in batches.
598
620
  for src_revision, operations in groupby(copies, key=lambda op: op.src_revision):
599
621
  operations = list(operations) # type: ignore
600
- paths = [op.src_path_in_repo for op in operations]
601
- for offset in range(0, len(paths), FETCH_LFS_BATCH_SIZE):
622
+ src_paths = [op.src_path_in_repo for op in operations]
623
+ for offset in range(0, len(src_paths), FETCH_LFS_BATCH_SIZE):
602
624
  src_repo_files = hf_api.get_paths_info(
603
625
  repo_id=repo_id,
604
- paths=paths[offset : offset + FETCH_LFS_BATCH_SIZE],
626
+ paths=src_paths[offset : offset + FETCH_LFS_BATCH_SIZE],
605
627
  revision=src_revision or revision,
606
628
  repo_type=repo_type,
607
629
  )
630
+
608
631
  for src_repo_file in src_repo_files:
609
632
  if isinstance(src_repo_file, RepoFolder):
610
633
  raise NotImplementedError("Copying a folder is not implemented.")
634
+ oid_info[(src_repo_file.path, src_revision)] = src_repo_file.blob_id
635
+ # If it's an LFS file, store the RepoFile object. Otherwise, download raw bytes.
611
636
  if src_repo_file.lfs:
612
637
  files_to_copy[(src_repo_file.path, src_revision)] = src_repo_file
613
638
  else:
@@ -622,12 +647,16 @@ def _fetch_files_to_copy(
622
647
  response = get_session().get(url, headers=headers)
623
648
  hf_raise_for_status(response)
624
649
  files_to_copy[(src_repo_file.path, src_revision)] = response.content
650
+ # 3. Ensure all operations found a corresponding file in the Hub
651
+ # and track src/dest OIDs for each operation.
625
652
  for operation in operations:
626
653
  if (operation.src_path_in_repo, src_revision) not in files_to_copy:
627
654
  raise EntryNotFoundError(
628
655
  f"Cannot copy {operation.src_path_in_repo} at revision "
629
656
  f"{src_revision or revision}: file is missing on repo."
630
657
  )
658
+ operation._src_oid = oid_info.get((operation.src_path_in_repo, operation.src_revision))
659
+ operation._dest_oid = oid_info.get((operation.path_in_repo, revision))
631
660
  return files_to_copy
632
661
 
633
662
 
@@ -152,7 +152,10 @@ class InferenceEndpoint:
152
152
  "Cannot create a client for this Inference Endpoint as it is not yet deployed. "
153
153
  "Please wait for the Inference Endpoint to be deployed using `endpoint.wait()` and try again."
154
154
  )
155
- return InferenceClient(model=self.url, token=self._token)
155
+ return InferenceClient(
156
+ model=self.url,
157
+ token=self._token, # type: ignore[arg-type] # boolean token shouldn't be possible. In practice it's ok.
158
+ )
156
159
 
157
160
  @property
158
161
  def async_client(self) -> AsyncInferenceClient:
@@ -169,7 +172,10 @@ class InferenceEndpoint:
169
172
  "Cannot create a client for this Inference Endpoint as it is not yet deployed. "
170
173
  "Please wait for the Inference Endpoint to be deployed using `endpoint.wait()` and try again."
171
174
  )
172
- return AsyncInferenceClient(model=self.url, token=self._token)
175
+ return AsyncInferenceClient(
176
+ model=self.url,
177
+ token=self._token, # type: ignore[arg-type] # boolean token shouldn't be possible. In practice it's ok.
178
+ )
173
179
 
174
180
  def wait(self, timeout: Optional[int] = None, refresh_every: int = 5) -> "InferenceEndpoint":
175
181
  """Wait for the Inference Endpoint to be deployed.
@@ -49,6 +49,8 @@ a16a55fda99d2f2e7b69cce5cf93ff4ad3049930
49
49
  ```
50
50
  """
51
51
 
52
+ import base64
53
+ import hashlib
52
54
  import logging
53
55
  import os
54
56
  import time
@@ -84,7 +86,7 @@ class LocalDownloadFilePaths:
84
86
 
85
87
  def incomplete_path(self, etag: str) -> Path:
86
88
  """Return the path where a file will be temporarily downloaded before being moved to `file_path`."""
87
- return self.metadata_path.with_suffix(f".{etag}.incomplete")
89
+ return self.metadata_path.parent / f"{_short_hash(self.metadata_path.name)}.{etag}.incomplete"
88
90
 
89
91
 
90
92
  @dataclass(frozen=True)
@@ -413,9 +415,18 @@ def _huggingface_dir(local_dir: Path) -> Path:
413
415
  gitignore_lock = path / ".gitignore.lock"
414
416
  if not gitignore.exists():
415
417
  try:
416
- with WeakFileLock(gitignore_lock):
418
+ with WeakFileLock(gitignore_lock, timeout=0.1):
417
419
  gitignore.write_text("*")
420
+ except IndexError:
421
+ pass
422
+ except OSError: # TimeoutError, FileNotFoundError, PermissionError, etc.
423
+ pass
424
+ try:
418
425
  gitignore_lock.unlink()
419
- except OSError: # FileNotFoundError, PermissionError, etc.
426
+ except OSError:
420
427
  pass
421
428
  return path
429
+
430
+
431
+ def _short_hash(filename: str) -> str:
432
+ return base64.urlsafe_b64encode(hashlib.sha1(filename.encode()).digest()).decode()
@@ -67,7 +67,7 @@ class ScanCacheCommand(BaseHuggingfaceCLICommand):
67
67
  self._print_hf_cache_info_as_table(hf_cache_info)
68
68
 
69
69
  print(
70
- f"\nDone in {round(t1-t0,1)}s. Scanned {len(hf_cache_info.repos)} repo(s)"
70
+ f"\nDone in {round(t1 - t0, 1)}s. Scanned {len(hf_cache_info.repos)} repo(s)"
71
71
  f" for a total of {ANSI.red(hf_cache_info.size_on_disk_str)}."
72
72
  )
73
73
  if len(hf_cache_info.warnings) > 0: