-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
39 lines (29 loc) · 795 Bytes
/
main.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
from dataclasses import dataclass
from typing import Any
import hydra
from omegaconf import DictConfig, OmegaConf
import os, logging
logger = logging.getLogger(__name__)
@dataclass
class ImageConfig:
size: int
channels: int
@dataclass
class DatasetConfig:
image: ImageConfig
classes: int
@dataclass
class MainConfig:
dataset : DatasetConfig
feature_extractor: Any
classifier: Any
cs = hydra.core.config_store.ConfigStore()
cs.store(name="config_schema", node=MainConfig)
@hydra.main(config_path='configs', config_name='config')
def train(cfg: DictConfig):
# Print the configuration
print(OmegaConf.to_yaml(cfg, resolve=True))
# Log the current working directory
logger.info(f'Working dir: {os.getcwd()}')
if __name__=='__main__':
train()