-
Notifications
You must be signed in to change notification settings - Fork 372
/
Copy pathconfig.py
104 lines (95 loc) · 2.63 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
"""Config
"""
# pylint: disable=invalid-name
import copy
# Total number of training epochs (including pre-train and full-train)
max_nepochs = 12
pretrain_nepochs = 10 # Number of pre-train epochs (training as autoencoder)
display = 500 # Display the training results every N training steps.
# Display the dev results every N training steps (set to a
# very large value to disable it).
display_eval = 1e10
sample_path = './samples'
checkpoint_path = './checkpoints'
restore = '' # Model snapshot to restore from
lambda_g = 0.1 # Weight of the classification loss
gamma_decay = 0.5 # Gumbel-softmax temperature anneal rate
train_data = {
'batch_size': 64,
# 'seed': 123,
'datasets': [
{
'files': './data/yelp/sentiment.train.text',
'vocab_file': './data/yelp/vocab',
'data_name': ''
},
{
'files': './data/yelp/sentiment.train.labels',
'data_type': 'int',
'data_name': 'labels'
}
],
'name': 'train'
}
val_data = copy.deepcopy(train_data)
val_data['datasets'][0]['files'] = './data/yelp/sentiment.dev.text'
val_data['datasets'][1]['files'] = './data/yelp/sentiment.dev.labels'
test_data = copy.deepcopy(train_data)
test_data['datasets'][0]['files'] = './data/yelp/sentiment.test.text'
test_data['datasets'][1]['files'] = './data/yelp/sentiment.test.labels'
model = {
'dim_c': 200,
'dim_z': 500,
'embedder': {
'dim': 100,
},
'encoder': {
'rnn_cell': {
'type': 'GRUCell',
'kwargs': {
'num_units': 700
},
'dropout': {
'input_keep_prob': 0.5
}
}
},
'decoder': {
'rnn_cell': {
'type': 'GRUCell',
'kwargs': {
'num_units': 700,
},
'dropout': {
'input_keep_prob': 0.5,
'output_keep_prob': 0.5
},
},
'attention': {
'type': 'BahdanauAttention',
'kwargs': {
'num_units': 700,
},
'attention_layer_size': 700,
},
'max_decoding_length_train': 21,
'max_decoding_length_infer': 20,
},
'classifier': {
'kernel_size': [3, 4, 5],
'filters': 128,
'other_conv_kwargs': {'padding': 'same'},
'dropout_conv': [1],
'dropout_rate': 0.5,
'num_dense_layers': 0,
'num_classes': 1
},
'opt': {
'optimizer': {
'type': 'AdamOptimizer',
'kwargs': {
'learning_rate': 5e-4,
},
},
},
}