forked from clay-lab/transductions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepl.py
29 lines (20 loc) · 729 Bytes
/
repl.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
# repl.py
#
# Enter an interactive TPDR for the model.
import os
import hydra
from omegaconf import DictConfig, OmegaConf
from core.trainer import Trainer
@hydra.main(config_path="conf", config_name="repl.yaml")
def main(cfg: DictConfig) -> None:
# Load checkpoint configuration: Since the REPL's own
# entrypoint is different than that of the saved model,
# we have to load them separately as different config
# files.
chkpt_dir = hydra.utils.to_absolute_path(cfg.checkpoint_dir)
chkpt_cfg_path = os.path.join(chkpt_dir, ".hydra", "config.yaml")
chkpt_cfg = OmegaConf.load(chkpt_cfg_path)
trainer = Trainer(chkpt_cfg)
trainer.repl(repl_cfg=cfg)
if __name__ == "__main__":
main()