-
Notifications
You must be signed in to change notification settings - Fork 1
/
para_config.py
127 lines (121 loc) · 7.43 KB
/
para_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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import tensorflow as tf
def getBigParameter():
flags = tf.app.flags
flags.DEFINE_string("ps_hosts", "none", "Comma-separated list of hostname:port pairs")
flags.DEFINE_string("worker_hosts", "", "Comma-separated list of hostname:port pairs")
# Flags for defining the tf.train.Server
flags.DEFINE_string("job_name", "", "One of 'ps', 'worker'")
flags.DEFINE_integer("task_index", 0, "Index of task within the job")
flags.DEFINE_integer("vocab_size", 10000, "Maximum size of vocabulary")
flags.DEFINE_integer("embedding_size", 64, "Embedding size of each token")
flags.DEFINE_integer("yc_size", 128, "Size of yc layer")
flags.DEFINE_integer("out_channel", 4, "the out channel of the last conventional layer")
flags.DEFINE_integer("filter_size", 32, "Featrue map")
flags.DEFINE_integer("num_layers", 10, "Number of CNN layers")
flags.DEFINE_integer("block_size", 5, "when to run residual block")
flags.DEFINE_integer("filter_h", 3, "Height of the CNN filter")
flags.DEFINE_integer("context_size", 10, "Length of sentence/context")
flags.DEFINE_integer("batch_size", 128, "Batch size of data while training")
flags.DEFINE_integer("epochs", 1000, "Number of epochs")
flags.DEFINE_integer("num_sampled", 1, "Sampling value for NCE loss")
flags.DEFINE_float("learning_rate", 0.0002, "Learning rate for training")
flags.DEFINE_float("l2_lambda", 0.0001, "Learning rate for training")
flags.DEFINE_float("momentum", 0.99, "Nestrov Momentum value")
flags.DEFINE_float("grad_clip", 0.1, "Gradient Clipping limit")
flags.DEFINE_float("dropout_keep_prob", 1, "dropout_keep_prob")
flags.DEFINE_integer("num_batches", 0, "Predefined: to be calculated")
flags.DEFINE_string("ckpt_path", "/search/data/pangshuai/tfmodel/new", "Path to store checkpoints")
flags.DEFINE_string("data_path", ".", "Path of data")
flags.DEFINE_string("train_method", "RMS", "learn_method")
flags.DEFINE_string("loss_type", "seq2seq", "loss function")#softmax_cross_entropy
flags.DEFINE_boolean("TestAccuracy", False, "Test accuracy")
flags.DEFINE_bool("RestoreDic", True, "Restore Dictionary")
flags.DEFINE_bool("TrainModel", True, "TrainModel Flag")
flags.DEFINE_bool("conv_multi", True, "multi size of convolution")
flags.DEFINE_bool("view_cases", False, "view the predicting word and real word")
flags.DEFINE_bool("multiGPU", False, "multi size of convolution")
flags.DEFINE_bool("need_full_connected", True, "TrainModel Flag")
FLAGS = flags.FLAGS
worker_hosts = FLAGS.worker_hosts.split(",")
FLAGS.workernum = len(worker_hosts)
return flags.FLAGS
def getMiddleParameter():
flags = tf.app.flags
flags.DEFINE_string("ps_hosts", "none", "Comma-separated list of hostname:port pairs")
flags.DEFINE_string("worker_hosts", "", "Comma-separated list of hostname:port pairs")
# Flags for defining the tf.train.Server
flags.DEFINE_string("job_name", "", "One of 'ps', 'worker'")
flags.DEFINE_integer("task_index", 0, "Index of task within the job")
flags.DEFINE_integer("vocab_size", 10000, "Maximum size of vocabulary")
flags.DEFINE_integer("embedding_size", 64, "Embedding size of each token")
flags.DEFINE_integer("yc_size", 128, "Size of yc layer")
flags.DEFINE_integer("out_channel", 4, "the out channel of the last conventional layer")
flags.DEFINE_integer("filter_size", 32, "Featrue map")
flags.DEFINE_integer("num_layers", 4, "Number of CNN layers")
flags.DEFINE_integer("block_size", 2, "when to run residual block")
flags.DEFINE_integer("filter_h", 3, "Height of the CNN filter")
flags.DEFINE_integer("context_size", 8, "Length of sentence/context")
flags.DEFINE_integer("batch_size", 128, "Batch size of data while training")
flags.DEFINE_integer("epochs", 1000, "Number of epochs")
flags.DEFINE_integer("num_sampled", 1, "Sampling value for NCE loss")
flags.DEFINE_float("learning_rate", 0.001, "Learning rate for training")
flags.DEFINE_float("l2_lambda", 0.00001, "Learning rate for training")
flags.DEFINE_float("momentum", 0.99, "Nestrov Momentum value")
flags.DEFINE_float("grad_clip", 0.1, "Gradient Clipping limit")
flags.DEFINE_float("dropout_keep_prob", 1, "dropout_keep_prob")
flags.DEFINE_integer("num_batches", 0, "Predefined: to be calculated")
flags.DEFINE_string("ckpt_path", "/search/data/pangshuai/tfmodel/new", "Path to store checkpoints")
flags.DEFINE_string("data_path", ".", "Path of data")
flags.DEFINE_string("train_method", "RMS", "learn_method")
flags.DEFINE_string("loss_type", "seq2seq", "loss function")#softmax_cross_entropy
flags.DEFINE_boolean("TestAccuracy", False, "Test accuracy")
flags.DEFINE_bool("RestoreDic", True, "Restore Dictionary")
flags.DEFINE_bool("TrainModel", True, "TrainModel Flag")
flags.DEFINE_bool("conv_multi", False, "multi size of convolution")
flags.DEFINE_bool("view_cases", False, "view the predicting word and real word")
flags.DEFINE_bool("multiGPU", False, "multi size of convolution")
flags.DEFINE_bool("need_full_connected", True, "TrainModel Flag")
FLAGS = flags.FLAGS
worker_hosts = FLAGS.worker_hosts.split(",")
FLAGS.workernum = len(worker_hosts)
return flags.FLAGS
def getSmallParameter():
flags = tf.app.flags
flags.DEFINE_string("ps_hosts", "none", "Comma-separated list of hostname:port pairs")
flags.DEFINE_string("worker_hosts", "", "Comma-separated list of hostname:port pairs")
# Flags for defining the tf.train.Server
flags.DEFINE_string("job_name", "", "One of 'ps', 'worker'")
flags.DEFINE_integer("task_index", 0, "Index of task within the job")
flags.DEFINE_integer("vocab_size", 10000, "Maximum size of vocabulary")
flags.DEFINE_integer("embedding_size", 32, "Embedding size of each token")
flags.DEFINE_integer("yc_size", 128, "Size of yc layer")
flags.DEFINE_integer("out_channel", 4, "the out channel of the last conventional layer")
flags.DEFINE_integer("filter_size", 32, "Featrue map")
flags.DEFINE_integer("num_layers", 2, "Number of CNN layers")
flags.DEFINE_integer("block_size", 2, "when to run residual block")
flags.DEFINE_integer("filter_h", 3, "Height of the CNN filter")
flags.DEFINE_integer("context_size", 8, "Length of sentence/context")
flags.DEFINE_integer("batch_size", 64, "Batch size of data while training")
flags.DEFINE_integer("epochs", 1000, "Number of epochs")
flags.DEFINE_integer("num_sampled", 1, "Sampling value for NCE loss")
flags.DEFINE_float("learning_rate", 0.001, "Learning rate for training")
flags.DEFINE_float("l2_lambda", 0.00001, "Learning rate for training")
flags.DEFINE_float("momentum", 0.99, "Nestrov Momentum value")
flags.DEFINE_float("grad_clip", 0.1, "Gradient Clipping limit")
flags.DEFINE_float("dropout_keep_prob", 1, "dropout_keep_prob")
flags.DEFINE_integer("num_batches", 0, "Predefined: to be calculated")
flags.DEFINE_string("ckpt_path", "/search/data/pangshuai/tfmodel/new", "Path to store checkpoints")
flags.DEFINE_string("data_path", ".", "Path of data")
flags.DEFINE_string("train_method", "RMS", "learn_method")
flags.DEFINE_string("loss_type", "seq2seq", "loss function")#softmax_cross_entropy
flags.DEFINE_boolean("TestAccuracy", False, "Test accuracy")
flags.DEFINE_bool("RestoreDic", True, "Restore Dictionary")
flags.DEFINE_bool("TrainModel", True, "TrainModel Flag")
flags.DEFINE_bool("conv_multi", False, "multi size of convolution")
flags.DEFINE_bool("view_cases", False, "view the predicting word and real word")
flags.DEFINE_bool("multiGPU", False, "multi size of convolution")
flags.DEFINE_bool("need_full_connected", True, "TrainModel Flag")
FLAGS = flags.FLAGS
worker_hosts = FLAGS.worker_hosts.split(",")
FLAGS.workernum = len(worker_hosts)
return flags.FLAGS