Esempio n. 1
0
#if set to true, then load model from file instead of start a new model
load_model = False
#if set to true, use adam optimizer instead of sgd
adam_opt = True
#batch size for training
batch_size = 128

#data params
#bucket_option = [i for i in range(1, 20+1)]
bucket_option = [5,10,15,20,25,31]
buckets = s2s_reader.create_bucket(bucket_option)

# load the data set into s2s_reader
# the total bucket numbers = bucket options number ^ 2
# if clean mode is true, the leftover data in the bucket will be used before the epoch is over
reader = s2s_reader.reader(file_name = file_name, batch_size = batch_size, buckets = buckets, bucket_option = bucket_option, clean_mode=True)
vocab_size = len(reader.dict)

# if load_model = true, then we need to define the same parameter in the saved_model inorder to load it 
hidden_size = 512
projection_size = 300
embedding_size = 300
num_layers = 1

# ouput_size for softmax layer
output_size = hidden_size
if projection_size!=None:
	output_size = projection_size

#training params, truncated_norm will resample x > 2std; so when std = 0.1, the range of x is [-0.2, 0.2]
truncated_std = 0.1
Esempio n. 2
0
file_name = "bbt_data"
# interactive mode allow user to talk to the model directly, if set to false, it will test on the training data instead
interactive = True
# regular expression for parsing user input
expression = r"[0-9]+|[']*[\w]+"
# signal mode allow user to insert signal token before the decoder generate sentence
signal = False
# batch size for testing
batch_size = 1

# data params
# bucket_option = [i for i in xrange(1, 20+1)]
bucket_option = [5, 10, 15, 20, 25, 31]
buckets = s2s_reader.create_bucket(bucket_option)

reader = s2s_reader.reader(file_name=file_name, batch_size=batch_size, buckets=buckets, bucket_option=bucket_option,
                           signal=signal)
vocab_size = len(reader.dict)

# if load_model = true, then we need to define the same parameter in the saved_model inorder to load it 
hidden_size = 512
projection_size = 300
embedding_size = 300
num_layers = 1

# ouput_size for softmax layer
output_size = hidden_size
if projection_size != None:
    output_size = projection_size

# model name & save path
model_name = "p" + str(projection_size) + "_h" + str(hidden_size) + "_x" + str(num_layers)