forked from asyml/texar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_ptb_medium.py
98 lines (87 loc) · 1.96 KB
/
config_ptb_medium.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
generator_pretrain_epoch = 39
discriminator_pretrain_epoch = 15
adversial_epoch = 20
hidden_size = 650
batch_size = 64
max_num_steps = 35
enc_keep_prob_in = 1.0
dec_keep_prob_out = 0.5
log_dir = './ptb_log.medium/'
log_file = log_dir + 'log.txt'
bleu_file = log_dir + 'bleu.txt'
ckpt = './checkpoint/ckpt'
dec_cell_hparams = {
"type": "LSTMBlockCell",
"kwargs": {
"num_units": hidden_size,
"forget_bias": 0.
},
"dropout": {"output_keep_prob": dec_keep_prob_out},
"num_layers": 2
}
emb_hparams = {
'name': 'lookup_table',
"dim": hidden_size,
'initializer': {
'type': 'random_normal_initializer',
'kwargs': {
'mean': 0.0,
'stddev': hidden_size**-0.5,
},
}
}
train_data_hparams = {
"num_epochs": 1,
"batch_size": batch_size,
"seed": 123,
"dataset": {
"files": 'ptb_data/ptb.train.txt',
"vocab_file": 'ptb_data/vocab.txt',
"max_seq_length": max_num_steps
}
}
val_data_hparams = {
"num_epochs": 1,
"batch_size": batch_size,
"seed": 123,
"dataset": {
"files": 'ptb_data/ptb.valid.txt',
"vocab_file": 'ptb_data/vocab.txt',
"max_seq_length": max_num_steps
}
}
test_data_hparams = {
"num_epochs": 1,
"batch_size": batch_size,
"dataset": {
"files": 'ptb_data/ptb.test.txt',
"vocab_file": 'ptb_data/vocab.txt',
"max_seq_length": max_num_steps
}
}
g_opt_hparams = {
"optimizer": {
"type": "GradientDescentOptimizer",
"kwargs": {"learning_rate": 1.0}
},
"gradient_clip": {
"type": "clip_by_global_norm",
"kwargs": {"clip_norm": 5.}
}
}
d_opt_hparams = {
"optimizer": {
"type": "AdamOptimizer",
"kwargs": {
"learning_rate": 0.0001
}
}
}
update_opt_hparams = {
"optimizer": {
"type": "AdamOptimizer",
"kwargs": {
"learning_rate": 0.0004
}
}
}