__init__.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # coding=utf-8
  2. # Copyright 2023 The Intel AIA Team Authors, and HuggingFace Inc. team. All rights reserved.
  3. #
  4. # Licensed under the Apache License=, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing=, software
  11. # distributed under the License is distributed on an "AS IS" BASIS=,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND=, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from typing import TYPE_CHECKING
  16. from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
  17. _import_structure = {
  18. "configuration_tvp": ["TvpConfig"],
  19. "processing_tvp": ["TvpProcessor"],
  20. }
  21. try:
  22. if not is_vision_available():
  23. raise OptionalDependencyNotAvailable()
  24. except OptionalDependencyNotAvailable:
  25. pass
  26. else:
  27. _import_structure["image_processing_tvp"] = ["TvpImageProcessor"]
  28. try:
  29. if not is_torch_available():
  30. raise OptionalDependencyNotAvailable()
  31. except OptionalDependencyNotAvailable:
  32. pass
  33. else:
  34. _import_structure["modeling_tvp"] = [
  35. "TvpModel",
  36. "TvpPreTrainedModel",
  37. "TvpForVideoGrounding",
  38. ]
  39. if TYPE_CHECKING:
  40. from .configuration_tvp import (
  41. TvpConfig,
  42. )
  43. from .processing_tvp import TvpProcessor
  44. try:
  45. if not is_vision_available():
  46. raise OptionalDependencyNotAvailable()
  47. except OptionalDependencyNotAvailable:
  48. pass
  49. else:
  50. from .image_processing_tvp import TvpImageProcessor
  51. try:
  52. if not is_torch_available():
  53. raise OptionalDependencyNotAvailable()
  54. except OptionalDependencyNotAvailable:
  55. pass
  56. else:
  57. from .modeling_tvp import (
  58. TvpForVideoGrounding,
  59. TvpModel,
  60. TvpPreTrainedModel,
  61. )
  62. else:
  63. import sys
  64. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)