__init__.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # flake8: noqa
  2. # There's no way to ignore "F401 '...' imported but unused" warnings in this
  3. # module, but to preserve other warnings. So, don't check this module at all.
  4. # Copyright 2023 The HuggingFace Team. All rights reserved.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. from typing import TYPE_CHECKING
  18. # rely on isort to merge the imports
  19. from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
  20. _import_structure = {"configuration_mra": ["MraConfig"]}
  21. try:
  22. if not is_torch_available():
  23. raise OptionalDependencyNotAvailable()
  24. except OptionalDependencyNotAvailable:
  25. pass
  26. else:
  27. _import_structure["modeling_mra"] = [
  28. "MraForMaskedLM",
  29. "MraForMultipleChoice",
  30. "MraForQuestionAnswering",
  31. "MraForSequenceClassification",
  32. "MraForTokenClassification",
  33. "MraLayer",
  34. "MraModel",
  35. "MraPreTrainedModel",
  36. ]
  37. if TYPE_CHECKING:
  38. from .configuration_mra import MraConfig
  39. try:
  40. if not is_torch_available():
  41. raise OptionalDependencyNotAvailable()
  42. except OptionalDependencyNotAvailable:
  43. pass
  44. else:
  45. from .modeling_mra import (
  46. MraForMaskedLM,
  47. MraForMultipleChoice,
  48. MraForQuestionAnswering,
  49. MraForSequenceClassification,
  50. MraForTokenClassification,
  51. MraLayer,
  52. MraModel,
  53. MraPreTrainedModel,
  54. )
  55. else:
  56. import sys
  57. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)