__init__.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. # coding=utf-8
  2. # Copyright 2021 The HuggingFace Inc. team. All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License
  15. # ruff: noqa: F401
  16. from huggingface_hub.errors import (
  17. BadRequestError,
  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. scan_cache_dir,
  44. )
  45. from ._chunk_utils import chunk_iterable
  46. from ._datetime import parse_datetime
  47. from ._experimental import experimental
  48. from ._fixes import SoftTemporaryDirectory, WeakFileLock, yaml_dump
  49. from ._git_credential import list_credential_helpers, set_git_credential, unset_git_credential
  50. from ._headers import build_hf_headers, get_token_to_send
  51. from ._hf_folder import HfFolder
  52. from ._http import (
  53. configure_http_backend,
  54. fix_hf_endpoint_in_url,
  55. get_session,
  56. hf_raise_for_status,
  57. http_backoff,
  58. reset_sessions,
  59. )
  60. from ._pagination import paginate
  61. from ._paths import DEFAULT_IGNORE_PATTERNS, FORBIDDEN_FOLDERS, filter_repo_objects
  62. from ._runtime import (
  63. dump_environment_info,
  64. get_aiohttp_version,
  65. get_fastai_version,
  66. get_fastapi_version,
  67. get_fastcore_version,
  68. get_gradio_version,
  69. get_graphviz_version,
  70. get_hf_hub_version,
  71. get_hf_transfer_version,
  72. get_jinja_version,
  73. get_numpy_version,
  74. get_pillow_version,
  75. get_pydantic_version,
  76. get_pydot_version,
  77. get_python_version,
  78. get_tensorboard_version,
  79. get_tf_version,
  80. get_torch_version,
  81. is_aiohttp_available,
  82. is_colab_enterprise,
  83. is_fastai_available,
  84. is_fastapi_available,
  85. is_fastcore_available,
  86. is_google_colab,
  87. is_gradio_available,
  88. is_graphviz_available,
  89. is_hf_transfer_available,
  90. is_jinja_available,
  91. is_notebook,
  92. is_numpy_available,
  93. is_package_available,
  94. is_pillow_available,
  95. is_pydantic_available,
  96. is_pydot_available,
  97. is_safetensors_available,
  98. is_tensorboard_available,
  99. is_tf_available,
  100. is_torch_available,
  101. )
  102. from ._safetensors import SafetensorsFileMetadata, SafetensorsRepoMetadata, TensorInfo
  103. from ._subprocess import capture_output, run_interactive_subprocess, run_subprocess
  104. from ._telemetry import send_telemetry
  105. from ._typing import is_jsonable, is_simple_optional_type, unwrap_simple_optional_type
  106. from ._validators import smoothly_deprecate_use_auth_token, validate_hf_hub_args, validate_repo_id
  107. from ._xet import (
  108. XetConnectionInfo,
  109. XetFileData,
  110. XetTokenType,
  111. fetch_xet_connection_info_from_repo_info,
  112. parse_xet_file_data_from_response,
  113. refresh_xet_connection_info,
  114. )
  115. from .tqdm import are_progress_bars_disabled, disable_progress_bars, enable_progress_bars, tqdm, tqdm_stream_file