File size: 648 Bytes
3c13fb9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | """Utility helpers with lazy imports for data-only environments."""
__all__ = ["encode_text", "encode_image", "decode_latents", "get_vae_stats"]
_LAZY = {
"encode_text": (".encode_text", "encode_text"),
"encode_image": (".vae_codec", "encode_image"),
"decode_latents": (".vae_codec", "decode_latents"),
"get_vae_stats": (".vae_codec", "get_vae_stats"),
}
def __getattr__(name):
if name in _LAZY:
import importlib
module_name, attribute = _LAZY[name]
return getattr(importlib.import_module(module_name, __name__), attribute)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|