forked from Lightning-AI/pytorch-lightning
-
Notifications
You must be signed in to change notification settings - Fork 3
/
__init__.py
48 lines (38 loc) · 1.5 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Root package info."""
import logging
import sys
# explicitly don't set root logger's propagation and leave this to subpackages to manage
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
_console = logging.StreamHandler()
_console.setLevel(logging.INFO)
formatter = logging.Formatter("%(levelname)s: %(message)s")
_console.setFormatter(formatter)
_logger.addHandler(_console)
from lightning.__about__ import * # noqa: E402, F403
from lightning.__version__ import version as __version__ # noqa: E402
from lightning.fabric.fabric import Fabric # noqa: E402
from lightning.fabric.utilities.seed import seed_everything # noqa: E402
from lightning.pytorch.callbacks import Callback # noqa: E402
from lightning.pytorch.core import LightningDataModule, LightningModule # noqa: E402
from lightning.pytorch.trainer import Trainer # noqa: E402
__all__ = [
"Trainer",
"LightningDataModule",
"LightningModule",
"Callback",
"seed_everything",
"Fabric",
"__version__",
]
def _cli_entry_point() -> None:
from lightning_utilities.core.imports import ModuleAvailableCache, RequirementCache
if not (
ModuleAvailableCache("lightning.app")
if RequirementCache("lightning-utilities<0.10.0")
else RequirementCache(module="lightning.app") # type: ignore[call-arg]
):
print("The `lightning` command requires additional dependencies: `pip install lightning[app]`")
sys.exit(1)
from lightning.app.cli.lightning_cli import main
main()