-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.py
71 lines (55 loc) · 1.79 KB
/
config.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from __future__ import division
class Config():
def __init__(self):
self.root_path = "."
# for NN only
self.if_margin = True
self.beta = 3
# for data loader
self.data_set = "sample"
self.lowercase = True
self.batch_size = 32
self.if_shuffle = True
self.if_backward = False
self.if_interactions = True
# override when loading data
self.voc_size = None
self.pos_size = None
self.label_size = None
# for h
self.token_feat_size = None # for h model
self.span_feat_size = None # for h model
self.t_null_id = None
self.s_null_id = None
self.h_hidden_size = 128
# embed size
self.token_embed = 100
self.if_pos = True
self.pos_embed = 32
self.input_dropout = 0.5
# for lstm
self.f_hidden_size = 128 # 32, 64, 128, 256
self.f_layers = 1
self.f_lstm_dropout = 0.1 # [0,0.5]
self.semi_hidden_size = self.f_hidden_size
# for training
self.embed_path = self.root_path + "/data/word_vec_{0}_{1}.pkl".format(self.data_set, self.token_embed)
self.epoch = 500
self.if_gpu = False
self.opt = "Adam"
self.lr = 0.005 # [0.3, 0.00006]
self.l2 = 1e-4
self.check_every = 1
self.clip_norm = 3
# for early stop
self.lr_patience = 3
self.decay_patience = 2
self.pre_trained = True
self.data_path = self.root_path + "/data/{0}".format(self.data_set)
self.model_path = self.root_path + "/dumps/{0}_model.pt".format(self.data_set)
# max length
self.if_C = True
self.C = 6
def __repr__(self):
return str(vars(self))
config = Config()