__init__.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright 2023 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_torch_available,
  19. is_vision_available,
  20. )
  21. _import_structure = {
  22. "configuration_mobilevitv2": [
  23. "MobileViTV2Config",
  24. "MobileViTV2OnnxConfig",
  25. ],
  26. }
  27. try:
  28. if not is_torch_available():
  29. raise OptionalDependencyNotAvailable()
  30. except OptionalDependencyNotAvailable:
  31. pass
  32. else:
  33. _import_structure["modeling_mobilevitv2"] = [
  34. "MobileViTV2ForImageClassification",
  35. "MobileViTV2ForSemanticSegmentation",
  36. "MobileViTV2Model",
  37. "MobileViTV2PreTrainedModel",
  38. ]
  39. if TYPE_CHECKING:
  40. from .configuration_mobilevitv2 import (
  41. MobileViTV2Config,
  42. MobileViTV2OnnxConfig,
  43. )
  44. try:
  45. if not is_torch_available():
  46. raise OptionalDependencyNotAvailable()
  47. except OptionalDependencyNotAvailable:
  48. pass
  49. else:
  50. from .modeling_mobilevitv2 import (
  51. MobileViTV2ForImageClassification,
  52. MobileViTV2ForSemanticSegmentation,
  53. MobileViTV2Model,
  54. MobileViTV2PreTrainedModel,
  55. )
  56. else:
  57. import sys
  58. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)