__init__.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # Copyright 2024 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_mllama": ["MllamaConfig"],
  23. "processing_mllama": ["MllamaProcessor"],
  24. }
  25. try:
  26. if not is_torch_available():
  27. raise OptionalDependencyNotAvailable()
  28. except OptionalDependencyNotAvailable:
  29. pass
  30. else:
  31. _import_structure["modeling_mllama"] = [
  32. "MllamaForConditionalGeneration",
  33. "MllamaForCausalLM",
  34. "MllamaTextModel",
  35. "MllamaVisionModel",
  36. "MllamaPreTrainedModel",
  37. ]
  38. try:
  39. if not is_vision_available():
  40. raise OptionalDependencyNotAvailable()
  41. except OptionalDependencyNotAvailable:
  42. pass
  43. else:
  44. _import_structure["image_processing_mllama"] = ["MllamaImageProcessor"]
  45. if TYPE_CHECKING:
  46. from .configuration_mllama import MllamaConfig
  47. from .processing_mllama import MllamaProcessor
  48. try:
  49. if not is_torch_available():
  50. raise OptionalDependencyNotAvailable()
  51. except OptionalDependencyNotAvailable:
  52. pass
  53. else:
  54. from .modeling_mllama import (
  55. MllamaForCausalLM,
  56. MllamaForConditionalGeneration,
  57. MllamaPreTrainedModel,
  58. MllamaTextModel,
  59. MllamaVisionModel,
  60. )
  61. try:
  62. if not is_vision_available():
  63. raise OptionalDependencyNotAvailable()
  64. except OptionalDependencyNotAvailable:
  65. pass
  66. else:
  67. from .image_processing_mllama import (
  68. MllamaImageProcessor,
  69. )
  70. else:
  71. import sys
  72. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure)