-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
49 lines (41 loc) · 1.46 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
from tensorflow.keras.optimizers import Adam
class Config(object):
def __init__(self):
# input configuration
self.input_level = 'word'
self.word_max_len = 128
self.char_max_len = 200
self.max_len = {'word': self.word_max_len,
'char': self.char_max_len
}
self.han_max_sent = 10
self.word_embed_dim = 300
self.word_embed_type = 'glove'
self.word_embed_trainable = False
self.word_embeddings = None
# model structure configuration
self.exp_name = None
self.model_name = None
self.rnn_units = 300
self.dense_units = 512
# model training configuration
self.batch_size = 128
self.n_epoch = 50
self.learning_rate = 0.001
self.optimizer = Adam(self.learning_rate)
self.dropout = 0.5
self.l2_reg = 0.001
# output configuration
self.n_class = 3
# checkpoint configuration
self.checkpoint_dir = 'ckpt'
self.checkpoint_monitor = 'val_acc'
self.checkpoint_save_best_only = True
self.checkpoint_save_weights_only = True
self.checkpoint_save_weights_mode = 'max'
self.checkpoint_verbose = 1
# early_stopping configuration
self.early_stopping_monitor = 'val_acc'
self.early_stopping_mode = 'max'
self.early_stopping_patience = 5
self.early_stopping_verbose = 1