Synthyra/ESM2-8M
4581
1"""FastPLMs public package interface.2 3The module uses lazy exports so importing :mod:`fastplms` does not initialize4Torch, download checkpoints, construct tokenizers, or compile kernels.5"""6 7from __future__ import annotations8 9from importlib import import_module10from typing import Any11 12 13__version__ = "1.0.0"14 15_LAZY_EXPORTS = {16 "CheckpointSource": ("fastplms.registry", "CheckpointSource"),17 "EmbeddingInput": ("fastplms.embeddings", "EmbeddingInput"),18 "EmbeddingRecord": ("fastplms.embeddings", "EmbeddingRecord"),19 "EmbeddingResult": ("fastplms.embeddings", "EmbeddingResult"),20 "FileDigest": ("fastplms.registry", "FileDigest"),21 "ModelFamily": ("fastplms.registry", "ModelFamily"),22 "ModelRegistry": ("fastplms.registry", "ModelRegistry"),23 "ModelSpec": ("fastplms.registry", "ModelSpec"),24 "OracleAsset": ("fastplms.registry", "OracleAsset"),25 "RegistryError": ("fastplms.registry", "RegistryError"),26 "RuntimeProfile": ("fastplms.runtime", "RuntimeProfile"),27 "UpstreamSource": ("fastplms.registry", "UpstreamSource"),28 "embed_dataset": ("fastplms.embeddings", "embed_dataset"),29 "get_model_registry": ("fastplms.registry", "get_model_registry"),30 "get_model_spec": ("fastplms.registry", "get_model_spec"),31 "load_model_registry": ("fastplms.registry", "load_model_registry"),32 "runtime_profile": ("fastplms.runtime", "runtime_profile"),33}34 35__all__ = ["__version__", *_LAZY_EXPORTS]36 37 38def __getattr__(name: str) -> Any:39 try:40 module_name, attribute_name = _LAZY_EXPORTS[name]41 except KeyError as error:42 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from error43 value = getattr(import_module(module_name), attribute_name)44 globals()[name] = value45 return value46 47 48def __dir__() -> list[str]:49 return sorted(set(globals()).union(__all__))50 