forked from songyingxin/Bert-TextClassification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_yelp_review_polarity.py
48 lines (33 loc) · 1.52 KB
/
run_yelp_review_polarity.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
43
44
45
46
47
48
# coding=utf-8
from main import main
if __name__ == "__main__":
model_name = "BertLSTM"
label_list = ['1', '2']
data_dir = "/search/hadoop02/suanfa/songyingxin/SongWork/PaperDataset/yelp_review_polarity"
output_dir = ".yelp_review_polarity_output/"
cache_dir = ".yelp_review_polarity_cache"
log_dir = ".yelp_review_polarity_log/"
# model_times = "model_1/" # 第几次保存的模型,主要是用来获取最佳结果
# bert-base
bert_vocab_file = "/search/hadoop02/suanfa/songyingxin/pytorch_Bert/bert-base-uncased-vocab.txt"
bert_model_dir = "/search/hadoop02/suanfa/songyingxin/pytorch_Bert/bert-base-uncased"
# # bert-large
# bert_vocab_file = "/search/hadoop02/suanfa/songyingxin/pytorch_Bert/bert-large-uncased-vocab.txt"
# bert_model_dir = "/search/hadoop02/suanfa/songyingxin/pytorch_Bert/bert-large-uncased"
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)