a b/src/move/__main__.py
1
__all__ = []
2
3
import hydra
4
from omegaconf import OmegaConf
5
6
import move.tasks
7
from move import HYDRA_VERSION_BASE
8
from move.conf.schema import (
9
    AnalyzeLatentConfig,
10
    EncodeDataConfig,
11
    IdentifyAssociationsConfig,
12
    MOVEConfig,
13
    TuneModelConfig,
14
)
15
from move.core.logging import get_logger
16
17
18
@hydra.main(
19
    config_path="conf",
20
    config_name="main",
21
    version_base=HYDRA_VERSION_BASE,
22
)
23
def main(config: MOVEConfig) -> None:
24
    """Run MOVE.
25
26
    Example:
27
        $ python -m move experiment=random_small -cd=tutorial/config
28
    """
29
    if not hasattr(config, "task"):
30
        raise ValueError("No task defined.")
31
    task_type = OmegaConf.get_type(config.task)
32
    if task_type is None:
33
        logger = get_logger("move")
34
        logger.info("No task specified.")
35
    elif task_type is EncodeDataConfig:
36
        move.tasks.encode_data(config.data)
37
    elif issubclass(task_type, TuneModelConfig):
38
        move.tasks.tune_model(config)
39
    elif task_type is AnalyzeLatentConfig:
40
        move.tasks.analyze_latent(config)
41
    elif issubclass(task_type, IdentifyAssociationsConfig):
42
        move.tasks.identify_associations(config)
43
    else:
44
        raise ValueError("Unsupported type of task.")
45
46
47
if __name__ == "__main__":
48
    main()