-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathrun_THUCNews.py
43 lines (30 loc) · 1.37 KB
/
run_THUCNews.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
39
40
41
42
# coding=utf-8
from main import main
if __name__ == "__main__":
model_name = "BertLSTM"
label_list = [u'房产', u'科技', u'财经', u'游戏',
u'娱乐', u'时尚', u'时政', u'家居', u'教育', u'体育']
data_dir = "/search/hadoop02/suanfa/songyingxin/SongWork/PaperDataset/THUCNews"
output_dir = ".cnews_output/"
cache_dir = ".cnews_cache/"
log_dir = ".cnews_log/"
# model_times = "model_1/" # 第几次保存的模型,主要是用来获取多次最佳结果
bert_vocab_file = "/search/hadoop02/suanfa/songyingxin/pytorch_Bert/bert-base-chinese-vocab.txt" # 需改
bert_model_dir = "/search/hadoop02/suanfa/songyingxin/pytorch_Bert/bert-base-chinese"
if model_name == "BertOrigin":
from BertOrigin import args
elif model_name == "BertCNN":
from BertCNN import args
elif model_name == 'BertLSTM':
from BertLSTM import args
elif model_name == "BertATT":
from BertATT import args
elif model_name == "BertRCNN":
from BertRCNN import args
elif model_name == "BertCNNPlus":
from BertCNNPlus import args
elif model_name == "BertDPCNN":
from BertDPCNN import args
config = args.get_args(data_dir, output_dir, cache_dir,
bert_vocab_file, bert_model_dir, log_dir)
main(config, config.save_name, label_list)