-
Notifications
You must be signed in to change notification settings - Fork 7
/
01_train.py
38 lines (30 loc) · 992 Bytes
/
01_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
34
35
36
37
38
"""Training run script
Loads the configuration and starts training.
Uses data specified under [train_data]
Writes logging output to stdout and run.log file
"""
import argparse
import logging
import sys
import time
from linajea.config import TrackingConfig
from linajea.utils import print_time
from linajea.training import train
logger = logging.getLogger(__name__)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--config', type=str,
help='path to config file')
args = parser.parse_args()
config = TrackingConfig.from_file(args.config)
logging.basicConfig(
level=config.general.logging,
handlers=[
logging.FileHandler('run.log', mode='a'),
logging.StreamHandler(sys.stdout),
],
format='%(asctime)s %(name)s %(levelname)-8s %(message)s')
start_time = time.time()
train(config)
end_time = time.time()
print_time(end_time - start_time)