file_utils.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Copyright 2020 The HuggingFace 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. """
  15. File utilities: utilities related to download and cache models
  16. This module should not be update anymore and is only left for backward compatibility.
  17. """
  18. from huggingface_hub import get_full_repo_name # for backward compatibility
  19. from huggingface_hub.constants import HF_HUB_DISABLE_TELEMETRY as DISABLE_TELEMETRY # for backward compatibility
  20. from . import __version__
  21. # Backward compatibility imports, to make sure all those objects can be found in file_utils
  22. from .utils import (
  23. CLOUDFRONT_DISTRIB_PREFIX,
  24. CONFIG_NAME,
  25. DUMMY_INPUTS,
  26. DUMMY_MASK,
  27. ENV_VARS_TRUE_AND_AUTO_VALUES,
  28. ENV_VARS_TRUE_VALUES,
  29. FEATURE_EXTRACTOR_NAME,
  30. FLAX_WEIGHTS_NAME,
  31. HF_MODULES_CACHE,
  32. HUGGINGFACE_CO_PREFIX,
  33. HUGGINGFACE_CO_RESOLVE_ENDPOINT,
  34. MODEL_CARD_NAME,
  35. MULTIPLE_CHOICE_DUMMY_INPUTS,
  36. PYTORCH_PRETRAINED_BERT_CACHE,
  37. PYTORCH_TRANSFORMERS_CACHE,
  38. S3_BUCKET_PREFIX,
  39. SENTENCEPIECE_UNDERLINE,
  40. SPIECE_UNDERLINE,
  41. TF2_WEIGHTS_NAME,
  42. TF_WEIGHTS_NAME,
  43. TORCH_FX_REQUIRED_VERSION,
  44. TRANSFORMERS_CACHE,
  45. TRANSFORMERS_DYNAMIC_MODULE_NAME,
  46. USE_JAX,
  47. USE_TF,
  48. USE_TORCH,
  49. WEIGHTS_INDEX_NAME,
  50. WEIGHTS_NAME,
  51. ContextManagers,
  52. DummyObject,
  53. EntryNotFoundError,
  54. ExplicitEnum,
  55. ModelOutput,
  56. PaddingStrategy,
  57. PushToHubMixin,
  58. RepositoryNotFoundError,
  59. RevisionNotFoundError,
  60. TensorType,
  61. _LazyModule,
  62. add_code_sample_docstrings,
  63. add_end_docstrings,
  64. add_start_docstrings,
  65. add_start_docstrings_to_model_forward,
  66. cached_property,
  67. copy_func,
  68. default_cache_path,
  69. define_sagemaker_information,
  70. get_cached_models,
  71. get_file_from_repo,
  72. get_torch_version,
  73. has_file,
  74. http_user_agent,
  75. is_apex_available,
  76. is_bs4_available,
  77. is_coloredlogs_available,
  78. is_datasets_available,
  79. is_detectron2_available,
  80. is_faiss_available,
  81. is_flax_available,
  82. is_ftfy_available,
  83. is_g2p_en_available,
  84. is_in_notebook,
  85. is_ipex_available,
  86. is_librosa_available,
  87. is_offline_mode,
  88. is_onnx_available,
  89. is_pandas_available,
  90. is_phonemizer_available,
  91. is_protobuf_available,
  92. is_psutil_available,
  93. is_py3nvml_available,
  94. is_pyctcdecode_available,
  95. is_pytesseract_available,
  96. is_pytorch_quantization_available,
  97. is_rjieba_available,
  98. is_sagemaker_dp_enabled,
  99. is_sagemaker_mp_enabled,
  100. is_scipy_available,
  101. is_sentencepiece_available,
  102. is_seqio_available,
  103. is_sklearn_available,
  104. is_soundfile_availble,
  105. is_spacy_available,
  106. is_speech_available,
  107. is_tensor,
  108. is_tensorflow_probability_available,
  109. is_tf2onnx_available,
  110. is_tf_available,
  111. is_timm_available,
  112. is_tokenizers_available,
  113. is_torch_available,
  114. is_torch_bf16_available,
  115. is_torch_cuda_available,
  116. is_torch_fx_available,
  117. is_torch_fx_proxy,
  118. is_torch_mps_available,
  119. is_torch_tf32_available,
  120. is_torch_xla_available,
  121. is_torchaudio_available,
  122. is_training_run_on_sagemaker,
  123. is_vision_available,
  124. replace_return_docstrings,
  125. requires_backends,
  126. to_numpy,
  127. to_py_obj,
  128. torch_only_method,
  129. )