forked from InfoCoV/Multi-Cro-CoV-cseBERT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
train.py
33 lines (22 loc) · 811 Bytes
/
train.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
"""Runs training experiments"""
import argparse
import importlib
import logging
from omegaconf import OmegaConf
LOGGER = logging.getLogger(__name__)
def train(config):
LOGGER.info(f"Running model {config.model_module}")
model_module = importlib.import_module(config.model_module)
model_module.config = OmegaConf.merge(model_module.config, config)
LOGGER.info("Full config:")
LOGGER.info(model_module.config)
model_module.run(model_module.config)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument("config", help="path to YAML config")
args = parser.parse_args()
config = OmegaConf.load(args.config)
LOGGER.info("Loaded yaml config file:")
LOGGER.info(config)
train(config)