-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (24 loc) · 864 Bytes
/
main.py
File metadata and controls
32 lines (24 loc) · 864 Bytes
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
import hydra
import wandb
from omegaconf import DictConfig, OmegaConf
import logging
from trainer import Trainer
log = logging.getLogger(__name__)
@hydra.main(config_path="configs", config_name="main.yaml")
def main(cfg: DictConfig) -> None:
# init wandb logger and config from hydra path
wandb.config = OmegaConf.to_container(cfg, resolve=True, throw_on_missing=True)
# wandb init stuff; if run should not be logged comment in the mode
run = wandb.init(
project=cfg.wandb.project,
entity=cfg.wandb.entity,
#mode="disabled",
config=wandb.config,
name=cfg.run_name if hasattr(cfg, "run_name") and cfg.run_name else None,
)
trainer = Trainer(cfg.manager, cfg.method, cfg.trainer)
trainer.start()
log.info("done")
run.finish()
if __name__ == "__main__":
main()