From 023c5ea893163dc421bf6f8e3da0097156d31589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jonasson?= Date: Thu, 8 Feb 2018 08:07:22 +0100 Subject: [PATCH] revert temp changes --- question_answering/networks/dcn_model.py | 4 ++-- question_answering/networks/dcn_plus.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/question_answering/networks/dcn_model.py b/question_answering/networks/dcn_model.py index eccfbd5..1a1b2c3 100644 --- a/question_answering/networks/dcn_model.py +++ b/question_answering/networks/dcn_model.py @@ -51,7 +51,7 @@ def __init__(self, pretrained_embeddings, hparams): # Setup RNN Cells cell = lambda: cell_factory(hparams['cell'], hparams['state_size'], self.is_training, hparams['input_keep_prob'], hparams['output_keep_prob'], hparams['state_keep_prob']) - final_cell = lambda: cell_factory(hparams['cell'], hparams['state_size'], self.is_training, 1.0, hparams['output_keep_prob'], hparams['state_keep_prob']) # TODO TEMP hparams['final_input_keep_prob'] + final_cell = lambda: cell_factory(hparams['cell'], hparams['state_size'], self.is_training, hparams['final_input_keep_prob'], hparams['output_keep_prob'], hparams['state_keep_prob']) # TODO TEMP # Setup Encoders with tf.variable_scope('prediction'): @@ -61,7 +61,7 @@ def __init__(self, pretrained_embeddings, hparams): self.encode = dcn_encode else: self.encode = dcnplus_encode - encoding = self.encode(cell, final_cell, q_embeddings, self.question_length, p_embeddings, self.paragraph_length, keep_prob=maybe_dropout(hparams['keep_prob'], self.is_training), final_input_keep_prob=maybe_dropout(hparams['final_input_keep_prob'], self.is_training)) + encoding = self.encode(cell, final_cell, q_embeddings, self.question_length, p_embeddings, self.paragraph_length, keep_prob=maybe_dropout(hparams['keep_prob'], self.is_training)) encoding = tf.nn.dropout(encoding, keep_prob=maybe_dropout(hparams['encoding_keep_prob'], self.is_training)) # Decoder, loss and prediction mechanism are different for baseline/mixed and dcn/dcn_plus diff --git a/question_answering/networks/dcn_plus.py b/question_answering/networks/dcn_plus.py index 66bf7d4..7d1544e 100644 --- a/question_answering/networks/dcn_plus.py +++ b/question_answering/networks/dcn_plus.py @@ -89,7 +89,7 @@ def baseline_encode(cell_factory, final_cell_factory, query, query_length, docum return encoding # N x P x 2H -def dcn_encode(cell_factory, final_cell_factory, query, query_length, document, document_length, keep_prob=1.0, final_input_keep_prob=1.0): +def dcn_encode(cell_factory, final_cell_factory, query, query_length, document, document_length, keep_prob=1.0): """ DCN Encoder that encodes questions and paragraphs into one representation. It first encodes the question and paragraphs using a shared LSTM, then uses a @@ -136,7 +136,6 @@ def dcn_encode(cell_factory, final_cell_factory, query, query_length, document, with tf.variable_scope('final_encoder'): document_representation = tf.concat(document_representations, 2) - document_representation = tf.nn.dropout(document_representation, final_input_keep_prob) # test if wanted final = final_cell_factory() outputs, _ = tf.nn.bidirectional_dynamic_rnn( cell_fw = final,