__init__.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_flax_available, is_torch_available
  16. _import_structure = {
  17. "configuration_longt5": ["LongT5Config", "LongT5OnnxConfig"],
  18. }
  19. try:
  20. if not is_torch_available():
  21. raise OptionalDependencyNotAvailable()
  22. except OptionalDependencyNotAvailable:
  23. pass
  24. else:
  25. _import_structure["modeling_longt5"] = [
  26. "LongT5EncoderModel",
  27. "LongT5ForConditionalGeneration",
  28. "LongT5Model",
  29. "LongT5PreTrainedModel",
  30. ]
  31. try:
  32. if not is_flax_available():
  33. raise OptionalDependencyNotAvailable()
  34. except OptionalDependencyNotAvailable:
  35. pass
  36. else:
  37. _import_structure["modeling_flax_longt5"] = [
  38. "FlaxLongT5ForConditionalGeneration",
  39. "FlaxLongT5Model",
  40. "FlaxLongT5PreTrainedModel",
  41. ]
  42. if TYPE_CHECKING:
  43. from .configuration_longt5 import LongT5Config, LongT5OnnxConfig
  44. try:
  45. if not is_torch_available():
  46. raise OptionalDependencyNotAvailable()
  47. except OptionalDependencyNotAvailable:
  48. pass
  49. else:
  50. from .modeling_longt5 import (
  51. LongT5EncoderModel,
  52. LongT5ForConditionalGeneration,
  53. LongT5Model,
  54. LongT5PreTrainedModel,
  55. )
  56. try:
  57. if not is_flax_available():
  58. raise OptionalDependencyNotAvailable()
  59. except OptionalDependencyNotAvailable:
  60. pass
  61. else:
  62. from .modeling_flax_longt5 import (
  63. FlaxLongT5ForConditionalGeneration,
  64. FlaxLongT5Model,
  65. FlaxLongT5PreTrainedModel,
  66. )
  67. else:
  68. import sys
  69. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)