__init__.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Copyright 2021 The HuggingFace Inc. 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. # ruff: noqa: F401
  15. from huggingface_hub.errors import (
  16. BadRequestError,
  17. BucketNotFoundError,
  18. CacheNotFound,
  19. CorruptedCacheException,
  20. DisabledRepoError,
  21. EntryNotFoundError,
  22. FileMetadataError,
  23. GatedRepoError,
  24. HfHubHTTPError,
  25. HFValidationError,
  26. LocalEntryNotFoundError,
  27. LocalTokenNotFoundError,
  28. NotASafetensorsRepoError,
  29. OfflineModeIsEnabled,
  30. RepositoryNotFoundError,
  31. RevisionNotFoundError,
  32. SafetensorsParsingError,
  33. )
  34. from . import tqdm as _tqdm # _tqdm is the module
  35. from ._auth import get_stored_tokens, get_token
  36. from ._cache_assets import cached_assets_path
  37. from ._cache_manager import (
  38. CachedFileInfo,
  39. CachedRepoInfo,
  40. CachedRevisionInfo,
  41. DeleteCacheStrategy,
  42. HFCacheInfo,
  43. _format_size,
  44. scan_cache_dir,
  45. )
  46. from ._chunk_utils import chunk_iterable
  47. from ._datetime import parse_datetime
  48. from ._detect_agent import detect_agent, is_agent
  49. from ._experimental import experimental
  50. from ._fixes import SoftTemporaryDirectory, WeakFileLock, yaml_dump
  51. from ._git_credential import list_credential_helpers, set_git_credential, unset_git_credential
  52. from ._headers import build_hf_headers, get_token_to_send
  53. from ._http import (
  54. ASYNC_CLIENT_FACTORY_T,
  55. CLIENT_FACTORY_T,
  56. RateLimitInfo,
  57. close_session,
  58. fix_hf_endpoint_in_url,
  59. get_async_session,
  60. get_session,
  61. hf_raise_for_status,
  62. http_backoff,
  63. http_stream_backoff,
  64. parse_ratelimit_headers,
  65. set_async_client_factory,
  66. set_client_factory,
  67. )
  68. from ._pagination import paginate
  69. from ._paths import DEFAULT_IGNORE_PATTERNS, FORBIDDEN_FOLDERS, filter_repo_objects
  70. from ._runtime import (
  71. dump_environment_info,
  72. get_aiohttp_version,
  73. get_fastai_version,
  74. get_fastapi_version,
  75. get_fastcore_version,
  76. get_gradio_version,
  77. get_graphviz_version,
  78. get_hf_hub_version,
  79. get_jinja_version,
  80. get_numpy_version,
  81. get_pillow_version,
  82. get_pydantic_version,
  83. get_pydot_version,
  84. get_python_version,
  85. get_tensorboard_version,
  86. get_tf_version,
  87. get_torch_version,
  88. installation_method,
  89. is_aiohttp_available,
  90. is_colab_enterprise,
  91. is_fastai_available,
  92. is_fastapi_available,
  93. is_fastcore_available,
  94. is_google_colab,
  95. is_gradio_available,
  96. is_graphviz_available,
  97. is_jinja_available,
  98. is_notebook,
  99. is_numpy_available,
  100. is_package_available,
  101. is_pillow_available,
  102. is_pydantic_available,
  103. is_pydot_available,
  104. is_safetensors_available,
  105. is_tensorboard_available,
  106. is_tf_available,
  107. is_torch_available,
  108. )
  109. from ._safetensors import SafetensorsFileMetadata, SafetensorsRepoMetadata, TensorInfo
  110. from ._subprocess import capture_output, run_interactive_subprocess, run_subprocess
  111. from ._telemetry import send_telemetry
  112. from ._terminal import ANSI, StatusLine, tabulate
  113. from ._typing import is_jsonable, is_simple_optional_type, unwrap_simple_optional_type
  114. from ._validators import validate_hf_hub_args, validate_repo_id
  115. from ._xet import (
  116. XetConnectionInfo,
  117. XetFileData,
  118. XetTokenType,
  119. fetch_xet_connection_info_from_repo_info,
  120. parse_xet_file_data_from_response,
  121. refresh_xet_connection_info,
  122. )
  123. from .tqdm import (
  124. are_progress_bars_disabled,
  125. disable_progress_bars,
  126. enable_progress_bars,
  127. is_tqdm_disabled,
  128. silent_tqdm,
  129. tqdm,
  130. tqdm_stream_file,
  131. )