__init__.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 (
  20. OptionalDependencyNotAvailable,
  21. _LazyModule,
  22. is_torch_available,
  23. is_tf_available,
  24. )
  25. _import_structure = {"configuration_convnextv2": ["ConvNextV2Config"]}
  26. try:
  27. if not is_torch_available():
  28. raise OptionalDependencyNotAvailable()
  29. except OptionalDependencyNotAvailable:
  30. pass
  31. else:
  32. _import_structure["modeling_convnextv2"] = [
  33. "ConvNextV2ForImageClassification",
  34. "ConvNextV2Model",
  35. "ConvNextV2PreTrainedModel",
  36. "ConvNextV2Backbone",
  37. ]
  38. try:
  39. if not is_tf_available():
  40. raise OptionalDependencyNotAvailable()
  41. except OptionalDependencyNotAvailable:
  42. pass
  43. else:
  44. _import_structure["modeling_tf_convnextv2"] = [
  45. "TFConvNextV2ForImageClassification",
  46. "TFConvNextV2Model",
  47. "TFConvNextV2PreTrainedModel",
  48. ]
  49. if TYPE_CHECKING:
  50. from .configuration_convnextv2 import (
  51. ConvNextV2Config,
  52. )
  53. try:
  54. if not is_torch_available():
  55. raise OptionalDependencyNotAvailable()
  56. except OptionalDependencyNotAvailable:
  57. pass
  58. else:
  59. from .modeling_convnextv2 import (
  60. ConvNextV2Backbone,
  61. ConvNextV2ForImageClassification,
  62. ConvNextV2Model,
  63. ConvNextV2PreTrainedModel,
  64. )
  65. try:
  66. if not is_tf_available():
  67. raise OptionalDependencyNotAvailable()
  68. except OptionalDependencyNotAvailable:
  69. pass
  70. else:
  71. from .modeling_tf_convnextv2 import (
  72. TFConvNextV2ForImageClassification,
  73. TFConvNextV2Model,
  74. TFConvNextV2PreTrainedModel,
  75. )
  76. else:
  77. import sys
  78. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)