__init__.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # coding=utf-8
  2. # Copyright 2024 Descript and The 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 (
  17. OptionalDependencyNotAvailable,
  18. _LazyModule,
  19. is_torch_available,
  20. )
  21. _import_structure = {
  22. "configuration_dac": ["DacConfig"],
  23. "feature_extraction_dac": ["DacFeatureExtractor"],
  24. }
  25. try:
  26. if not is_torch_available():
  27. raise OptionalDependencyNotAvailable()
  28. except OptionalDependencyNotAvailable:
  29. pass
  30. else:
  31. _import_structure["modeling_dac"] = [
  32. "DacModel",
  33. "DacPreTrainedModel",
  34. ]
  35. if TYPE_CHECKING:
  36. from .configuration_dac import (
  37. DacConfig,
  38. )
  39. from .feature_extraction_dac import DacFeatureExtractor
  40. try:
  41. if not is_torch_available():
  42. raise OptionalDependencyNotAvailable()
  43. except OptionalDependencyNotAvailable:
  44. pass
  45. else:
  46. from .modeling_dac import (
  47. DacModel,
  48. DacPreTrainedModel,
  49. )
  50. else:
  51. import sys
  52. sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)