__init__.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Copyright 2022 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. from typing import TYPE_CHECKING
  15. from ...utils import (
  16. OptionalDependencyNotAvailable,
  17. _LazyModule,
  18. is_flax_available,
  19. is_tf_available,
  20. is_torch_available,
  21. )
  22. _import_structure = {"configuration_regnet": ["RegNetConfig"]}
  23. try:
  24. if not is_torch_available():
  25. raise OptionalDependencyNotAvailable()
  26. except OptionalDependencyNotAvailable:
  27. pass
  28. else:
  29. _import_structure["modeling_regnet"] = [
  30. "RegNetForImageClassification",
  31. "RegNetModel",
  32. "RegNetPreTrainedModel",
  33. ]
  34. try:
  35. if not is_tf_available():
  36. raise OptionalDependencyNotAvailable()
  37. except OptionalDependencyNotAvailable:
  38. pass
  39. else:
  40. _import_structure["modeling_tf_regnet"] = [
  41. "TFRegNetForImageClassification",
  42. "TFRegNetModel",
  43. "TFRegNetPreTrainedModel",
  44. ]
  45. try:
  46. if not is_flax_available():
  47. raise OptionalDependencyNotAvailable()
  48. except OptionalDependencyNotAvailable:
  49. pass
  50. else:
  51. _import_structure["modeling_flax_regnet"] = [
  52. "FlaxRegNetForImageClassification",
  53. "FlaxRegNetModel",
  54. "FlaxRegNetPreTrainedModel",
  55. ]
  56. if TYPE_CHECKING:
  57. from .configuration_regnet import RegNetConfig
  58. try:
  59. if not is_torch_available():
  60. raise OptionalDependencyNotAvailable()
  61. except OptionalDependencyNotAvailable:
  62. pass
  63. else:
  64. from .modeling_regnet import (
  65. RegNetForImageClassification,
  66. RegNetModel,
  67. RegNetPreTrainedModel,
  68. )
  69. try:
  70. if not is_tf_available():
  71. raise OptionalDependencyNotAvailable()
  72. except OptionalDependencyNotAvailable:
  73. pass
  74. else:
  75. from .modeling_tf_regnet import (
  76. TFRegNetForImageClassification,
  77. TFRegNetModel,
  78. TFRegNetPreTrainedModel,
  79. )
  80. try:
  81. if not is_flax_available():
  82. raise OptionalDependencyNotAvailable()
  83. except OptionalDependencyNotAvailable:
  84. pass
  85. else:
  86. from .modeling_flax_regnet import (
  87. FlaxRegNetForImageClassification,
  88. FlaxRegNetModel,
  89. FlaxRegNetPreTrainedModel,
  90. )
  91. else:
  92. import sys
  93. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)