-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun_train.py
40 lines (31 loc) · 1 KB
/
run_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
#-*- coding: UTF-8 -*-
#################################################################
# > File: run_train.py
# > Author: Minghua Zhang
# > Mail: zhangmh@pku.edu.cn
# > Time: 2018-01-04 16:33:06
#################################################################
import os
import sys
import logging
import master
def main():
m = master.Master('conf.json')
vocab = m.load_vocab()
m.build_emb(vocab)
m.load_data()
m.creat_graph()
m.train()
logging.info("Done Train !")
if __name__ == '__main__':
if len(sys.argv) != 1:
exit(1)
else:
# logging
fileHandler = logging.FileHandler(os.path.abspath('.')+'/log.train', mode='w', encoding='UTF-8')
formatter = logging.Formatter('%(asctime)s %(filename)s[%(lineno)d] %(levelname)s %(message)s', '%Y-%m-%d %H:%M:%S')
fileHandler.setFormatter(formatter)
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.addHandler(fileHandler)
main()