__init__.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. )
  20. _import_structure = {
  21. "configuration_bark": [
  22. "BarkCoarseConfig",
  23. "BarkConfig",
  24. "BarkFineConfig",
  25. "BarkSemanticConfig",
  26. ],
  27. "processing_bark": ["BarkProcessor"],
  28. }
  29. try:
  30. if not is_torch_available():
  31. raise OptionalDependencyNotAvailable()
  32. except OptionalDependencyNotAvailable:
  33. pass
  34. else:
  35. _import_structure["modeling_bark"] = [
  36. "BarkFineModel",
  37. "BarkSemanticModel",
  38. "BarkCoarseModel",
  39. "BarkModel",
  40. "BarkPreTrainedModel",
  41. "BarkCausalModel",
  42. ]
  43. if TYPE_CHECKING:
  44. from .configuration_bark import (
  45. BarkCoarseConfig,
  46. BarkConfig,
  47. BarkFineConfig,
  48. BarkSemanticConfig,
  49. )
  50. from .processing_bark import BarkProcessor
  51. try:
  52. if not is_torch_available():
  53. raise OptionalDependencyNotAvailable()
  54. except OptionalDependencyNotAvailable:
  55. pass
  56. else:
  57. from .modeling_bark import (
  58. BarkCausalModel,
  59. BarkCoarseModel,
  60. BarkFineModel,
  61. BarkModel,
  62. BarkPreTrainedModel,
  63. BarkSemanticModel,
  64. )
  65. else:
  66. import sys
  67. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)