__init__.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
  16. _import_structure = {"configuration_cvt": ["CvtConfig"]}
  17. try:
  18. if not is_torch_available():
  19. raise OptionalDependencyNotAvailable()
  20. except OptionalDependencyNotAvailable:
  21. pass
  22. else:
  23. _import_structure["modeling_cvt"] = [
  24. "CvtForImageClassification",
  25. "CvtModel",
  26. "CvtPreTrainedModel",
  27. ]
  28. try:
  29. if not is_tf_available():
  30. raise OptionalDependencyNotAvailable()
  31. except OptionalDependencyNotAvailable:
  32. pass
  33. else:
  34. _import_structure["modeling_tf_cvt"] = [
  35. "TFCvtForImageClassification",
  36. "TFCvtModel",
  37. "TFCvtPreTrainedModel",
  38. ]
  39. if TYPE_CHECKING:
  40. from .configuration_cvt import CvtConfig
  41. try:
  42. if not is_torch_available():
  43. raise OptionalDependencyNotAvailable()
  44. except OptionalDependencyNotAvailable:
  45. pass
  46. else:
  47. from .modeling_cvt import (
  48. CvtForImageClassification,
  49. CvtModel,
  50. CvtPreTrainedModel,
  51. )
  52. try:
  53. if not is_tf_available():
  54. raise OptionalDependencyNotAvailable()
  55. except OptionalDependencyNotAvailable:
  56. pass
  57. else:
  58. from .modeling_tf_cvt import (
  59. TFCvtForImageClassification,
  60. TFCvtModel,
  61. TFCvtPreTrainedModel,
  62. )
  63. else:
  64. import sys
  65. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)