返回 JoyAI-Echo
__init__.py
1 """
2 Model wrappers for LTX-2 distillation.
3
4 Use lazy imports so submodules can be imported without eagerly loading the VAE
5 stack and its optional runtime dependencies.
6 """
7
8 from importlib import import_module
9
10 __all__ = [
11 "LTX2DiffusionWrapper",
12 "GemmaTextEncoderWrapper",
13 "VideoVAEWrapper",
14 "AudioVAEWrapper",
15 ]
16
17 _LAZY_IMPORTS = {
18 "LTX2DiffusionWrapper": ("ltx_distillation.models.ltx_wrapper", "LTX2DiffusionWrapper"),
19 "GemmaTextEncoderWrapper": ("ltx_distillation.models.text_encoder_wrapper", "GemmaTextEncoderWrapper"),
20 "VideoVAEWrapper": ("ltx_distillation.models.vae_wrapper", "VideoVAEWrapper"),
21 "AudioVAEWrapper": ("ltx_distillation.models.vae_wrapper", "AudioVAEWrapper"),
22 }
23
24
25 def __getattr__(name: str):
26 if name not in _LAZY_IMPORTS:
27 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
28
29 module_name, attr_name = _LAZY_IMPORTS[name]
30 value = getattr(import_module(module_name), attr_name)
31 globals()[name] = value
32 return value
33
33 lines PYTHON