__init__.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 OptionalDependencyNotAvailable, _LazyModule, is_torch_available
  16. _import_structure = {
  17. "configuration_clap": [
  18. "ClapAudioConfig",
  19. "ClapConfig",
  20. "ClapTextConfig",
  21. ],
  22. "processing_clap": ["ClapProcessor"],
  23. }
  24. try:
  25. if not is_torch_available():
  26. raise OptionalDependencyNotAvailable()
  27. except OptionalDependencyNotAvailable:
  28. pass
  29. else:
  30. _import_structure["modeling_clap"] = [
  31. "ClapModel",
  32. "ClapPreTrainedModel",
  33. "ClapTextModel",
  34. "ClapTextModelWithProjection",
  35. "ClapAudioModel",
  36. "ClapAudioModelWithProjection",
  37. ]
  38. _import_structure["feature_extraction_clap"] = ["ClapFeatureExtractor"]
  39. if TYPE_CHECKING:
  40. from .configuration_clap import (
  41. ClapAudioConfig,
  42. ClapConfig,
  43. ClapTextConfig,
  44. )
  45. from .processing_clap import ClapProcessor
  46. try:
  47. if not is_torch_available():
  48. raise OptionalDependencyNotAvailable()
  49. except OptionalDependencyNotAvailable:
  50. pass
  51. else:
  52. from .feature_extraction_clap import ClapFeatureExtractor
  53. from .modeling_clap import (
  54. ClapAudioModel,
  55. ClapAudioModelWithProjection,
  56. ClapModel,
  57. ClapPreTrainedModel,
  58. ClapTextModel,
  59. ClapTextModelWithProjection,
  60. )
  61. else:
  62. import sys
  63. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)