file_utils.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 . import __version__
  19. # Backward compatibility imports, to make sure all those objects can be found in file_utils
  20. from .utils import (
  21. CLOUDFRONT_DISTRIB_PREFIX,
  22. CONFIG_NAME,
  23. DUMMY_INPUTS,
  24. DUMMY_MASK,
  25. ENV_VARS_TRUE_AND_AUTO_VALUES,
  26. ENV_VARS_TRUE_VALUES,
  27. FEATURE_EXTRACTOR_NAME,
  28. HF_MODULES_CACHE,
  29. MODEL_CARD_NAME,
  30. MULTIPLE_CHOICE_DUMMY_INPUTS,
  31. S3_BUCKET_PREFIX,
  32. SENTENCEPIECE_UNDERLINE,
  33. SPIECE_UNDERLINE,
  34. TRANSFORMERS_DYNAMIC_MODULE_NAME,
  35. WEIGHTS_INDEX_NAME,
  36. WEIGHTS_NAME,
  37. ContextManagers,
  38. DummyObject,
  39. EntryNotFoundError,
  40. ExplicitEnum,
  41. ModelOutput,
  42. PaddingStrategy,
  43. PushToHubMixin,
  44. RepositoryNotFoundError,
  45. RevisionNotFoundError,
  46. TensorType,
  47. _LazyModule,
  48. add_code_sample_docstrings,
  49. add_end_docstrings,
  50. add_start_docstrings,
  51. add_start_docstrings_to_model_forward,
  52. copy_func,
  53. define_sagemaker_information,
  54. get_torch_version,
  55. has_file,
  56. http_user_agent,
  57. is_apex_available,
  58. is_bs4_available,
  59. is_coloredlogs_available,
  60. is_datasets_available,
  61. is_detectron2_available,
  62. is_faiss_available,
  63. is_g2p_en_available,
  64. is_in_notebook,
  65. is_librosa_available,
  66. is_onnx_available,
  67. is_pandas_available,
  68. is_phonemizer_available,
  69. is_protobuf_available,
  70. is_psutil_available,
  71. is_py3nvml_available,
  72. is_pyctcdecode_available,
  73. is_pytesseract_available,
  74. is_pytorch_quantization_available,
  75. is_rjieba_available,
  76. is_sagemaker_dp_enabled,
  77. is_sagemaker_mp_enabled,
  78. is_scipy_available,
  79. is_sentencepiece_available,
  80. is_seqio_available,
  81. is_sklearn_available,
  82. is_soundfile_available,
  83. is_spacy_available,
  84. is_speech_available,
  85. is_tensor,
  86. is_timm_available,
  87. is_tokenizers_available,
  88. is_torch_available,
  89. is_torch_cuda_available,
  90. is_torch_fx_proxy,
  91. is_torch_mps_available,
  92. is_torch_tf32_available,
  93. is_torch_xla_available,
  94. is_torchaudio_available,
  95. is_training_run_on_sagemaker,
  96. is_vision_available,
  97. replace_return_docstrings,
  98. requires_backends,
  99. to_numpy,
  100. to_py_obj,
  101. torch_only_method,
  102. )